tstRTCoreDump.cpp revision 5330cda3253fc3d94ed03a7609774e8c85a4c56d
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * IPRT Testcase - Core Dumper.
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * Copyright (C) 2010 Oracle Corporation
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * available from http://www.virtualbox.org. This file is free software;
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * you can redistribute it and/or modify it under the terms of the GNU
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * General Public License (GPL) as published by the Free Software
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * The contents of this file may alternatively be used under the terms
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * of the Common Development and Distribution License Version 1.0
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * VirtualBox OSE distribution, in which case the provisions of the
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * CDDL are applicable instead of those of the GPL.
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * You may elect to license modified versions of this file under the
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync * terms and conditions of either the GPL or the CDDL or both.
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync/*******************************************************************************
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync* Header Files *
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync*******************************************************************************/
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync/*******************************************************************************
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsync*******************************************************************************/
c74a793852e1fd8994bf9bd2495e1b731ed4ac09vboxsyncstatic unsigned volatile g_cErrors = 0;
5330cda3253fc3d94ed03a7609774e8c85a4c56dvboxsyncstatic DECLCALLBACK(int) SleepyThread(RTTHREAD Thread, void *pvUser)
5330cda3253fc3d94ed03a7609774e8c85a4c56dvboxsync * Setup core dumping.
5330cda3253fc3d94ed03a7609774e8c85a4c56dvboxsync * Spawn a few threads.
5330cda3253fc3d94ed03a7609774e8c85a4c56dvboxsync unsigned i = 0;
5330cda3253fc3d94ed03a7609774e8c85a4c56dvboxsync rc = RTThreadCreate(&ahThreads[i], SleepyThread, &ahThreads[i], 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "TEST1");
5330cda3253fc3d94ed03a7609774e8c85a4c56dvboxsync RTPrintf("tstRTCoreDump: FAILURE(%d) - %d RTThreadCreate failed, rc=%Rrc\n", __LINE__, i, rc);
5330cda3253fc3d94ed03a7609774e8c85a4c56dvboxsync * Write the core to disk.
5330cda3253fc3d94ed03a7609774e8c85a4c56dvboxsync RTPrintf("RTCoreDumperTakeDump failed. rc=%Rrc\n", rc);
5330cda3253fc3d94ed03a7609774e8c85a4c56dvboxsync RTPrintf("RTCoreDumperSetup failed. rc=%Rrc\n", rc);
5330cda3253fc3d94ed03a7609774e8c85a4c56dvboxsync RTPrintf("tstRTCoreDump: FAILURE - %d errors\n", g_cErrors);