Callgrind: fix bug 217849: Switch to running thread in CLG_(post_signal)
If instrumentation is switched off on multithreaded code,
multiple signals in a row handled by different threads could
confuse callgrind.
Callgrind assumed that in post_signal, it has the correct understanding
of the currently running thread. This is not always correct.
Really switch to running thread.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10966 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/callgrind/threads.c b/callgrind/threads.c
index 9334667..ea5c189 100644
--- a/callgrind/threads.c
+++ b/callgrind/threads.c
@@ -203,7 +203,7 @@
tid, sigNum, alt_stack ? "yes":"no");
/* switch to the thread the handler runs in */
- CLG_(run_thread)(tid);
+ CLG_(switch_thread)(tid);
/* save current execution state */
exec_state_save();
@@ -243,7 +243,8 @@
CLG_DEBUG(0, ">> post_signal(TID %d, sig %d)\n",
tid, sigNum);
- CLG_ASSERT(tid == CLG_(current_tid));
+ /* thread switching potentially needed, eg. with instrumentation off */
+ CLG_(switch_thread)(tid);
CLG_ASSERT(sigNum == CLG_(current_state).sig);
/* Unwind call stack of this signal handler.