Ripple from constifying parameters of instrumentation functions and
callbacks from VexTranslateArgs. See VEX r2958.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14564 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c
index 4bb465e..9746b75 100644
--- a/cachegrind/cg_main.c
+++ b/cachegrind/cg_main.c
@@ -1048,9 +1048,9 @@
 static
 IRSB* cg_instrument ( VgCallbackClosure* closure,
                       IRSB* sbIn, 
-                      VexGuestLayout* layout, 
-                      VexGuestExtents* vge,
-                      VexArchInfo* archinfo_host,
+                      const VexGuestLayout* layout, 
+                      const VexGuestExtents* vge,
+                      const VexArchInfo* archinfo_host,
                       IRType gWordTy, IRType hWordTy )
 {
    Int        i, isize;
diff --git a/callgrind/main.c b/callgrind/main.c
index 5562c9e..86a9338 100644
--- a/callgrind/main.c
+++ b/callgrind/main.c
@@ -950,10 +950,10 @@
 
 static
 IRSB* CLG_(instrument)( VgCallbackClosure* closure,
-			IRSB* sbIn,
-			VexGuestLayout* layout,
-			VexGuestExtents* vge,
-                        VexArchInfo* archinfo_host,
+                        IRSB* sbIn,
+			const VexGuestLayout* layout,
+			const VexGuestExtents* vge,
+                        const VexArchInfo* archinfo_host,
 			IRType gWordTy, IRType hWordTy )
 {
    Int        i;
diff --git a/coregrind/m_gdbserver/m_gdbserver.c b/coregrind/m_gdbserver/m_gdbserver.c
index 46bfbed..3ce1860 100644
--- a/coregrind/m_gdbserver/m_gdbserver.c
+++ b/coregrind/m_gdbserver/m_gdbserver.c
@@ -483,7 +483,7 @@
 }
 
 /* Returns the reason for which gdbserver instrumentation is needed */
-static VgVgdb VG_(gdbserver_instrumentation_needed) (VexGuestExtents* vge)
+static VgVgdb VG_(gdbserver_instrumentation_needed) (const VexGuestExtents* vge)
 {
    GS_Address* g;
    int e;
@@ -1088,8 +1088,8 @@
 
 static void VG_(add_stmt_call_invalidate_if_not_gdbserved)
      ( IRSB* sb_in,
-       VexGuestLayout* layout, 
-       VexGuestExtents* vge,
+       const VexGuestLayout* layout, 
+       const VexGuestExtents* vge,
        IRTemp jmp, 
        IRSB* irsb)
 {
@@ -1126,8 +1126,8 @@
    debugger statement will be inserted for all instructions of a block. */
 static void VG_(add_stmt_call_gdbserver) 
      (IRSB* sb_in,                /* block being translated */
-      VexGuestLayout* layout, 
-      VexGuestExtents* vge,
+      const VexGuestLayout* layout, 
+      const VexGuestExtents* vge,
       IRType gWordTy, IRType hWordTy,
       Addr  iaddr,                /* Addr of instruction being instrumented */
       UChar delta,                /* delta to add to iaddr to obtain IP */
@@ -1201,8 +1201,8 @@
    or VG_(add_stmt_call_invalidate_if_not_gdbserved).  */
 static void VG_(add_stmt_call_invalidate_exit_target_if_not_gdbserved)
    (IRSB* sb_in,
-    VexGuestLayout* layout,
-    VexGuestExtents* vge,
+    const VexGuestLayout* layout,
+    const VexGuestExtents* vge,
     IRType gWordTy,
     IRSB* irsb)
 {
@@ -1220,8 +1220,8 @@
 
 IRSB* VG_(instrument_for_gdbserver_if_needed)
      (IRSB* sb_in,
-      VexGuestLayout* layout,
-      VexGuestExtents* vge,
+      const VexGuestLayout* layout,
+      const VexGuestExtents* vge,
       IRType gWordTy, IRType hWordTy)
 {
    IRSB* sb_out;
diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c
index d95462d..4b1c96e 100644
--- a/coregrind/m_tooliface.c
+++ b/coregrind/m_tooliface.c
@@ -41,8 +41,8 @@
 void VG_(basic_tool_funcs)(
    void(*post_clo_init)(void),
    IRSB*(*instrument)(VgCallbackClosure*, IRSB*, 
-                      VexGuestLayout*, VexGuestExtents*, VexArchInfo*,
-                      IRType, IRType),
+                      const VexGuestLayout*, const VexGuestExtents*,
+                      const VexArchInfo*, IRType, IRType),
    void(*fini)(Int)
 )
 {
diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c
index 322c310..72311bc 100644
--- a/coregrind/m_translate.c
+++ b/coregrind/m_translate.c
@@ -59,7 +59,7 @@
 
 #include "pub_core_execontext.h"  // VG_(make_depth_1_ExeContext_from_Addr)
 
-#include "pub_core_gdbserver.h"   // VG_(tool_instrument_then_gdbserver_if_needed)
+#include "pub_core_gdbserver.h"   // VG_(instrument_for_gdbserver_if_needed)
 
 #include "libvex_emnote.h"        // For PPC, EmWarn_PPC64_redir_underflow
 
@@ -219,10 +219,10 @@
 */
 static
 IRSB* tool_instrument_then_gdbserver_if_needed ( VgCallbackClosure* closureV,
-                                                 IRSB*              sb_in, 
-                                                 VexGuestLayout*    layout, 
-                                                 VexGuestExtents*   vge,
-                                                 VexArchInfo*       vai,
+                                                 IRSB*              sb_in,
+                                                 const VexGuestLayout*  layout,
+                                                 const VexGuestExtents* vge,
+                                                 const VexArchInfo*     vai,
                                                  IRType             gWordTy, 
                                                  IRType             hWordTy )
 {
@@ -261,9 +261,9 @@
 static
 IRSB* vg_SP_update_pass ( void*             closureV,
                           IRSB*             sb_in, 
-                          VexGuestLayout*   layout, 
-                          VexGuestExtents*  vge,
-                          VexArchInfo*      vai,
+                          const VexGuestLayout*   layout, 
+                          const VexGuestExtents*  vge,
+                          const VexArchInfo*      vai,
                           IRType            gWordTy, 
                           IRType            hWordTy )
 {
@@ -776,7 +776,7 @@
    return convention. */
 
 static UInt needs_self_check ( void* closureV,
-                               VexGuestExtents* vge )
+                               const VexGuestExtents* vge )
 {
    VgCallbackClosure* closure = (VgCallbackClosure*)closureV;
    UInt i, bitset;
@@ -1622,16 +1622,16 @@
         They are entirely legal but longwinded so as to maximise the
         chance of the C typechecker picking up any type snafus. */
      IRSB*(*f)(VgCallbackClosure*,
-               IRSB*,VexGuestLayout*,VexGuestExtents*, VexArchInfo*,
-               IRType,IRType)
+               IRSB*,const VexGuestLayout*,const VexGuestExtents*,
+               const VexArchInfo*,IRType,IRType)
         = VG_(clo_vgdb) != Vg_VgdbNo
              ? tool_instrument_then_gdbserver_if_needed
              : VG_(tdict).tool_instrument;
      IRSB*(*g)(void*,
-               IRSB*,VexGuestLayout*,VexGuestExtents*,VexArchInfo*,
-               IRType,IRType)
-       = (IRSB*(*)(void*,IRSB*,VexGuestLayout*,VexGuestExtents*,
-                   VexArchInfo*,IRType,IRType))f;
+               IRSB*,const VexGuestLayout*,const VexGuestExtents*,
+               const VexArchInfo*,IRType,IRType)
+       = (IRSB*(*)(void*,IRSB*,const VexGuestLayout*,
+                   const VexGuestExtents*, const VexArchInfo*,IRType,IRType))f;
      vta.instrument1     = g;
    }
    /* No need for type kludgery here. */
diff --git a/coregrind/pub_core_gdbserver.h b/coregrind/pub_core_gdbserver.h
index de5b5da..5dd2d84 100644
--- a/coregrind/pub_core_gdbserver.h
+++ b/coregrind/pub_core_gdbserver.h
@@ -150,8 +150,8 @@
    gdbserver. */
 extern IRSB* VG_(instrument_for_gdbserver_if_needed)
      (IRSB* sb_in,                   /* block to be instrumented */
-      VexGuestLayout* layout,
-      VexGuestExtents* vge,
+      const VexGuestLayout* layout,
+      const VexGuestExtents* vge,
       IRType gWordTy, IRType hWordTy);
 
 /* reason for which gdbserver connection must be finished */
diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h
index e9d3631..65311d8 100644
--- a/coregrind/pub_core_tooliface.h
+++ b/coregrind/pub_core_tooliface.h
@@ -110,8 +110,8 @@
    void  (*tool_post_clo_init)(void);
    IRSB* (*tool_instrument)   (VgCallbackClosure*,
                                IRSB*, 
-                               VexGuestLayout*, VexGuestExtents*, 
-                               VexArchInfo*, IRType, IRType);
+                               const VexGuestLayout*, const VexGuestExtents*, 
+                               const VexArchInfo*, IRType, IRType);
    void  (*tool_fini)         (Int);
 
    // VG_(needs).core_errors
diff --git a/drd/drd_load_store.c b/drd/drd_load_store.c
index afb88e1..a7928d5 100644
--- a/drd/drd_load_store.c
+++ b/drd/drd_load_store.c
@@ -590,9 +590,9 @@
 
 IRSB* DRD_(instrument)(VgCallbackClosure* const closure,
                        IRSB* const bb_in,
-                       VexGuestLayout* const layout,
-                       VexGuestExtents* const vge,
-                       VexArchInfo* archinfo_host,
+                       const VexGuestLayout* const layout,
+                       const VexGuestExtents* const vge,
+                       const VexArchInfo* archinfo_host,
                        IRType const gWordTy,
                        IRType const hWordTy)
 {
diff --git a/drd/drd_load_store.h b/drd/drd_load_store.h
index 532a38c..ec8b4a5 100644
--- a/drd/drd_load_store.h
+++ b/drd/drd_load_store.h
@@ -41,9 +41,9 @@
 void DRD_(set_first_race_only)(const Bool fro);
 IRSB* DRD_(instrument)(VgCallbackClosure* const closure,
                        IRSB* const bb_in,
-                       VexGuestLayout* const layout,
-                       VexGuestExtents* const vge,
-                       VexArchInfo* const archinfo_host,
+                       const VexGuestLayout* const layout,
+                       const VexGuestExtents* const vge,
+                       const VexArchInfo* const archinfo_host,
                        IRType const gWordTy,
                        IRType const hWordTy);
 void DRD_(trace_mem_access)(const Addr addr, const SizeT size,
diff --git a/exp-bbv/bbv_main.c b/exp-bbv/bbv_main.c
index b133efa..8926af4 100644
--- a/exp-bbv/bbv_main.c
+++ b/exp-bbv/bbv_main.c
@@ -345,10 +345,10 @@
    /*    gWordTy = size of guest word    */
    /*    hWordTy = size of host word     */
 static IRSB* bbv_instrument ( VgCallbackClosure* closure,
-                             IRSB* sbIn, VexGuestLayout* layout,
-                             VexGuestExtents* vge,
-                             VexArchInfo* archinfo_host,
-                             IRType gWordTy, IRType hWordTy )
+                              IRSB* sbIn, const VexGuestLayout* layout,
+                              const VexGuestExtents* vge,
+                              const VexArchInfo* archinfo_host,
+                              IRType gWordTy, IRType hWordTy )
 {
    Int      i,n_instrs=1;
    IRSB     *sbOut;
diff --git a/exp-dhat/dh_main.c b/exp-dhat/dh_main.c
index e18b395..78465ee 100644
--- a/exp-dhat/dh_main.c
+++ b/exp-dhat/dh_main.c
@@ -872,9 +872,9 @@
 static
 IRSB* dh_instrument ( VgCallbackClosure* closure,
                       IRSB* sbIn,
-                      VexGuestLayout* layout,
-                      VexGuestExtents* vge,
-                      VexArchInfo* archinfo_host,
+                      const VexGuestLayout* layout,
+                      const VexGuestExtents* vge,
+                      const VexArchInfo* archinfo_host,
                       IRType gWordTy, IRType hWordTy )
 {
    Int   i, n = 0;
diff --git a/exp-sgcheck/h_main.c b/exp-sgcheck/h_main.c
index ea0fed8..ed1ac1d 100644
--- a/exp-sgcheck/h_main.c
+++ b/exp-sgcheck/h_main.c
@@ -607,9 +607,9 @@
 
 IRSB* h_instrument ( VgCallbackClosure* closure,
                      IRSB* sbIn,
-                     VexGuestLayout* layout,
-                     VexGuestExtents* vge,
-                     VexArchInfo* archinfo_host,
+                     const VexGuestLayout* layout,
+                     const VexGuestExtents* vge,
+                     const VexArchInfo* archinfo_host,
                      IRType gWordTy, IRType hWordTy )
 {
    Bool  verboze = 0||False;
diff --git a/exp-sgcheck/h_main.h b/exp-sgcheck/h_main.h
index e41cc2e..b52af8c 100644
--- a/exp-sgcheck/h_main.h
+++ b/exp-sgcheck/h_main.h
@@ -70,9 +70,9 @@
 /* Note that this also does the sg_ instrumentation. */
 IRSB* h_instrument ( VgCallbackClosure* closure,
                      IRSB* sbIn,
-                     VexGuestLayout* layout,
-                     VexGuestExtents* vge,
-                     VexArchInfo* archinfo_host,
+                     const VexGuestLayout* layout,
+                     const VexGuestExtents* vge,
+                     const VexArchInfo* archinfo_host,
                      IRType gWordTy, IRType hWordTy );
 
 #endif
diff --git a/exp-sgcheck/sg_main.c b/exp-sgcheck/sg_main.c
index c9037b0..30743e6 100644
--- a/exp-sgcheck/sg_main.c
+++ b/exp-sgcheck/sg_main.c
@@ -2079,7 +2079,7 @@
 
 static IRTemp gen_Get_SP ( struct _SGEnv*  sge,
                            IRSB*           bbOut,
-                           VexGuestLayout* layout,
+                           const VexGuestLayout* layout,
                            Int             hWordTy_szB )
 {
    IRExpr* sp_expr;
@@ -2097,7 +2097,7 @@
 
 static IRTemp gen_Get_FP ( struct _SGEnv*  sge,
                            IRSB*           bbOut,
-                           VexGuestLayout* layout,
+                           const VexGuestLayout* layout,
                            Int             hWordTy_szB )
 {
    IRExpr* fp_expr;
@@ -2120,7 +2120,7 @@
                                     Bool    isStore,
                                     Int     hWordTy_szB,
                                     Addr    curr_IP,
-                                    VexGuestLayout* layout )
+                                    const VexGuestLayout* layout )
 {
    IRType  tyAddr      = Ity_INVALID;
    XArray* frameBlocks = NULL;
@@ -2198,7 +2198,7 @@
 void sg_instrument_IRStmt ( /*MOD*/struct _SGEnv * env, 
                             /*MOD*/IRSB* sbOut,
                             IRStmt* st,
-                            VexGuestLayout* layout,
+                            const VexGuestLayout* layout,
                             IRType gWordTy, IRType hWordTy )
 {
    if (!sg_clo_enable_sg_checks)
@@ -2333,7 +2333,7 @@
                                 /*MOD*/IRSB* sbOut,
                                 IRExpr* next,
                                 IRJumpKind jumpkind,
-                                VexGuestLayout* layout,
+                                const VexGuestLayout* layout,
                                 IRType gWordTy, IRType hWordTy )
 {
    if (!sg_clo_enable_sg_checks)
diff --git a/exp-sgcheck/sg_main.h b/exp-sgcheck/sg_main.h
index 36034de..007c63b 100644
--- a/exp-sgcheck/sg_main.h
+++ b/exp-sgcheck/sg_main.h
@@ -62,14 +62,14 @@
 void sg_instrument_IRStmt ( /*MOD*/struct _SGEnv * env, 
                             /*MOD*/IRSB* sbOut,
                             IRStmt* st,
-                            VexGuestLayout* layout,
+                            const VexGuestLayout* layout,
                             IRType gWordTy, IRType hWordTy );
 
 void sg_instrument_final_jump ( /*MOD*/struct _SGEnv * env, 
                                 /*MOD*/IRSB* sbOut,
                                 IRExpr* next,
                                 IRJumpKind jumpkind,
-                                VexGuestLayout* layout,
+                                const VexGuestLayout* layout,
                                 IRType gWordTy, IRType hWordTy );
 #endif
 
diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c
index 673e413..d346fb9 100644
--- a/helgrind/hg_main.c
+++ b/helgrind/hg_main.c
@@ -4478,9 +4478,9 @@
 static
 IRSB* hg_instrument ( VgCallbackClosure* closure,
                       IRSB* bbIn,
-                      VexGuestLayout* layout,
-                      VexGuestExtents* vge,
-                      VexArchInfo* archinfo_host,
+                      const VexGuestLayout* layout,
+                      const VexGuestExtents* vge,
+                      const VexArchInfo* archinfo_host,
                       IRType gWordTy, IRType hWordTy )
 {
    Int     i;
diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h
index 434f5e2..4349c1b 100644
--- a/include/pub_tool_tooliface.h
+++ b/include/pub_tool_tooliface.h
@@ -218,9 +218,9 @@
    */
    IRSB*(*instrument)(VgCallbackClosure* closure, 
                       IRSB*              sb_in, 
-                      VexGuestLayout*    layout, 
-                      VexGuestExtents*   vge, 
-                      VexArchInfo*       archinfo_host,
+                      const VexGuestLayout*  layout, 
+                      const VexGuestExtents* vge, 
+                      const VexArchInfo*     archinfo_host,
                       IRType             gWordTy, 
                       IRType             hWordTy),
 
diff --git a/lackey/lk_main.c b/lackey/lk_main.c
index bfa2fd8..f76998f 100644
--- a/lackey/lk_main.c
+++ b/lackey/lk_main.c
@@ -652,9 +652,9 @@
 static
 IRSB* lk_instrument ( VgCallbackClosure* closure,
                       IRSB* sbIn, 
-                      VexGuestLayout* layout, 
-                      VexGuestExtents* vge,
-                      VexArchInfo* archinfo_host,
+                      const VexGuestLayout* layout, 
+                      const VexGuestExtents* vge,
+                      const VexArchInfo* archinfo_host,
                       IRType gWordTy, IRType hWordTy )
 {
    IRDirty*   di;
diff --git a/massif/ms_main.c b/massif/ms_main.c
index 9f33546..7d78b5f 100644
--- a/massif/ms_main.c
+++ b/massif/ms_main.c
@@ -2087,9 +2087,9 @@
 static
 IRSB* ms_instrument ( VgCallbackClosure* closure,
                       IRSB* sbIn,
-                      VexGuestLayout* layout,
-                      VexGuestExtents* vge,
-                      VexArchInfo* archinfo_host,
+                      const VexGuestLayout* layout,
+                      const VexGuestExtents* vge,
+                      const VexArchInfo* archinfo_host,
                       IRType gWordTy, IRType hWordTy )
 {
    if (! have_started_executing_code) {
diff --git a/memcheck/mc_include.h b/memcheck/mc_include.h
index 258d3c6..39e0382 100644
--- a/memcheck/mc_include.h
+++ b/memcheck/mc_include.h
@@ -657,9 +657,9 @@
 /* Functions defined in mc_translate.c */
 IRSB* MC_(instrument) ( VgCallbackClosure* closure,
                         IRSB* bb_in, 
-                        VexGuestLayout* layout, 
-                        VexGuestExtents* vge,
-                        VexArchInfo* archinfo_host,
+                        const VexGuestLayout* layout, 
+                        const VexGuestExtents* vge,
+                        const VexArchInfo* archinfo_host,
                         IRType gWordTy, IRType hWordTy );
 
 IRSB* MC_(final_tidy) ( IRSB* );
diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c
index 5efa5ad..1f7402d 100644
--- a/memcheck/mc_translate.c
+++ b/memcheck/mc_translate.c
@@ -210,7 +210,7 @@
 
       /* READONLY: the guest layout.  This indicates which parts of
          the guest state should be regarded as 'always defined'. */
-      VexGuestLayout* layout;
+      const VexGuestLayout* layout;
 
       /* READONLY: the host word type.  Needed for constructing
          arguments of type 'HWord' to be passed to helper functions.
@@ -6197,9 +6197,9 @@
 
 IRSB* MC_(instrument) ( VgCallbackClosure* closure,
                         IRSB* sb_in, 
-                        VexGuestLayout* layout, 
-                        VexGuestExtents* vge,
-                        VexArchInfo* archinfo_host,
+                        const VexGuestLayout* layout, 
+                        const VexGuestExtents* vge,
+                        const VexArchInfo* archinfo_host,
                         IRType gWordTy, IRType hWordTy )
 {
    Bool    verboze = 0||False;
diff --git a/none/nl_main.c b/none/nl_main.c
index c56b9b3..574486a 100644
--- a/none/nl_main.c
+++ b/none/nl_main.c
@@ -38,9 +38,9 @@
 static
 IRSB* nl_instrument ( VgCallbackClosure* closure,
                       IRSB* bb,
-                      VexGuestLayout* layout, 
-                      VexGuestExtents* vge,
-                      VexArchInfo* archinfo_host,
+                      const VexGuestLayout* layout, 
+                      const VexGuestExtents* vge,
+                      const VexArchInfo* archinfo_host,
                       IRType gWordTy, IRType hWordTy )
 {
     return bb;