]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Change VG_(nuke_all_threads) to disassociate the the stacks of the threads
authorTom Hughes <tom@compton.nu>
Fri, 12 Nov 2004 23:11:21 +0000 (23:11 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 12 Nov 2004 23:11:21 +0000 (23:11 +0000)
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

coregrind/vg_scheduler.c

index 6ff8952469ea17fa461702feef6b183907f39556..0edb0fa4723bd946397ed650e3685f690195d9ef 100644 (file)
@@ -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 );
    }
 }