]> 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>
Wed, 17 Nov 2004 00:02:04 +0000 (00:02 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 17 Nov 2004 00:02:04 +0000 (00:02 +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.

MERGE TO STABLE

git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_2_2_0_BRANCH@3033

coregrind/vg_scheduler.c

index 733f4845fbe064998739f3454c977ffa4180ed85..285502a2544a1276ae38cbed3597afa6c26136d7 100644 (file)
@@ -1420,9 +1420,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 */
-   VG_TRACK( die_mem_stack, VG_(threads)[tid].stack_base,
-                            VG_(threads)[tid].stack_size );
+   if (VG_(threads)[tid].stack_base) {
+     VG_TRACK( die_mem_stack, VG_(threads)[tid].stack_base,
+                              VG_(threads)[tid].stack_size );
+   }
 
    /* Deallocate its LDT, if it ever had one. */
    VG_(deallocate_LDT_for_thread)( VG_(threads)[tid].ldt );
@@ -1519,6 +1522,8 @@ void VG_(nuke_all_threads_except) ( ThreadId me )
             "VG_(nuke_all_threads_except): nuking tid %d\n", tid);
       VG_(proxy_delete)(tid, True);
       VG_(threads)[tid].status = VgTs_Empty;
+      VG_(threads)[tid].stack_base = (Addr)NULL;
+      VG_(threads)[tid].stack_size = 0;
       cleanup_after_thread_exited( tid, True );
    }
 }