From: Nicholas Nethercote Date: Sun, 13 Mar 2005 04:39:28 +0000 (+0000) Subject: Get more useful stack traces for internal errors/panics which happen X-Git-Tag: svn/VALGRIND_3_0_0~996 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ba7d6423e23ece898c0db235063266cc6095cf12;p=thirdparty%2Fvalgrind.git Get more useful stack traces for internal errors/panics which happen during the exit cleanup. Also, don't report stack growth failures if the fault is actually way above the stack. MERGED FROM CVS HEAD git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3322 --- diff --git a/coregrind/vg_signals.c b/coregrind/vg_signals.c index 6ad4585acf..dfa2c8c512 100644 --- a/coregrind/vg_signals.c +++ b/coregrind/vg_signals.c @@ -1828,7 +1828,8 @@ void vg_sync_signalhandler ( Int sigNo, vki_siginfo_t *info, struct vki_ucontext VG_(shadow_base), VG_(shadow_end)); } if (info->si_code == 1 /* SEGV_MAPERR */ - && fault >= (esp - ARCH_STACK_REDZONE_SIZE)) { + && fault >= (esp - ARCH_STACK_REDZONE_SIZE) + && fault < VG_(client_end)) { /* If the fault address is above esp but below the current known stack segment base, and it was a fault because there was nothing mapped there (as opposed to a permissions fault), @@ -1925,7 +1926,9 @@ void vg_sync_signalhandler ( Int sigNo, vki_siginfo_t *info, struct vki_ucontext if (0) VG_(kill_self)(sigNo); /* generate a core dump */ - tst = VG_(get_ThreadState)(VG_(get_lwp_tid)(VG_(gettid)())); + if (tid == 0) /* could happen after everyone has exited */ + tid = VG_(master_tid); + tst = VG_(get_ThreadState)(tid); VG_(core_panic_at)("Killed by fatal signal", VG_(get_ExeContext2)(UCONTEXT_INSTR_PTR(uc), UCONTEXT_FRAME_PTR(uc),