]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
These files all speak about instrumentation functions.
authorJulian Seward <jseward@acm.org>
Tue, 17 Jan 2006 02:06:39 +0000 (02:06 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 17 Jan 2006 02:06:39 +0000 (02:06 +0000)
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

cachegrind/cg_main.c
coregrind/m_tooliface.c
coregrind/pub_core_tooliface.h
helgrind/hg_main.c
include/pub_tool_tooliface.h
lackey/lk_main.c
massif/ms_main.c
memcheck/mc_include.h
memcheck/mc_translate.c
none/nl_main.c

index 7d5f6667135841457ccbceeb28e164385f6b67b0..7fa516bb90c966d933a20b1acf0d62edc41ee31b 100644 (file)
@@ -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)
index d7fc9f627955941df2054c600c3512f7fbeef174..9e3a06ca388b7f0fc5f23c0b21daf867985e97c0 100644 (file)
@@ -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)
 )
 {
index 5bb217cc4823cd8f8c017f29f27282812bc9dc07..b246c1d78736a21489fe4a50dc43d5f17b5d1989 100644 (file)
@@ -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
index 6ad4e1a69f314a2f39b52a3415425b9dd906094f..7164c7b90cc704c6be94440ad17b4522819dff34 100644 (file)
@@ -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
index 1668f89f46316c233104bd5c6dca7745dd985e97..55fc3520643120c0097f19b7ea1d65aa9efa022e 100644 (file)
@@ -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)().
index 1aa5e85e913e8cc30d7a12ca40298389ca5f7024..d5a02224bf1e2d11ce41406ce8068b9688ebefa5 100644 (file)
@@ -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;
index dda257a49fa073bbc2238688ea1d7d1faf74d498..73616a9cae6c651c40dbc46c9dc955ea17529d7b 100644 (file)
@@ -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 ? */
index 16064ca075f0335bcee796844039bc68a7471e94..4de9f5297e7fabbd745f13ea141d7d1f83900ef4 100644 (file)
@@ -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 */
index f28ca2bf7f719547535d76889eb9cdf5f4c69bdb..9150d3719898c533ff11e930e314872154342f1d 100644 (file)
@@ -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; 
index c5370a7674bab9325e6066b7df7bf7256544164b..7aff41a8f7ce40eadb6204b982cc2c62ee7755fc 100644 (file)
@@ -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;
 }