From 931a40e83b240418f9beae42f33c6c930090c13a Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Sun, 25 Nov 2007 14:06:06 +0000 Subject: [PATCH] Core-tool iface changes needed to support exp-drd (Bart Van Assche). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7212 --- coregrind/m_syswrap/syswrap-linux.c | 2 ++ coregrind/m_tooliface.c | 1 + coregrind/pub_core_tooliface.h | 1 + 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 f118434e57..e276fa5ae0 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 b7440caa91..2aa74e9b07 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 f6690fe4d2..7f77fed57e 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 1f08521b37..cfc57d7543 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) -- 2.47.2