From: Tom Hughes Date: Fri, 12 Nov 2004 23:11:21 +0000 (+0000) Subject: Change VG_(nuke_all_threads) to disassociate the the stacks of the threads X-Git-Tag: svn/VALGRIND_3_0_0~1332 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a70bde344a37c71c08060b375a47f713897f7f1;p=thirdparty%2Fvalgrind.git Change VG_(nuke_all_threads) to disassociate the the stacks of the threads being killed from the threads rather than marking them as inaccessible. This should fix the problem with the environment (and other data from the stacks of other threads) causing warnings after a fork. I believe that VG_(nuke_all_threads) is only called in places where this is the behaviour that we want or where it doesn't matter because we're about to exit anyway. I believe this fixes bug 85625 but I'm still waiting for confirmation. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2980 --- diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c index 6ff8952469..0edb0fa472 100644 --- a/coregrind/vg_scheduler.c +++ b/coregrind/vg_scheduler.c @@ -1292,9 +1292,12 @@ void cleanup_after_thread_exited ( ThreadId tid, Bool forcekill ) vg_assert(is_valid_or_empty_tid(tid)); vg_assert(VG_(threads)[tid].status == VgTs_Empty); + /* Its stack is now off-limits */ - seg = VG_(find_segment)( VG_(threads)[tid].stack_base ); - VG_TRACK( die_mem_stack, seg->addr, seg->len ); + if (VG_(threads)[tid].stack_base) { + seg = VG_(find_segment)( VG_(threads)[tid].stack_base ); + VG_TRACK( die_mem_stack, seg->addr, seg->len ); + } VGA_(cleanup_thread)( &VG_(threads)[tid].arch ); @@ -1388,6 +1391,8 @@ void VG_(nuke_all_threads_except) ( ThreadId me ) VG_(threads)[tid].status = VgTs_Empty; VG_(threads)[tid].associated_mx = NULL; VG_(threads)[tid].associated_cv = NULL; + VG_(threads)[tid].stack_base = NULL; + VG_(threads)[tid].stack_size = 0; cleanup_after_thread_exited( tid, True ); } }