From: Julian Seward Date: Tue, 17 Jan 2006 02:06:39 +0000 (+0000) Subject: These files all speak about instrumentation functions. X-Git-Tag: svn/VALGRIND_3_2_0~376 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0d678baabbd61b4f24d6641e2b8506f87a75006;p=thirdparty%2Fvalgrind.git These files all speak about instrumentation functions. Instrumentation functions now take a callback closure structure (VgCallbackClosure*), so this commit changes the signatures accordingly. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5535 --- diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c index 7d5f666713..7fa516bb90 100644 --- a/cachegrind/cg_main.c +++ b/cachegrind/cg_main.c @@ -705,8 +705,10 @@ void addEvent_Dw ( CgState* cgs, InstrInfo* inode, Int datasize, IRAtom* ea ) static -IRBB* cg_instrument ( IRBB* bbIn, VexGuestLayout* layout, - Addr64 orig_addr_noredir, VexGuestExtents* vge, +IRBB* cg_instrument ( VgCallbackClosure* closure, + IRBB* bbIn, + VexGuestLayout* layout, + VexGuestExtents* vge, IRType gWordTy, IRType hWordTy ) { Int i, isize; @@ -744,7 +746,7 @@ IRBB* cg_instrument ( IRBB* bbIn, VexGuestLayout* layout, // Set up running state and get block info cgs.events_used = 0; - cgs.bbInfo = get_BB_info(bbIn, (Addr)orig_addr_noredir); + cgs.bbInfo = get_BB_info(bbIn, (Addr)closure->nraddr); cgs.bbInfo_i = 0; if (DEBUG_CG) diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c index d7fc9f6279..9e3a06ca38 100644 --- a/coregrind/m_tooliface.c +++ b/coregrind/m_tooliface.c @@ -40,8 +40,8 @@ VgToolInterface VG_(tdict); void VG_(basic_tool_funcs)( void(*post_clo_init)(void), - IRBB*(*instrument)(IRBB*, VexGuestLayout*, - Addr64, VexGuestExtents*, IRType, IRType ), + IRBB*(*instrument)(VgCallbackClosure*, IRBB*, + VexGuestLayout*, VexGuestExtents*, IRType, IRType), void(*fini)(Int) ) { diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h index 5bb217cc48..b246c1d787 100644 --- a/coregrind/pub_core_tooliface.h +++ b/coregrind/pub_core_tooliface.h @@ -104,8 +104,10 @@ typedef struct { // Basic functions void (*tool_pre_clo_init) (void); void (*tool_post_clo_init)(void); - IRBB* (*tool_instrument) (IRBB*, VexGuestLayout*, - Addr64, VexGuestExtents*, IRType, IRType); + IRBB* (*tool_instrument) (VgCallbackClosure*, + IRBB*, + VexGuestLayout*, VexGuestExtents*, + IRType, IRType); void (*tool_fini) (Int); // VG_(needs).core_errors diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index 6ad4e1a69f..7164c7b90c 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -2293,8 +2293,10 @@ UCodeBlock* TL_(instrument) ( UCodeBlock* cb_in, Addr not_used ) } #endif static -IRBB* hg_instrument ( IRBB* bb_in, VexGuestLayout* layout, - Addr64 orig_addr_noredir, VexGuestExtents* vge, +IRBB* hg_instrument ( VgCallbackClosure* closure, + IRBB* bb, + VexGuestLayout* layout, + VexGuestExtents* vge, IRType gWordTy, IRType hWordTy ) { tl_assert(0); // Need to convert to Vex diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h index 1668f89f46..55fc352064 100644 --- a/include/pub_tool_tooliface.h +++ b/include/pub_tool_tooliface.h @@ -73,6 +73,19 @@ extern const ToolInfo VG_(tool_info); /* ------------------------------------------------------------------ */ /* Basic tool functions */ +/* The tool_instrument function is passed as a callback to + LibVEX_Translate. VgInstrumentClosure carries additional info + which the instrumenter might like to know, but which is opaque to + Vex. +*/ +typedef + struct { + Addr64 nraddr; /* non-redirected guest address */ + Addr64 readdr; /* redirected guest address */ + ThreadId tid; /* tid requesting translation */ + } + VgCallbackClosure; + extern void VG_(basic_tool_funcs)( // Do any initialisation that can only be done after command line // processing. @@ -84,9 +97,10 @@ extern void VG_(basic_tool_funcs)( // strange... Note that orig_addr_noredir is not necessarily the // same as the address of the first instruction in the IR, due to // function redirection. - IRBB* (*instrument)(IRBB* bb_in, VexGuestLayout* layout, - Addr64 orig_addr_noredir, VexGuestExtents* vge, - IRType gWordTy, IRType hWordTy ), + IRBB*(*instrument)(VgCallbackClosure*, + IRBB* bb_in, + VexGuestLayout*, VexGuestExtents*, + IRType gWordTy, IRType hWordTy), // Finish up, print out any results, etc. `exitcode' is program's exit // code. The shadow can be found with VG_(get_exit_status_shadow)(). diff --git a/lackey/lk_main.c b/lackey/lk_main.c index 1aa5e85e91..d5a02224bf 100644 --- a/lackey/lk_main.c +++ b/lackey/lk_main.c @@ -273,9 +273,11 @@ static void lk_post_clo_init(void) } static -IRBB* lk_instrument( IRBB* bb_in, VexGuestLayout* layout, - Addr64 orig_addr_noredir, VexGuestExtents* vge, - IRType gWordTy, IRType hWordTy ) +IRBB* lk_instrument ( VgCallbackClosure* closure, + IRBB* bb_in, + VexGuestLayout* layout, + VexGuestExtents* vge, + IRType gWordTy, IRType hWordTy ) { IRDirty* di; Int i; diff --git a/massif/ms_main.c b/massif/ms_main.c index dda257a49f..73616a9cae 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -1095,8 +1095,10 @@ static Bool ms_handle_client_request ( ThreadId tid, UWord* argv, UWord* ret ) /*------------------------------------------------------------*/ static -IRBB* ms_instrument ( IRBB* bb_in, VexGuestLayout* layout, - Addr64 orig_addr_noredir, VexGuestExtents* vge, +IRBB* ms_instrument ( VgCallbackClosure* closure, + IRBB* bb_in, + VexGuestLayout* layout, + VexGuestExtents* vge, IRType gWordTy, IRType hWordTy ) { /* XXX Will Massif work when gWordTy != hWordTy ? */ diff --git a/memcheck/mc_include.h b/memcheck/mc_include.h index 16064ca075..4de9f5297e 100644 --- a/memcheck/mc_include.h +++ b/memcheck/mc_include.h @@ -79,8 +79,10 @@ extern void MC_(helperc_MAKE_STACK_UNINIT) ( Addr base, UWord len ); /* Functions defined in mc_translate.c */ extern -IRBB* MC_(instrument) ( IRBB* bb_in, VexGuestLayout* layout, - Addr64 orig_addr_noredir, VexGuestExtents* vge, +IRBB* MC_(instrument) ( VgCallbackClosure* closure, + IRBB* bb_in, + VexGuestLayout* layout, + VexGuestExtents* vge, IRType gWordTy, IRType hWordTy ); #endif /* ndef __MC_INCLUDE_H */ diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c index f28ca2bf7f..9150d37198 100644 --- a/memcheck/mc_translate.c +++ b/memcheck/mc_translate.c @@ -2977,8 +2977,10 @@ static Bool checkForBogusLiterals ( /*FLAT*/ IRStmt* st ) } -IRBB* MC_(instrument) ( IRBB* bb_in, VexGuestLayout* layout, - Addr64 orig_addr_noredir, VexGuestExtents* vge, +IRBB* MC_(instrument) ( VgCallbackClosure* closure, + IRBB* bb_in, + VexGuestLayout* layout, + VexGuestExtents* vge, IRType gWordTy, IRType hWordTy ) { Bool verboze = False; //True; diff --git a/none/nl_main.c b/none/nl_main.c index c5370a7674..7aff41a8f7 100644 --- a/none/nl_main.c +++ b/none/nl_main.c @@ -37,9 +37,11 @@ static void nl_post_clo_init(void) } static -IRBB* nl_instrument(IRBB* bb, VexGuestLayout* layout, - Addr64 orig_addr_noredir, VexGuestExtents* vge, - IRType gWordTy, IRType hWordTy) +IRBB* nl_instrument ( VgCallbackClosure* closure, + IRBB* bb, + VexGuestLayout* layout, + VexGuestExtents* vge, + IRType gWordTy, IRType hWordTy ) { return bb; }