Changeset 32411 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Sep 10, 2010 2:40:01 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/solaris/coredumper-solaris.cpp
r32406 r32411 61 61 * Globals * 62 62 *******************************************************************************/ 63 static RTNATIVETHREAD volatile g_CoreDumpThread = NIL_RTNATIVETHREAD;63 static RTNATIVETHREAD volatile g_CoreDumpThread = NIL_RTNATIVETHREAD; 64 64 static bool volatile g_fCoreDumpSignalSetup = false; 65 65 static bool volatile g_fCoreDumpDeliberate = false; … … 541 541 /* Terminate list of vectors */ 542 542 pVBoxProc->cAuxVecs = cbAuxFile / sizeof(auxv_t); 543 CORELOG((CORELOG_NAME "ProcReadAuxVecs: cbAuxFile=%u auxv_t size %d cAuxVecs=%u\n", cbAuxFile, sizeof(auxv_t), pVBoxProc->cAuxVecs)); 543 CORELOG((CORELOG_NAME "ProcReadAuxVecs: cbAuxFile=%u auxv_t size %d cAuxVecs=%u\n", cbAuxFile, sizeof(auxv_t), 544 pVBoxProc->cAuxVecs)); 544 545 if (pVBoxProc->cAuxVecs > 0) 545 546 { … … 666 667 if (RT_FAILURE(rc2)) 667 668 { 668 CORELOGRELSYS((CORELOG_NAME "ProcReadMappings: skipping mapping. vaddr=%#x rc=%Rrc\n", pCur->pMap.pr_vaddr, rc2)); 669 CORELOGRELSYS((CORELOG_NAME "ProcReadMappings: skipping mapping. vaddr=%#x rc=%Rrc\n", 670 pCur->pMap.pr_vaddr, rc2)); 669 671 670 672 /* … … 695 697 else 696 698 { 697 CORELOGRELSYS((CORELOG_NAME "ProcReadMappings: GetMemoryChunk failed %u\n", pVBoxProc->cMappings * sizeof(VBOXSOLMAPINFO))); 699 CORELOGRELSYS((CORELOG_NAME "ProcReadMappings: GetMemoryChunk failed %u\n", 700 pVBoxProc->cMappings * sizeof(VBOXSOLMAPINFO))); 698 701 rc = VERR_NO_MEMORY; 699 702 } … … 873 876 CORELOGRELSYS((CORELOG_NAME "ProcReadThreads: huh!? cbStatusHdrAndData=%u prheader_t=%u entsize=%u\n", cbStatusHdrAndData, 874 877 sizeof(prheader_t), pStatusHdr->pr_entsize)); 875 CORELOGRELSYS((CORELOG_NAME "ProcReadThreads: huh!? cbInfoHdrAndData=%u entsize=%u\n", cbInfoHdrAndData, pStatusHdr->pr_entsize)); 878 CORELOGRELSYS((CORELOG_NAME "ProcReadThreads: huh!? cbInfoHdrAndData=%u entsize=%u\n", cbInfoHdrAndData, 879 pStatusHdr->pr_entsize)); 876 880 rc = VERR_INVALID_STATE; 877 881 } … … 922 926 if (rc < 0) 923 927 { 924 CORELOGRELSYS((CORELOG_NAME "ProcReadMiscInfo: getzonenamebyid failed. rc=%d errno=%d zoneid=%d\n", rc, errno, pVBoxProc->ProcInfo.pr_zoneid)); 928 CORELOGRELSYS((CORELOG_NAME "ProcReadMiscInfo: getzonenamebyid failed. rc=%d errno=%d zoneid=%d\n", rc, errno, 929 pVBoxProc->ProcInfo.pr_zoneid)); 925 930 return VERR_GENERAL_FAILURE; 926 931 } … … 1778 1783 * Create the core file. 1779 1784 */ 1780 rc = RTFileOpen(&pVBoxCore->hCoreFile, pVBoxCore->szCorePath, RTFILE_O_OPEN_CREATE | RTFILE_O_TRUNCATE | RTFILE_O_READWRITE | RTFILE_O_DENY_ALL); 1785 rc = RTFileOpen(&pVBoxCore->hCoreFile, pVBoxCore->szCorePath, 1786 RTFILE_O_OPEN_CREATE | RTFILE_O_TRUNCATE | RTFILE_O_READWRITE | RTFILE_O_DENY_ALL); 1781 1787 if (RT_FAILURE(rc)) 1782 1788 { … … 2135 2141 CORELOGRELSYS((CORELOG_NAME "TakeDump failed! rc=%Rrc\n", rc)); 2136 2142 } 2137 else if (Sig == SIGSEGV || Sig == SIGBUS )2143 else if (Sig == SIGSEGV || Sig == SIGBUS || Sig == SIGTRAP) 2138 2144 { 2139 2145 /* … … 2181 2187 } 2182 2188 2183 if (Sig == SIGSEGV || Sig == SIGBUS )2189 if (Sig == SIGSEGV || Sig == SIGBUS || Sig == SIGTRAP) 2184 2190 { 2185 2191 /* … … 2189 2195 signal(SIGSEGV, SIG_DFL); 2190 2196 signal(SIGBUS, SIG_DFL); 2197 signal(SIGTRAP, SIG_DFL); 2191 2198 2192 2199 /* … … 2255 2262 * Validate flags. 2256 2263 */ 2257 AssertReturn(fFlags, VERR_INVALID_PARAMETER); /** @todo r=bird: Update the function docs to reflect this. It currently reads 2258 * as if RTCOREDUMPER_FLAGS_REPLACE_SYSTEM_DUMP was standard behavior. 2259 * The SIGUSR2/RTCOREDUMPER_FLAGS_LIVE_CORE behavior isn't mentioned at all. */ 2264 AssertReturn(fFlags, VERR_INVALID_PARAMETER); 2260 2265 AssertReturn(!(fFlags & ~( RTCOREDUMPER_FLAGS_REPLACE_SYSTEM_DUMP 2261 2266 | RTCOREDUMPER_FLAGS_LIVE_CORE)), … … 2275 2280 * Adding the conditional registration via the two flags complicates 2276 2281 * the implementation of this use case. */ 2282 2277 2283 /* 2278 2284 * Install core dump signal handler. 2279 2285 */ 2280 struct sigaction sigAct; 2281 RT_ZERO(sigAct); 2282 sigAct.sa_sigaction = &rtCoreDumperSignalHandler; 2283 sigemptyset(&sigAct.sa_mask); /** @todo r=bird: We're probably better off blocking all signals here. */ 2284 sigAct.sa_flags = SA_RESTART | SA_SIGINFO | SA_NODEFER; /** @todo r=bird: SA_NODEFER doesn't make sense for SIGUSR2. For the hardware triggered ones, I don't think you can efficiently mask them, but it doesn't hurt playing safe ofc. */ 2285 2286 if (fFlags & RTCOREDUMPER_FLAGS_REPLACE_SYSTEM_DUMP) 2287 { 2288 sigaction(SIGSEGV, &sigAct, NULL); 2289 sigaction(SIGBUS, &sigAct, NULL); 2290 /** @todo Add SIGTRAP or release+fatal assertions. */ 2291 } 2292 2293 if (fFlags & RTCOREDUMPER_FLAGS_LIVE_CORE) 2294 sigaction(SIGUSR2, &sigAct, NULL); 2295 2296 ASMAtomicWriteBool(&g_fCoreDumpSignalSetup, true); 2286 if ( ASMAtomicReadBool(&g_fCoreDumpSignalSetup) == false 2287 || ASMAtomicReadU32(&g_fCoreDumpFlags) != fFlags) 2288 { 2289 struct sigaction sigAct; 2290 RT_ZERO(sigAct); 2291 sigAct.sa_sigaction = &rtCoreDumperSignalHandler; 2292 sigfillset(&sigAct.sa_mask); /* Block all signals while in the signal handler */ 2293 sigAct.sa_flags = SA_RESTART | SA_SIGINFO; 2294 2295 if ( (fFlags & RTCOREDUMPER_FLAGS_REPLACE_SYSTEM_DUMP) 2296 && !(g_fCoreDumpFlags & RTCOREDUMPER_FLAGS_REPLACE_SYSTEM_DUMP)) 2297 { 2298 sigAct.sa_flags |= SA_NODEFER; /* Don't block the below signal while in it's signal handler. */ 2299 sigaction(SIGSEGV, &sigAct, NULL); 2300 sigaction(SIGBUS, &sigAct, NULL); 2301 sigaction(SIGTRAP, &sigAct, NULL); 2302 } 2303 2304 if ( fFlags & RTCOREDUMPER_FLAGS_LIVE_CORE 2305 && !(g_fCoreDumpFlags & RTCOREDUMPER_FLAGS_LIVE_CORE)) 2306 { 2307 sigAct.sa_flags = SA_RESTART | SA_SIGINFO; 2308 sigaction(SIGUSR2, &sigAct, NULL); 2309 } 2310 2311 ASMAtomicWriteU32(&g_fCoreDumpFlags, fFlags); 2312 ASMAtomicWriteBool(&g_fCoreDumpSignalSetup, true); 2313 } 2297 2314 2298 2315 RT_ZERO(g_szCoreDumpDir); … … 2300 2317 RTStrCopy(g_szCoreDumpDir, sizeof(g_szCoreDumpDir), pszOutputDir); 2301 2318 2302 ASMAtomicWriteU32(&g_fCoreDumpFlags, fFlags);2303 2304 2319 return VINF_SUCCESS; 2305 2320 } … … 2315 2330 signal(SIGSEGV, SIG_DFL); 2316 2331 signal(SIGBUS, SIG_DFL); 2332 signal(SIGTRAP, SIG_DFL); 2317 2333 signal(SIGUSR2, SIG_DFL); 2318 2334 ASMAtomicWriteBool(&g_fCoreDumpSignalSetup, false);
Note:
See TracChangeset
for help on using the changeset viewer.