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 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c
index 7d5f666..7fa516b 100644
--- a/cachegrind/cg_main.c
+++ b/cachegrind/cg_main.c
@@ -705,8 +705,10 @@
 
 
 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 @@
 
    // 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 d7fc9f6..9e3a06c 100644
--- a/coregrind/m_tooliface.c
+++ b/coregrind/m_tooliface.c
@@ -40,8 +40,8 @@
 
 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 5bb217c..b246c1d 100644
--- a/coregrind/pub_core_tooliface.h
+++ b/coregrind/pub_core_tooliface.h
@@ -104,8 +104,10 @@
    // 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 6ad4e1a..7164c7b 100644
--- a/helgrind/hg_main.c
+++ b/helgrind/hg_main.c
@@ -2293,8 +2293,10 @@
 }
 #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 1668f89..55fc352 100644
--- a/include/pub_tool_tooliface.h
+++ b/include/pub_tool_tooliface.h
@@ -73,6 +73,19 @@
 /* ------------------------------------------------------------------ */
 /* 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 @@
    // 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 1aa5e85..d5a0222 100644
--- a/lackey/lk_main.c
+++ b/lackey/lk_main.c
@@ -273,9 +273,11 @@
 }
 
 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 dda257a..73616a9 100644
--- a/massif/ms_main.c
+++ b/massif/ms_main.c
@@ -1095,8 +1095,10 @@
 /*------------------------------------------------------------*/
 
 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 16064ca..4de9f52 100644
--- a/memcheck/mc_include.h
+++ b/memcheck/mc_include.h
@@ -79,8 +79,10 @@
 
 /* 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 f28ca2b..9150d37 100644
--- a/memcheck/mc_translate.c
+++ b/memcheck/mc_translate.c
@@ -2977,8 +2977,10 @@
 }
 
 
-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 c5370a7..7aff41a 100644
--- a/none/nl_main.c
+++ b/none/nl_main.c
@@ -37,9 +37,11 @@
 }
 
 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;
 }