diff options
-rw-r--r-- | coregrind/m_syswrap/syswrap-linux.c | 2 | ||||
-rw-r--r-- | coregrind/m_tooliface.c | 1 | ||||
-rw-r--r-- | coregrind/pub_core_tooliface.h | 1 | ||||
-rw-r--r-- | include/pub_tool_tooliface.h | 16 |
4 files changed, 18 insertions, 2 deletions
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index f118434e5..e276fa5ae 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -78,6 +78,8 @@ static VgSchedReturnCode thread_wrapper(Word /*ThreadId*/ tidW) VG_(printf)("thread tid %d started: stack = %p\n", tid, &tid); + VG_TRACK(pre_thread_first_insn, tid); + tst->os_state.lwpid = VG_(gettid)(); tst->os_state.threadgroup = VG_(getpid)(); diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c index b7440caa9..2aa74e9b0 100644 --- a/coregrind/m_tooliface.c +++ b/coregrind/m_tooliface.c @@ -335,6 +335,7 @@ DEF(track_start_client_code, ThreadId, ULong) DEF(track_stop_client_code, ThreadId, ULong) DEF(track_pre_thread_ll_create, ThreadId, ThreadId) +DEF(track_pre_thread_first_insn, ThreadId) DEF(track_pre_thread_ll_exit, ThreadId) DEF(track_pre_deliver_signal, ThreadId, Int sigNo, Bool) diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h index f6690fe4d..7f77fed57 100644 --- a/coregrind/pub_core_tooliface.h +++ b/coregrind/pub_core_tooliface.h @@ -209,6 +209,7 @@ typedef struct { void (*track_stop_client_code) (ThreadId, ULong); void (*track_pre_thread_ll_create)(ThreadId, ThreadId); + void (*track_pre_thread_first_insn)(ThreadId); void (*track_pre_thread_ll_exit) (ThreadId); void (*track_pre_deliver_signal) (ThreadId, Int sigNo, Bool); diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h index 1f08521b3..cfc57d754 100644 --- a/include/pub_tool_tooliface.h +++ b/include/pub_tool_tooliface.h @@ -588,9 +588,21 @@ void VG_(track_stop_client_code)( low-level thread create/quit event. In general a few hundred instructions; hence a few hundred(ish) memory references could get misclassified each time. + + pre_thread_first_insn: is called when the thread is all set up and + ready to go (stack in place, etc) but has not executed its first + instruction yet. Gives threading tools a chance to ask questions + about the thread (eg, what is its initial client stack pointer) + that are not easily answered at pre_thread_ll_create time. + + For a given thread, the call sequence is: + ll_create (in the parent's context) + first_insn (in the child's context) + ll_exit (in the child's context) */ -void VG_(track_pre_thread_ll_create)(void(*f)(ThreadId tid, ThreadId child)); -void VG_(track_pre_thread_ll_exit) (void(*f)(ThreadId tid)); +void VG_(track_pre_thread_ll_create) (void(*f)(ThreadId tid, ThreadId child)); +void VG_(track_pre_thread_first_insn)(void(*f)(ThreadId tid)); +void VG_(track_pre_thread_ll_exit) (void(*f)(ThreadId tid)); /* Signal events (not exhaustive) |