]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Constify coregrind.
authorFlorian Krohm <florian@eich-krohm.de>
Wed, 22 Oct 2014 22:25:30 +0000 (22:25 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Wed, 22 Oct 2014 22:25:30 +0000 (22:25 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14656

39 files changed:
coregrind/m_addrinfo.c
coregrind/m_debugger.c
coregrind/m_debuginfo/d3basics.c
coregrind/m_debuginfo/debuginfo.c
coregrind/m_debuginfo/image.c
coregrind/m_debuginfo/misc.c
coregrind/m_debuginfo/priv_d3basics.h
coregrind/m_debuginfo/priv_image.h
coregrind/m_debuginfo/priv_misc.h
coregrind/m_debuginfo/priv_readelf.h
coregrind/m_debuginfo/priv_readpdb.h
coregrind/m_debuginfo/priv_storage.h
coregrind/m_debuginfo/priv_tytypes.h
coregrind/m_debuginfo/readdwarf.c
coregrind/m_debuginfo/readdwarf3.c
coregrind/m_debuginfo/readelf.c
coregrind/m_debuginfo/readpdb.c
coregrind/m_debuginfo/storage.c
coregrind/m_debuginfo/tytypes.c
coregrind/m_errormgr.c
coregrind/m_execontext.c
coregrind/m_libcassert.c
coregrind/m_options.c
coregrind/m_rangemap.c
coregrind/m_redir.c
coregrind/m_sbprofile.c
coregrind/m_stacktrace.c
coregrind/m_syswrap/syswrap-generic.c
coregrind/m_transtab.c
coregrind/pub_core_debuginfo.h
coregrind/pub_core_libcassert.h
coregrind/pub_core_libcfile.h
coregrind/pub_core_options.h
coregrind/pub_core_redir.h
coregrind/pub_core_stacktrace.h
coregrind/pub_core_transtab.h
include/pub_tool_addrinfo.h
include/pub_tool_execontext.h
include/pub_tool_rangemap.h

index 582b960dcc1c70be3522bb6e7923b8cc156c6e34..95ec0fe608bbda99b4ab73dbb9f1be0534c07fbe 100644 (file)
@@ -349,7 +349,8 @@ static UInt tnr_else_tid (ThreadInfo tinfo)
       return tinfo.tid;
 }
 
-static void pp_addrinfo_WRK ( Addr a, AddrInfo* ai, Bool mc, Bool maybe_gcc )
+static void pp_addrinfo_WRK ( Addr a, const AddrInfo* ai, Bool mc,
+                              Bool maybe_gcc )
 {
    const HChar* xpre  = VG_(clo_xml) ? "  <auxwhat>" : " ";
    const HChar* xpost = VG_(clo_xml) ? "</auxwhat>"  : "";
@@ -560,12 +561,12 @@ static void pp_addrinfo_WRK ( Addr a, AddrInfo* ai, Bool mc, Bool maybe_gcc )
    }
 }
 
-void VG_(pp_addrinfo) ( Addr a, AddrInfo* ai )
+void VG_(pp_addrinfo) ( Addr a, const AddrInfo* ai )
 {
    pp_addrinfo_WRK (a, ai, False /*mc*/, False /*maybe_gcc*/);
 }
 
-void VG_(pp_addrinfo_mc) ( Addr a, AddrInfo* ai, Bool maybe_gcc )
+void VG_(pp_addrinfo_mc) ( Addr a, const AddrInfo* ai, Bool maybe_gcc )
 {
    pp_addrinfo_WRK (a, ai, True /*mc*/, maybe_gcc);
 }
index 4af8f18b1fed9cbdd0a1bff9b25e1e487a77408f..45f4243ec70ade82ab5d05436f086f16debe058b 100644 (file)
@@ -47,7 +47,7 @@
 #define WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
 #define WSTOPSIG(status) (((status) & 0xff00) >> 8)
 
-static Int ptrace_setregs(Int pid, VexGuestArchState* vex)
+static Int ptrace_setregs(Int pid, const VexGuestArchState* vex)
 {
 #if defined(VGP_x86_linux)
    struct vki_user_regs_struct regs;
index 3e132419f2751c80ef3047295ebd2c02e1034c40..d3f6735ed19bd846d8323aac82f44b320a703b8b 100644 (file)
@@ -343,7 +343,7 @@ const HChar* ML_(pp_DW_AT) ( DW_AT attr )
 
 /* FIXME: duplicated in readdwarf.c */
 static 
-ULong read_leb128 ( UChar* data, Int* length_return, Int sign )
+ULong read_leb128 ( const UChar* data, Int* length_return, Int sign )
 {
   ULong  result = 0;
   UInt   num_read = 0;
@@ -397,7 +397,7 @@ static Long read_leb128S( UChar **data )
 
 /* FIXME: duplicates logic in readdwarf.c: copy_convert_CfiExpr_tree
    and {FP,SP}_REG decls */
-static Bool get_Dwarf_Reg( /*OUT*/Addr* a, Word regno, RegSummary* regs )
+static Bool get_Dwarf_Reg( /*OUT*/Addr* a, Word regno, const RegSummary* regs )
 {
    vg_assert(regs);
 #  if defined(VGP_x86_linux) || defined(VGP_x86_darwin)
@@ -474,7 +474,7 @@ static Bool bias_address( Addr* a, const DebugInfo* di )
 /* Evaluate a standard DWARF3 expression.  See detailed description in
    priv_d3basics.h.  Doesn't handle DW_OP_piece/DW_OP_bit_piece yet.  */
 GXResult ML_(evaluate_Dwarf3_Expr) ( UChar* expr, UWord exprszB, 
-                                     GExpr* fbGX, RegSummary* regs,
+                                     GExpr* fbGX, const RegSummary* regs,
                                      const DebugInfo* di,
                                      Bool push_initial_zero )
 {
@@ -943,7 +943,7 @@ GXResult ML_(evaluate_Dwarf3_Expr) ( UChar* expr, UWord exprszB,
 /* Evaluate a so-called Guarded (DWARF3) expression.  See detailed
    description in priv_d3basics.h. */
 GXResult ML_(evaluate_GX)( GExpr* gx, GExpr* fbGX,
-                           RegSummary* regs, const DebugInfo* di )
+                           const RegSummary* regs, const DebugInfo* di )
 {
    GXResult res;
    Addr     aMin, aMax;
@@ -1191,11 +1191,12 @@ void ML_(pp_GXResult) ( GXResult res )
 }
 
 
-void ML_(pp_GX) ( GExpr* gx ) {
+void ML_(pp_GX) ( const GExpr* gx )
+{
    Addr   aMin, aMax;
    UChar  uc;
    UShort nbytes;
-   UChar* p = &gx->payload[0];
+   const UChar* p = &gx->payload[0];
    uc = *p++;
    VG_(printf)("GX(%s){", uc == 0 ? "final" : "Breqd" );
    vg_assert(uc == 0 || uc == 1);
index 8485f19efeeba96e387238ef0205f58c6492a431..3d61d570a3594842e6fbcbae02e5bfe67a8a3db8 100644 (file)
@@ -187,7 +187,7 @@ DebugInfo* alloc_DebugInfo( const HChar* filename )
    di->fsm.filename = ML_(dinfo_strdup)("di.debuginfo.aDI.2", filename);
    di->fsm.maps     = VG_(newXA)(
                          ML_(dinfo_zalloc), "di.debuginfo.aDI.3",
-                         ML_(dinfo_free), sizeof(struct _DebugInfoMapping));
+                         ML_(dinfo_free), sizeof(DebugInfoMapping));
 
    /* Everything else -- pointers, sizes, arrays -- is zeroed by
       ML_(dinfo_zalloc).  Now set up the debugging-output flags. */
@@ -402,15 +402,15 @@ static Bool ranges_overlap (Addr s1, SizeT len1, Addr s2, SizeT len2 )
 
 
 /* Do the basic mappings of the two DebugInfos overlap in any way? */
-static Bool do_DebugInfos_overlap ( DebugInfo* di1, DebugInfo* di2 )
+static Bool do_DebugInfos_overlap ( const DebugInfo* di1, const DebugInfo* di2 )
 {
    Word i, j;
    vg_assert(di1);
    vg_assert(di2);
    for (i = 0; i < VG_(sizeXA)(di1->fsm.maps); i++) {
-      struct _DebugInfoMapping* map1 = VG_(indexXA)(di1->fsm.maps, i);
+      const DebugInfoMapping* map1 = VG_(indexXA)(di1->fsm.maps, i);
       for (j = 0; j < VG_(sizeXA)(di2->fsm.maps); j++) {
-         struct _DebugInfoMapping* map2 = VG_(indexXA)(di2->fsm.maps, j);
+         const DebugInfoMapping* map2 = VG_(indexXA)(di2->fsm.maps, j);
          if (ranges_overlap(map1->avma, map1->size, map2->avma, map2->size))
             return True;
       }
@@ -467,7 +467,7 @@ static void discard_DebugInfos_which_overlap_with ( DebugInfo* diRef )
 /* Find the existing DebugInfo for |filename| or if not found, create
    one.  In the latter case |filename| is strdup'd into VG_AR_DINFO,
    and the new DebugInfo is added to debugInfo_list. */
-static DebugInfo* find_or_create_DebugInfo_for ( HChar* filename )
+static DebugInfo* find_or_create_DebugInfo_for ( const HChar* filename )
 {
    DebugInfo* di;
    vg_assert(filename);
@@ -490,7 +490,7 @@ static DebugInfo* find_or_create_DebugInfo_for ( HChar* filename )
    Check that the invariants stated in
    "Comment_on_IMPORTANT_CFSI_REPRESENTATIONAL_INVARIANTS" in
    priv_storage.h are observed. */
-static void check_CFSI_related_invariants ( DebugInfo* di )
+static void check_CFSI_related_invariants ( const DebugInfo* di )
 {
    DebugInfo* di2 = NULL;
    Bool has_nonempty_rx = False;
@@ -503,7 +503,7 @@ static void check_CFSI_related_invariants ( DebugInfo* di )
    vg_assert(di->fsm.have_rx_map);
    vg_assert(di->fsm.have_rw_map);
    for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) {
-      struct _DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
+      const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
       /* We are interested in r-x mappings only */
       if (!map->rx)
          continue;
@@ -522,7 +522,7 @@ static void check_CFSI_related_invariants ( DebugInfo* di )
          if (di2 == di)
             continue;
          for (j = 0; j < VG_(sizeXA)(di2->fsm.maps); j++) {
-            struct _DebugInfoMapping* map2 = VG_(indexXA)(di2->fsm.maps, j);
+            const DebugInfoMapping* map2 = VG_(indexXA)(di2->fsm.maps, j);
             if (!map2->rx || map2->size == 0)
                continue;
             vg_assert(!ranges_overlap(map->avma,  map->size,
@@ -601,8 +601,8 @@ void VG_(di_initialise) ( void )
 #if defined(VGO_linux)  ||  defined(VGO_darwin)
 
 /* Helper (indirect) for di_notify_ACHIEVE_ACCEPT_STATE */
-static Bool overlaps_DebugInfoMappings ( struct _DebugInfoMapping* map1,
-                                         struct _DebugInfoMapping* map2 )
+static Bool overlaps_DebugInfoMappings ( const DebugInfoMapping* map1,
+                                         const DebugInfoMapping* map2 )
 {
    vg_assert(map1 && map2 && map1 != map2);
    vg_assert(map1->size != 0 && map2->size != 0);
@@ -614,15 +614,14 @@ static Bool overlaps_DebugInfoMappings ( struct _DebugInfoMapping* map1,
 
 /* Helper (indirect) for di_notify_ACHIEVE_ACCEPT_STATE */
 static void show_DebugInfoMappings 
-               ( struct _DebugInfo* di,
-                 /*MOD*/XArray* maps /* XArray<struct _DebugInfoMapping> */ )
+               ( const DebugInfo* di,
+                 /*MOD*/XArray* maps /* XArray<DebugInfoMapping> */ )
 {
    Word i, n;
    vg_assert(maps);
    n = VG_(sizeXA)(maps);
    for (i = 0; i < n; i++) {
-      struct _DebugInfoMapping* map
-         = (struct _DebugInfoMapping*) VG_(indexXA)(maps, i);
+      const DebugInfoMapping* map = VG_(indexXA)(maps, i);
       TRACE_SYMTAB("  [%ld]    avma 0x%-16llx    size %-8lu    "
                    "foff %-8lld    %s %s %s\n",
                    i, (ULong)map->avma, map->size, (Long)map->foff,
@@ -640,26 +639,26 @@ static void show_DebugInfoMappings
    function returns (rather than asserts) that |maps| is overlap
    free. */
 static void truncate_DebugInfoMapping_overlaps
-               ( struct _DebugInfo* di,
-                 /*MOD*/XArray* maps /* XArray<struct _DebugInfoMapping> */ )
+               ( const DebugInfo* di,
+                 /*MOD*/XArray* maps /* XArray<DebugInfoMapping> */ )
 {
    TRACE_SYMTAB("Un-de-overlapped _DebugInfoMappings:\n");
    show_DebugInfoMappings(di, maps);
    TRACE_SYMTAB("\n");
 
    Word i, j, n;
-   struct _DebugInfoMapping *map_i, *map_j;
+   DebugInfoMapping *map_i, *map_j;
 
    n = VG_(sizeXA)(maps);
    for (i = 0; i < n; i++) {
 
-      map_i = (struct _DebugInfoMapping*) VG_(indexXA)(maps, i);
+      map_i = VG_(indexXA)(maps, i);
       if (map_i->size == 0)
         continue; // Hmm, mutancy.  Shouldn't happen.
 
       for (j = i+1; j < n; j++) {
 
-         map_j = (struct _DebugInfoMapping*) VG_(indexXA)(maps, j);
+         map_j = VG_(indexXA)(maps, j);
          if (map_j->size == 0)
            continue; // Hmm, mutancy.  Shouldn't happen.
 
@@ -679,17 +678,17 @@ static void truncate_DebugInfoMapping_overlaps
       }
    }
 
-   TRACE_SYMTAB("De-overlapped _DebugInfoMappings:\n");
+   TRACE_SYMTAB("De-overlapped DebugInfoMappings:\n");
    show_DebugInfoMappings(di, maps);
    TRACE_SYMTAB("\n");
    TRACE_SYMTAB("Checking that there are no remaining overlaps.\n");
 
    for (i = 0; i < n; i++) {
-      map_i = (struct _DebugInfoMapping*) VG_(indexXA)(maps, i);
+      map_i = VG_(indexXA)(maps, i);
       if (map_i->size == 0)
         continue;
       for (j = i+1; j < n; j++) {
-         map_j = (struct _DebugInfoMapping*) VG_(indexXA)(maps, j);
+         map_j = VG_(indexXA)(maps, j);
          if (map_j->size == 0)
            continue;
          Bool overlap
@@ -1035,7 +1034,7 @@ ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV, Int use_fd )
                   "noting details in DebugInfo* at %p\n", di);
 
    /* Note the details about the mapping. */
-   struct _DebugInfoMapping map;
+   DebugInfoMapping map;
    map.avma = a;
    map.size = seg->end + 1 - seg->start;
    map.foff = seg->offset;
@@ -1134,7 +1133,7 @@ void VG_(di_notify_vm_protect)( Addr a, SizeT len, UInt prot )
    if (debug)
       VG_(printf)("di_notify_vm_protect-3: looking for existing DebugInfo*\n");
    DebugInfo* di;
-   struct _DebugInfoMapping *map = NULL;
+   DebugInfoMapping *map = NULL;
    Word i;
    for (di = debugInfo_list; di; di = di->next) {
       vg_assert(di->fsm.filename);
@@ -1148,7 +1147,7 @@ void VG_(di_notify_vm_protect)( Addr a, SizeT len, UInt prot )
          continue; /* need to have a rw- mapping */
       /* Try to find a mapping matching the memory area. */
       for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) {
-         map = (struct _DebugInfoMapping*)VG_(indexXA)(di->fsm.maps, i);
+         map = VG_(indexXA)(di->fsm.maps, i);
          if (map->ro && map->avma == a && map->size == len)
             break;
          map = NULL;
@@ -1174,7 +1173,7 @@ void VG_(di_notify_vm_protect)( Addr a, SizeT len, UInt prot )
    di->fsm.have_ro_map = False;
    /* See if there are any more ro mappings */
    for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) {
-      map = (struct _DebugInfoMapping*)VG_(indexXA)(di->fsm.maps, i);
+      map = VG_(indexXA)(di->fsm.maps, i);
       if (map->ro) {
          di->fsm.have_ro_map = True;
          break;
@@ -1444,8 +1443,7 @@ void VG_(di_discard_ALL_debuginfo)( void )
 }
 
 
-struct _DebugInfoMapping* ML_(find_rx_mapping) ( struct _DebugInfo* di,
-                                                 Addr lo, Addr hi )
+DebugInfoMapping* ML_(find_rx_mapping) ( DebugInfo* di, Addr lo, Addr hi )
 {
    Word i;
    vg_assert(lo <= hi); 
@@ -1457,7 +1455,7 @@ struct _DebugInfoMapping* ML_(find_rx_mapping) ( struct _DebugInfo* di,
       return di->last_rx_map;
 
    for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) {
-      struct _DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
+      DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
       if (   map->rx && map->size > 0
           && lo >= map->avma && hi < map->avma + map->size) {
          di->last_rx_map = map;
@@ -1487,12 +1485,12 @@ struct _InlIPCursor {
                          // level.
 };
 
-static Bool is_top(InlIPCursor *iipc)
+static Bool is_top(const InlIPCursor *iipc)
 {
    return !iipc || iipc->cur_inltab == -1;
 }
 
-static Bool is_bottom(InlIPCursor *iipc)
+static Bool is_bottom(const InlIPCursor *iipc)
 {
    return !iipc || iipc->next_inltab == -1;
 }
@@ -2101,11 +2099,12 @@ Bool VG_(get_filename_linenum) ( Addr a,
    Therefore specify "*" to search all the objects.  On TOC-afflicted
    platforms, a symbol is deemed to be found only if it has a nonzero
    TOC pointer.  */
-Bool VG_(lookup_symbol_SLOW)(const HChar* sopatt, HChar* name, SymAVMAs* avmas)
+Bool VG_(lookup_symbol_SLOW)(const HChar* sopatt, const HChar* name,
+                             SymAVMAs* avmas)
 {
    Bool     require_pToc = False;
    Int      i;
-   DebugInfo* si;
+   const DebugInfo* si;
    Bool     debug = False;
 #  if defined(VG_PLAT_USES_PPCTOC)
    require_pToc = True;
@@ -3178,11 +3177,11 @@ static Bool data_address_is_in_var ( /*OUT*/PtrdiffT* offset,
 static void format_message ( /*MOD*/XArray* /* of HChar */ dn1,
                              /*MOD*/XArray* /* of HChar */ dn2,
                              Addr     data_addr,
-                             DebugInfo* di,
-                             DiVariable* var,
+                             const DebugInfo* di,
+                             const DiVariable* var,
                              PtrdiffT var_offset,
                              PtrdiffT residual_offset,
-                             XArray* /*HChar*/ described,
+                             const XArray* /*HChar*/ described,
                              Int      frameNo, 
                              ThreadId tid )
 {
index a289f441b1208ff4d77ad6a36e6f80f519e4b005..21ebe3005c7516c0d0c7ac4174ea5c0de25368ee 100644 (file)
@@ -104,7 +104,7 @@ static void write_UInt_le ( /*OUT*/UChar* dst, UInt n )
    }
 }
 
-static UInt read_UInt_le ( UChar* src )
+static UInt read_UInt_le ( const UChar* src )
 {
    UInt r = 0;
    Int i;
@@ -124,7 +124,7 @@ static void write_ULong_le ( /*OUT*/UChar* dst, ULong n )
    }
 }
 
-static ULong read_ULong_le ( UChar* src )
+static ULong read_ULong_le ( const UChar* src )
 {
    ULong r = 0;
    Int i;
@@ -168,7 +168,7 @@ static Int my_read ( Int fd, UChar* buf, Int len )
    fd has been set in blocking mode.  If it returns with the number of
    bytes written < len, it means that either fd was closed, or there was
    an error on it. */
-static Int my_write ( Int fd, UChar* buf, Int len )
+static Int my_write ( Int fd, const UChar* buf, Int len )
 {
    Int nWritten = 0;
    while (1) {
@@ -212,7 +212,7 @@ static void give_up__image_overrun(void)
    return the frame it sends back.  Caller owns the resulting frame
    and must free it.  A NULL return means the transaction failed for
    some reason. */
-static Frame* do_transaction ( Int sd, Frame* req )
+static Frame* do_transaction ( Int sd, const Frame* req )
 {
    if (0) VG_(printf)("CLIENT: send %c%c%c%c\n",
                       req->data[0], req->data[1], req->data[2], req->data[3]);
@@ -387,7 +387,7 @@ static DiOffT block_round_down ( DiOffT i )
 }
 
 /* Is this offset inside this CEnt? */
-static inline Bool is_in_CEnt ( CEnt* cent, DiOffT off )
+static inline Bool is_in_CEnt ( const CEnt* cent, DiOffT off )
 {
    /* This assertion is checked by set_CEnt, so checking it here has
       no benefit, whereas skipping it does remove it from the hottest
@@ -766,13 +766,13 @@ void ML_(img_done)(DiImage* img)
    ML_(dinfo_free)(img);
 }
 
-DiOffT ML_(img_size)(DiImage* img)
+DiOffT ML_(img_size)(const DiImage* img)
 {
    vg_assert(img);
    return img->size;
 }
 
-inline Bool ML_(img_valid)(DiImage* img, DiOffT offset, SizeT size)
+inline Bool ML_(img_valid)(const DiImage* img, DiOffT offset, SizeT size)
 {
    vg_assert(img);
    vg_assert(offset != DiOffT_INVALID);
@@ -784,7 +784,7 @@ inline Bool ML_(img_valid)(DiImage* img, DiOffT offset, SizeT size)
    image, which normally means the image is corrupted somehow, or the
    caller is buggy.  Recovering is too complex, and we have
    probably-corrupt debuginfo, so just give up. */
-static void ensure_valid(DiImage* img, DiOffT offset, SizeT size,
+static void ensure_valid(const DiImage* img, DiOffT offset, SizeT size,
                          const HChar* caller)
 {
    if (LIKELY(ML_(img_valid)(img, offset, size)))
index 271fd0103d62bee6e31b2945cc9184ad36d76c5c..25ea58ea8d1b19b916741f5a325186a36bc15faf 100644 (file)
@@ -62,7 +62,7 @@ HChar* ML_(dinfo_strdup) ( const HChar* cc, const HChar* str ) {
    return VG_(arena_strdup)( VG_AR_DINFO, cc, str );
 }
 
-void* ML_(dinfo_memdup) ( const HChar* cc, void* str, SizeT nStr ) {
+void* ML_(dinfo_memdup) ( const HChar* cc, const void* str, SizeT nStr ) {
    void* dst = VG_(arena_malloc)( VG_AR_DINFO, cc, nStr );
    VG_(memcpy)(dst, str, nStr);
    return dst;
@@ -74,7 +74,7 @@ static inline Bool host_is_little_endian ( void ) {
    return toBool(*p == 0x10);
 }
 
-Short ML_(read_Short)( UChar* data ) {
+Short ML_(read_Short)( const UChar* data ) {
    Short r = 0;
    if (host_is_little_endian()) {
       r = data[0]
@@ -86,7 +86,7 @@ Short ML_(read_Short)( UChar* data ) {
    return r;
 }
 
-Int ML_(read_Int) ( UChar* data ) {
+Int ML_(read_Int) ( const UChar* data ) {
    Int r = 0;
    if (host_is_little_endian()) {
       r = data[0]
@@ -102,7 +102,7 @@ Int ML_(read_Int) ( UChar* data ) {
    return r;
 }
 
-Long ML_(read_Long) ( UChar* data ) {
+Long ML_(read_Long) ( const UChar* data ) {
    Long r = 0;
    if (host_is_little_endian()) {
       r = data[0]
@@ -126,7 +126,7 @@ Long ML_(read_Long) ( UChar* data ) {
    return r;
 }
 
-UShort ML_(read_UShort) ( UChar* data ) {
+UShort ML_(read_UShort) ( const UChar* data ) {
    UInt r = 0;
    if (host_is_little_endian()) {
       r = data[0]
@@ -149,7 +149,7 @@ UChar *ML_(write_UShort) ( UChar* ptr, UShort val ) {
    return ptr + sizeof(UShort);
 }
 
-UWord ML_(read_UWord) ( UChar* data ) {
+UWord ML_(read_UWord) ( const UChar* data ) {
    if (sizeof(UWord) == sizeof(UInt)) {
       return ML_(read_UInt)(data);
    } else if  (sizeof(UWord) == sizeof(ULong)) {
@@ -159,7 +159,7 @@ UWord ML_(read_UWord) ( UChar* data ) {
    }
 }
 
-UInt ML_(read_UInt) ( UChar* data ) {
+UInt ML_(read_UInt) ( const UChar* data ) {
    UInt r = 0;
    if (host_is_little_endian()) {
       r = data[0]
@@ -190,7 +190,7 @@ UChar* ML_(write_UInt) ( UChar* ptr, UInt val ) {
    return ptr + sizeof(UInt);
 }
 
-ULong ML_(read_ULong) ( UChar* data ) {
+ULong ML_(read_ULong) ( const UChar* data ) {
    ULong r = 0;
    if (host_is_little_endian()) {
       r = data[0]
@@ -237,7 +237,7 @@ UChar* ML_(write_ULong) ( UChar* ptr, ULong val ) {
    return ptr + sizeof(ULong);
 }
 
-UChar ML_(read_UChar) ( UChar* data ) {
+UChar ML_(read_UChar) ( const UChar* data ) {
    return data[0];
 }
 
@@ -246,7 +246,7 @@ UChar* ML_(write_UChar) ( UChar* ptr, UChar val ) {
    return ptr + sizeof(UChar);
 }
 
-Addr ML_(read_Addr) ( UChar* data ) {
+Addr ML_(read_Addr) ( const UChar* data ) {
    if (sizeof(Addr) == sizeof(UInt)) {
       return ML_(read_UInt)(data);
    } else if  (sizeof(Addr) == sizeof(ULong)) {
index b2bf6100c37b4682a25bdfb8982e9321b5b1e5b4..1366b117f51403e8b1c70c816f5be78a053b807f 100644 (file)
@@ -613,7 +613,7 @@ typedef
    GExpr;
 
 /* Show a so-called guarded expression */
-void ML_(pp_GX) ( GExpr* gx );
+void ML_(pp_GX) ( const GExpr* gx );
 
 /* Evaluation of a DWARF3 expression (and hence of a GExpr) may
    require knowing a suitably contextualising set of values for the
@@ -653,7 +653,7 @@ void ML_(pp_GXResult) ( GXResult res );
    NULL but the frame base is still needed, then evaluation of gx as a
    whole will fail. */
 GXResult ML_(evaluate_GX)( GExpr* gx, GExpr* fbGX,
-                           RegSummary* regs, const DebugInfo* di );
+                           const RegSummary* regs, const DebugInfo* di );
 
 /* This is a subsidiary of ML_(evaluate_GX), which just evaluates a
    single standard DWARF3 expression.  Conventions w.r.t regs and fbGX
@@ -663,7 +663,7 @@ GXResult ML_(evaluate_GX)( GExpr* gx, GExpr* fbGX,
    ML_(evaluate_GX) and ML_(evaluate_Dwarf3_Expr) are mutually
    recursive. */
 GXResult ML_(evaluate_Dwarf3_Expr) ( UChar* expr, UWord exprszB, 
-                                     GExpr* fbGX, RegSummary* regs,
+                                     GExpr* fbGX, const RegSummary* regs,
                                      const DebugInfo* di,
                                      Bool push_initial_zero );
 
index 169f3442f438cd0a0986367c35cfd1badadfa62c..083ed784dbe1233a8afa4add5dc96f76369755d1 100644 (file)
@@ -75,10 +75,10 @@ DiImage* ML_(img_from_di_server)(const HChar* filename,
 void ML_(img_done)(DiImage*);
 
 /* How big is the image? */
-DiOffT ML_(img_size)(DiImage* img);
+DiOffT ML_(img_size)(const DiImage* img);
 
 /* Does the section [offset, +size) exist in the image? */
-Bool ML_(img_valid)(DiImage* img, DiOffT offset, SizeT size);
+Bool ML_(img_valid)(const DiImage* img, DiOffT offset, SizeT size);
 
 /* Get info out of an image.  If any part of the section denoted by
    [offset, +size) is invalid, does not return. */
index 4031e177e9ef7a7623071f6eb563fc002599415b..0828290c14e21506bc4fe2f061f7aef967bca0c7 100644 (file)
 void*  ML_(dinfo_zalloc)( const HChar* cc, SizeT szB );
 void   ML_(dinfo_free)( void* v );
 HChar* ML_(dinfo_strdup)( const HChar* cc, const HChar* str );
-void*  ML_(dinfo_memdup)( const HChar* cc, void* str, SizeT nStr );
+void*  ML_(dinfo_memdup)( const HChar* cc, const void* str, SizeT nStr );
 void   ML_(dinfo_shrink_block)( void* ptr, SizeT szB );
 
 /* Extract (possibly unaligned) data of various sizes from a buffer. */
-Short ML_(read_Short)( UChar* data );
-Int ML_(read_Int)( UChar* data );
-Long ML_(read_Long)( UChar* data );
-UShort ML_(read_UShort)( UChar* data );
-UWord ML_(read_UWord)( UChar* data );
-UInt ML_(read_UInt)( UChar* data );
-ULong ML_(read_ULong)( UChar* data );
-UChar ML_(read_UChar)( UChar* data );
-Addr ML_(read_Addr)( UChar* data );
+Short ML_(read_Short)( const UChar* data );
+Int ML_(read_Int)( const UChar* data );
+Long ML_(read_Long)( const UChar* data );
+UShort ML_(read_UShort)( const UChar* data );
+UWord ML_(read_UWord)( const UChar* data );
+UInt ML_(read_UInt)( const UChar* data );
+ULong ML_(read_ULong)( const UChar* data );
+UChar ML_(read_UChar)( const UChar* data );
+Addr ML_(read_Addr)( const UChar* data );
 
 UChar* ML_(write_UShort)( UChar* ptr, UShort val );
 UChar* ML_(write_UInt)( UChar* ptr, UInt val );
index 59ae353b0a6a8dbdabe03667e117138bf9a107e3..22c58e9ae3038e46dc8ea0841b15bfaf633f2b3f 100644 (file)
@@ -43,7 +43,8 @@
 
 /* Identify an ELF object file by peering at the first few bytes of
    it. */
-extern Bool ML_(is_elf_object_file)( void* image, SizeT n_image, Bool rel_ok );
+extern Bool ML_(is_elf_object_file)( const void* image, SizeT n_image,
+                                     Bool rel_ok );
 
 /* The central function for reading ELF debug info.  For the
    object/exe specified by the SegInfo, find ELF sections, then read
index bdef9c9088963aa18a8b03f99980acb52510ff12..117a8c570f36b8af2c41f39677e9fdcfdf4c4f46 100644 (file)
@@ -47,14 +47,14 @@ extern Bool ML_(read_pdb_debug_info)(
                PtrdiffT   obj_bias,
                void*      pdbimage,
                SizeT      n_pdbimage,
-               HChar*     pdbname,
+               const HChar* pdbname,
                ULong      pdbmtime
             );
 
 /* Finds the name of the PDB file that's embedded with the specified
    PE file, or NULL on failure.  Caller deallocates with
    ML_(dinfo_free). */
-HChar* ML_(find_name_of_pdb_file)( HChar* pename );
+HChar* ML_(find_name_of_pdb_file)( const HChar* pename );
 
 
 #endif /* ndef __PRIV_READPDB_H */
index b836636c40870dc88d83a750a59bf225fdacdaee..1f02503f26110deaef4783852aaf9871fc189053 100644 (file)
@@ -439,7 +439,7 @@ extern Int ML_(CfiExpr_Binop) ( XArray* dst, CfiBinop op, Int ixL, Int ixR );
 extern Int ML_(CfiExpr_CfiReg)( XArray* dst, CfiReg reg );
 extern Int ML_(CfiExpr_DwReg) ( XArray* dst, Int reg );
 
-extern void ML_(ppCfiExpr)( XArray* src, Int ix );
+extern void ML_(ppCfiExpr)( const XArray* src, Int ix );
 
 /* ---------------- FPO INFO (Windows PE) -------------- */
 
@@ -532,19 +532,19 @@ ML_(cmp_for_DiAddrRange_range) ( const void* keyV, const void* elemV );
    relocation, which only appears to be the case for 32 bit objects.
 */
 
-struct _DebugInfoMapping
+typedef struct
 {
    Addr  avma; /* these fields record the file offset, length */
    SizeT size; /* and map address of each mapping             */
    OffT  foff;
    Bool  rx, rw, ro;  /* memory access flags for this mapping */
-};
+} DebugInfoMapping;
 
 struct _DebugInfoFSM
 {
    HChar*  filename;  /* in mallocville (VG_AR_DINFO)               */
    HChar*  dbgname;   /* in mallocville (VG_AR_DINFO)               */
-   XArray* maps;      /* XArray of _DebugInfoMapping structs        */
+   XArray* maps;      /* XArray of DebugInfoMapping structs         */
    Bool  have_rx_map; /* did we see a r?x mapping yet for the file? */
    Bool  have_rw_map; /* did we see a rw? mapping yet for the file? */
    Bool  have_ro_map; /* did we see a r-- mapping yet for the file? */
@@ -975,7 +975,7 @@ struct _DebugInfo {
    /* Cached last rx mapping matched and returned by ML_(find_rx_mapping).
       This helps performance a lot during ML_(addLineInfo) etc., which can
       easily be invoked hundreds of thousands of times. */
-   struct _DebugInfoMapping* last_rx_map;
+   DebugInfoMapping* last_rx_map;
 };
 
 /* --------------------- functions --------------------- */
@@ -997,17 +997,17 @@ extern UInt ML_(addFnDn) (struct _DebugInfo* di,
 
 /* Returns the filename of the fndn pair identified by fndn_ix.
    Returns "???" if fndn_ix is 0. */
-extern const HChar* ML_(fndn_ix2filename) (struct _DebugInfo* di,
+extern const HChar* ML_(fndn_ix2filename) (const DebugInfo* di,
                                            UInt fndn_ix);
 
 /* Returns the dirname of the fndn pair identified by fndn_ix.
    Returns "" if fndn_ix is 0 or fndn->dirname is NULL. */
-extern const HChar* ML_(fndn_ix2dirname) (struct _DebugInfo* di,
+extern const HChar* ML_(fndn_ix2dirname) (const DebugInfo* di,
                                           UInt fndn_ix);
 
 /* Returns the fndn_ix for the LineInfo locno in di->loctab.
    0 if filename/dirname are unknown. */
-extern UInt ML_(fndn_ix) (struct _DebugInfo* di, Word locno);
+extern UInt ML_(fndn_ix) (const DebugInfo* di, Word locno);
 
 /* Add a line-number record to a DebugInfo.
    fndn_ix is an index in di->fndnpool, allocated using  ML_(addFnDn).
@@ -1041,7 +1041,7 @@ extern void ML_(addDiCfSI) ( struct _DebugInfo* di,
 /* Given a position in the di->cfsi_base/cfsi_m_ix arrays, return
    the corresponding cfsi_m*. Return NULL if the position corresponds
    to a cfsi hole. */
-DiCfSI_m* ML_(get_cfsi_m) (struct _DebugInfo* di, UInt pos);
+DiCfSI_m* ML_(get_cfsi_m) (const DebugInfo* di, UInt pos);
 
 /* Add a string to the string table of a DebugInfo.  If len==-1,
    ML_(addStr) will itself measure the length of the string. */
@@ -1083,28 +1083,28 @@ extern void ML_(finish_CFSI_arrays) ( struct _DebugInfo* di );
 
 /* Find a symbol-table index containing the specified pointer, or -1
    if not found.  Binary search.  */
-extern Word ML_(search_one_symtab) ( struct _DebugInfo* di, Addr ptr,
+extern Word ML_(search_one_symtab) ( const DebugInfo* di, Addr ptr,
                                      Bool match_anywhere_in_sym,
                                      Bool findText );
 
 /* Find a location-table index containing the specified pointer, or -1
    if not found.  Binary search.  */
-extern Word ML_(search_one_loctab) ( struct _DebugInfo* di, Addr ptr );
+extern Word ML_(search_one_loctab) ( const DebugInfo* di, Addr ptr );
 
 /* Find a CFI-table index containing the specified pointer, or -1 if
    not found.  Binary search.  */
-extern Word ML_(search_one_cfitab) ( struct _DebugInfo* di, Addr ptr );
+extern Word ML_(search_one_cfitab) ( const DebugInfo* di, Addr ptr );
 
 /* Find a FPO-table index containing the specified pointer, or -1
    if not found.  Binary search.  */
-extern Word ML_(search_one_fpotab) ( struct _DebugInfo* di, Addr ptr );
+extern Word ML_(search_one_fpotab) ( const DebugInfo* di, Addr ptr );
 
 /* Helper function for the most often needed searching for an rx
    mapping containing the specified address range.  The range must
    fall entirely within the mapping to be considered to be within it.
    Asserts if lo > hi; caller must ensure this doesn't happen. */
-extern struct _DebugInfoMapping* ML_(find_rx_mapping) ( struct _DebugInfo* di,
-                                                        Addr lo, Addr hi );
+extern DebugInfoMapping* ML_(find_rx_mapping) ( DebugInfo* di,
+                                                Addr lo, Addr hi );
 
 /* ------ Misc ------ */
 
@@ -1112,15 +1112,15 @@ extern struct _DebugInfoMapping* ML_(find_rx_mapping) ( struct _DebugInfo* di,
    terminal.  'serious' errors are always shown, not 'serious' ones
    are shown only at verbosity level 2 and above. */
 extern 
-void ML_(symerr) ( struct _DebugInfo* di, Bool serious, const HChar* msg );
+void ML_(symerr) ( const DebugInfo* di, Bool serious, const HChar* msg );
 
 /* Print a symbol. */
-extern void ML_(ppSym) ( Int idx, DiSym* sym );
+extern void ML_(ppSym) ( Int idx, const DiSym* sym );
 
 /* Print a call-frame-info summary. */
-extern void ML_(ppDiCfSI) ( XArray* /* of CfiExpr */ exprs,
+extern void ML_(ppDiCfSI) ( const XArray* /* of CfiExpr */ exprs,
                             Addr base, UInt len,
-                            DiCfSI_m* si_m );
+                            const DiCfSI_m* si_m );
 
 
 #define TRACE_SYMTAB_ENABLED (di->trace_symtab)
index 301e8976d6d1cc0ce1d05c65f0cb9190e3451e9d..82fd90558d61a2c0b3065262d6156e9a8b3d5a51 100644 (file)
@@ -145,16 +145,16 @@ typedef
 
 /* Does this TyEnt denote a type, as opposed to some other kind of
    thing? */
-Bool ML_(TyEnt__is_type)( TyEnt* );
+Bool ML_(TyEnt__is_type)( const TyEnt* );
 
 /* Print a TyEnt, debug-style. */
-void ML_(pp_TyEnt)( TyEnt* );
+void ML_(pp_TyEnt)( const TyEnt* );
 
 /* Print a whole XArray of TyEnts, debug-style */
-void ML_(pp_TyEnts)( XArray* tyents, const HChar* who );
+void ML_(pp_TyEnts)( const XArray* tyents, const HChar* who );
 
 /* Print a TyEnt, C style, chasing stuff as necessary. */
-void ML_(pp_TyEnt_C_ishly)( XArray* /* of TyEnt */ tyents,
+void ML_(pp_TyEnt_C_ishly)( const XArray* /* of TyEnt */ tyents,
                             UWord cuOff );
 
 /* Generates a total ordering on TyEnts based only on their .cuOff
@@ -173,13 +173,13 @@ void ML_(TyEnt__make_EMPTY) ( TyEnt* te );
 /* How big is this type?  If .b in the returned struct is False, the
    size is unknown. */
 
-MaybeULong ML_(sizeOfType)( XArray* /* of TyEnt */ tyents,
+MaybeULong ML_(sizeOfType)( const XArray* /* of TyEnt */ tyents,
                             UWord cuOff );
 
 /* Describe where in the type 'offset' falls.  Caller must
    deallocate the resulting XArray. */
 XArray* /*UChar*/ ML_(describe_type)( /*OUT*/PtrdiffT* residual_offset,
-                                      XArray* /* of TyEnt */ tyents,
+                                      const XArray* /* of TyEnt */ tyents,
                                       UWord ty_cuOff, 
                                       PtrdiffT offset );
 
@@ -213,7 +213,7 @@ void ML_(TyEntIndexCache__invalidate) ( TyEntIndexCache* cache );
    the entry which has .cuOff field as specified.  Returns NULL if not
    found.  Asserts if more than one entry has the specified .cuOff
    value. */
-TyEnt* ML_(TyEnts__index_by_cuOff) ( XArray* /* of TyEnt */ ents,
+TyEnt* ML_(TyEnts__index_by_cuOff) ( const XArray* /* of TyEnt */ ents,
                                      TyEntIndexCache* cache,
                                      UWord cuOff_to_find );
 
index 2877a621f55915c5014b77d8f05d5c47f9f5c834..af6ba2b2b50a162075e05aac799cb176625f9a60 100644 (file)
@@ -339,7 +339,7 @@ void process_extended_line_op( struct _DebugInfo* di,
  */
 static 
 void read_dwarf2_lineblock ( struct _DebugInfo* di,
-                             UnitInfo* ui, 
+                             const UnitInfo* ui, 
                              DiCursor  theBlock, /* IMAGE */
                              Int       noLargerThan )
 {
@@ -1898,7 +1898,7 @@ typedef
    }
    RegRule;
 
-static void ppRegRule ( XArray* exprs, RegRule* rrule )
+static void ppRegRule ( XArray* exprs, const RegRule* rrule )
 {
    vg_assert(exprs);
    switch (rrule->tag) {
@@ -1952,12 +1952,12 @@ typedef
    }
    UnwindContext;
 
-static void ppUnwindContext ( UnwindContext* ctx )
+static void ppUnwindContext ( const UnwindContext* ctx )
 {
    Int j, i;
    VG_(printf)("0x%llx: ", (ULong)ctx->loc);
    for (j = 0; j <= ctx->state_sp; j++) {
-      struct UnwindContextState* ctxs = &ctx->state[j];
+      const struct UnwindContextState* ctxs = &ctx->state[j];
       VG_(printf)("%s[%d]={ ", j > 0 ? " " : "", j);
       if (ctxs->cfa_is_regoff) {
          VG_(printf)("%d(r%d) ", ctxs->cfa_off, ctxs->cfa_reg);
@@ -2033,9 +2033,8 @@ typedef
 
 /* Forward */
 static 
-Int copy_convert_CfiExpr_tree ( XArray*        dst,
-                                UnwindContext* srcuc, 
-                                Int            nd );
+Int copy_convert_CfiExpr_tree ( XArray* dst, const UnwindContext* srcuc, 
+                                Int nd );
 
 /* Summarise ctx into si, if possible.  Returns True if successful.
    This is taken to be just after ctx's loc advances; hence the
@@ -2046,11 +2045,11 @@ static Bool summarise_context(/*OUT*/Addr* base,
                               /*OUT*/UInt* len,
                               /*OUT*/DiCfSI_m* si_m,
                                Addr loc_start,
-                              UnwindContext* ctx,
-                               struct _DebugInfo* debuginfo )
+                              const UnwindContext* ctx,
+                               DebugInfo* debuginfo )
 {
    Int why = 0;
-   struct UnwindContextState* ctxs;
+   const struct UnwindContextState* ctxs;
 
    *base = 0;
    *len = 0;
@@ -2420,7 +2419,7 @@ static Bool summarise_context(/*OUT*/Addr* base,
    there is no equivalent register, return -1.  This has the
    undesirable side effect of de-dagifying the input; oh well. */
 static Int copy_convert_CfiExpr_tree ( XArray*        dstxa,
-                                       UnwindContext* srcuc, 
+                                       const UnwindContext* srcuc, 
                                        Int            srcix )
 {
    CfiExpr* src;
@@ -2500,9 +2499,9 @@ static Int copy_convert_CfiExpr_tree ( XArray*        dstxa,
 }
 
 
-static void ppUnwindContext_summary ( UnwindContext* ctx )
+static void ppUnwindContext_summary ( const UnwindContext* ctx )
 {
-   struct UnwindContextState* ctxs = &ctx->state[ctx->state_sp];
+   const struct UnwindContextState* ctxs = &ctx->state[ctx->state_sp];
 
    VG_(printf)("0x%llx-1: ", (ULong)ctx->loc);
 
@@ -2573,7 +2572,7 @@ static UInt size_of_encoded_Addr ( UChar encoding )
    }
 }
 
-static Addr step_encoded_Addr ( AddressDecodingInfo* adi,
+static Addr step_encoded_Addr ( const AddressDecodingInfo* adi,
                                 /*MOD*/DiCursor* data )
 {
    /* Regarding the handling of DW_EH_PE_absptr.  DWARF3 says this
@@ -2662,7 +2661,7 @@ static Addr step_encoded_Addr ( AddressDecodingInfo* adi,
    ctx->exprs of the root node.  Or fail in which case return -1. */
 /* IMPORTANT: when adding expression forms here, also remember to
    add suitable evaluation code in evalCfiExpr in debuginfo.c. */
-static Int dwarfexpr_to_dag ( UnwindContext* ctx, 
+static Int dwarfexpr_to_dag ( const UnwindContext* ctx, 
                               DiCursor expr, Int exprlen, 
                               Bool push_cfa_at_start,
                               Bool ddump_frames )
@@ -2697,7 +2696,7 @@ static Int dwarfexpr_to_dag ( UnwindContext* ctx,
 
    Int sp; /* # of top element: valid is -1 .. N_EXPR_STACK-1 */
    Int stack[N_EXPR_STACK];  /* indices into ctx->exprs */
-   struct UnwindContextState* ctxs = &ctx->state[ctx->state_sp];
+   const struct UnwindContextState* ctxs = &ctx->state[ctx->state_sp];
 
    XArray*  dst   = ctx->exprs;
    DiCursor limit = ML_(cur_plus)(expr, exprlen);
@@ -2921,9 +2920,9 @@ static Int dwarfexpr_to_dag ( UnwindContext* ctx,
 */
 static Int run_CF_instruction ( /*MOD*/UnwindContext* ctx, 
                                 DiCursor instrIN,
-                                UnwindContext* restore_ctx,
-                                AddressDecodingInfo* adi,
-                                struct _DebugInfo* di )
+                                const UnwindContext* restore_ctx,
+                                const AddressDecodingInfo* adi,
+                                const DebugInfo* di )
 {
    Int      off, reg, reg2, len, j;
    UInt     delta;
@@ -3329,7 +3328,7 @@ static Int run_CF_instruction ( /*MOD*/UnwindContext* ctx,
    readelf --debug-dump=frames would. */
 
 static Int show_CF_instruction ( DiCursor instrIN,
-                                 AddressDecodingInfo* adi,
+                                 const AddressDecodingInfo* adi,
                                  Int code_a_f, Int data_a_f )
 {
    Int      off, coff, reg, reg2, len;
@@ -3535,7 +3534,7 @@ static Int show_CF_instruction ( DiCursor instrIN,
 
 /* Show the instructions in instrs[0 .. ilen-1]. */
 static void show_CF_instructions ( DiCursor instrs, Int ilen,
-                                   AddressDecodingInfo* adi,
+                                   const AddressDecodingInfo* adi,
                                    Int code_a_f, Int data_a_f )
 {
    Int i = 0;
@@ -3551,12 +3550,12 @@ static void show_CF_instructions ( DiCursor instrs, Int ilen,
    reached, or until there is a failure.  Return True iff success. 
 */
 static 
-Bool run_CF_instructions ( struct _DebugInfo* di,
+Bool run_CF_instructions ( DebugInfo* di,
                            Bool record,
                            UnwindContext* ctx, DiCursor instrs, Int ilen,
                            UWord fde_arange,
-                           UnwindContext* restore_ctx,
-                           AddressDecodingInfo* adi )
+                           const UnwindContext* restore_ctx,
+                           const AddressDecodingInfo* adi )
 {
    Addr base;
    UInt len;
index 96cbfb1638f01d06ce8038ff684cc616abbdcb1d..154049911a4a0b39a4a9daccfd6e885d5fef8325 100644 (file)
@@ -176,7 +176,7 @@ typedef
    }
    Cursor;
 
-static inline Bool is_sane_Cursor ( Cursor* c ) {
+static inline Bool is_sane_Cursor ( const Cursor* c ) {
    if (!c)                return False;
    if (!c->barf)          return False;
    if (!c->barfstr)       return False;
@@ -204,12 +204,12 @@ static void init_Cursor ( /*OUT*/Cursor* c,
    vg_assert(is_sane_Cursor(c));
 }
 
-static Bool is_at_end_Cursor ( Cursor* c ) {
+static Bool is_at_end_Cursor ( const Cursor* c ) {
    vg_assert(is_sane_Cursor(c));
    return c->sli_next >= c->sli.ioff + c->sli.szB;
 }
 
-static inline ULong get_position_of_Cursor ( Cursor* c ) {
+static inline ULong get_position_of_Cursor ( const Cursor* c ) {
    vg_assert(is_sane_Cursor(c));
    return c->sli_next - c->sli.ioff;
 }
@@ -222,7 +222,7 @@ static inline void advance_position_of_Cursor ( Cursor* c, ULong delta ) {
    vg_assert(is_sane_Cursor(c));
 }
 
-static /*signed*/Long get_remaining_length_Cursor ( Cursor* c ) {
+static /*signed*/Long get_remaining_length_Cursor ( const Cursor* c ) {
    vg_assert(is_sane_Cursor(c));
    return c->sli.ioff + c->sli.szB - c->sli_next;
 }
@@ -495,7 +495,7 @@ typedef
    a contiguous whole, so that DIEs coming from .debug_types are numbered
    starting at the end of .debug_info and DIEs coming from alternate
    .debug_info are numbered starting at the end of .debug_types.  */
-static UWord cook_die( CUConst* cc, UWord die )
+static UWord cook_die( const CUConst* cc, UWord die )
 {
    if (cc->is_type_unit)
       die += cc->types_cuOff_bias;
@@ -508,7 +508,7 @@ static UWord cook_die( CUConst* cc, UWord die )
    DW_FORM_ref_sig8 reference are already cooked.  Also, handle
    DW_FORM_GNU_ref_alt from within primary .debug_info or .debug_types
    as reference to alternate .debug_info.  */
-static UWord cook_die_using_form( CUConst *cc, UWord die, DW_FORM form)
+static UWord cook_die_using_form( const CUConst *cc, UWord die, DW_FORM form)
 {
    if (form == DW_FORM_ref_sig8)
       return die;
@@ -520,7 +520,7 @@ static UWord cook_die_using_form( CUConst *cc, UWord die, DW_FORM form)
 /* Return the uncooked offset of DIE and set *TYPE_FLAG to true if the DIE
    came from the .debug_types section and *ALT_FLAG to true if the DIE
    came from alternate .debug_info section.  */
-static UWord uncook_die( CUConst *cc, UWord die, /*OUT*/Bool *type_flag,
+static UWord uncook_die( const CUConst *cc, UWord die, /*OUT*/Bool *type_flag,
                          Bool *alt_flag )
 {
    *alt_flag = False;
@@ -585,7 +585,7 @@ static UWord uncook_die( CUConst *cc, UWord die, /*OUT*/Bool *type_flag,
 
 
 /* Apply a text bias to a GX. */
-static void bias_GX ( /*MOD*/GExpr* gx, struct _DebugInfo* di )
+static void bias_GX ( /*MOD*/GExpr* gx, const DebugInfo* di )
 {
    UShort nbytes;
    UChar* p = &gx->payload[0];
@@ -651,7 +651,7 @@ static GExpr* make_singleton_GX ( DiCursor block, ULong nbytes )
 }
 
 __attribute__((noinline))
-static GExpr* make_general_GX ( CUConst* cc,
+static GExpr* make_general_GX ( const CUConst* cc,
                                 Bool     td3,
                                 ULong    debug_loc_offset,
                                 Addr     svma_of_referencing_CU )
@@ -830,10 +830,10 @@ static XArray* unitary_range_list ( Addr aMin, Addr aMax )
    caller must deallocate it. */
 __attribute__((noinline))
 static XArray* /* of AddrRange */
-       get_range_list ( CUConst* cc,
-                        Bool     td3,
-                        UWord    debug_ranges_offset,
-                        Addr     svma_of_referencing_CU )
+get_range_list ( const CUConst* cc,
+                 Bool     td3,
+                 UWord    debug_ranges_offset,
+                 Addr     svma_of_referencing_CU )
 {
    Addr      base;
    Cursor    ranges;
@@ -885,7 +885,7 @@ static XArray* /* of AddrRange */
 }
 
 #define VARSZ_FORM 0xffffffff
-static UInt get_Form_szB (CUConst* cc, DW_FORM form );
+static UInt get_Form_szB (const CUConst* cc, DW_FORM form );
 
 /* Initialises the hash table of abbreviations.
    We do a single scan of the abbv slice to parse and
@@ -979,7 +979,7 @@ static void init_ht_abbvs (CUConst* cc,
    #undef SZ_G_ABBV
 }
 
-static g_abbv* get_abbv (CUConst* cc, ULong abbv_code)
+static g_abbv* get_abbv (const CUConst* cc, ULong abbv_code)
 {
    g_abbv *abbv;
 
@@ -1130,7 +1130,7 @@ typedef
    at a DiCursor.*/
 static
 void get_Form_contents ( /*OUT*/FormContents* cts,
-                         CUConst* cc, Cursor* c,
+                         const CUConst* cc, Cursor* c,
                          Bool td3, DW_FORM form )
 {
    VG_(bzero_inline)(cts, sizeof(*cts));
@@ -1461,7 +1461,7 @@ static inline UInt sizeof_Dwarfish_UWord (Bool is_dw64)
 /* If the form is a fixed length form, return the nr of bytes for this form.
    If the form is a variable length form, return VARSZ_FORM. */
 static
-UInt get_Form_szB (CUConst* cc, DW_FORM form )
+UInt get_Form_szB (const CUConst* cc, DW_FORM form )
 {
    // !!! keep switch in sync with get_Form_contents : the nr of bytes
    // read from a cursor by get_Form_contents must be returned by
@@ -1536,8 +1536,8 @@ UInt get_Form_szB (CUConst* cc, DW_FORM form )
 static
 void skip_DIE (UWord  *sibling,
                Cursor* c_die,
-               g_abbv *abbv,
-               CUConst* cc)
+               const g_abbv *abbv,
+               const CUConst* cc)
 {
    UInt nf_i;
    FormContents cts;
@@ -1636,7 +1636,8 @@ typedef
    }
    D3VarParser;
 
-static void varstack_show ( D3VarParser* parser, const HChar* str ) {
+static void varstack_show ( const D3VarParser* parser, const HChar* str )
+{
    Word i, j;
    VG_(printf)("  varstack (%s) {\n", str);
    for (i = 0; i <= parser->sp; i++) {
@@ -1690,7 +1691,7 @@ void varstack_preen ( D3VarParser* parser, Bool td3, Int level )
       varstack_show( parser, "after preen" );
 }
 
-static void varstack_push ( CUConst* cc,
+static void varstack_push ( const CUConst* cc,
                             D3VarParser* parser,
                             Bool td3,
                             XArray* ranges, Int level,
@@ -1731,7 +1732,7 @@ static void varstack_push ( CUConst* cc,
    in both cases bundle the expression or location list into a
    so-called GExpr (guarded expression). */
 __attribute__((noinline))
-static GExpr* get_GX ( CUConst* cc, Bool td3, const FormContents* cts )
+static GExpr* get_GX ( const CUConst* cc, Bool td3, const FormContents* cts )
 {
    GExpr* gexpr = NULL;
    if (cts->szB < 0) {
@@ -1761,7 +1762,7 @@ static GExpr* get_GX ( CUConst* cc, Bool td3, const FormContents* cts )
    whatever that means, according to the DWARF3 spec.
    FIXME??? readdwarf3.c/readdwarf.c have a lot of duplicated code */
 static
-XArray* read_dirname_xa (struct _DebugInfo* di, const HChar *compdir,
+XArray* read_dirname_xa (DebugInfo* di, const HChar *compdir,
                          Cursor *c,
                          Bool td3 )
 {
@@ -1839,7 +1840,7 @@ XArray* read_dirname_xa (struct _DebugInfo* di, const HChar *compdir,
 static 
 void read_filename_table( /*MOD*/XArray* /* of UInt* */ fndn_ix_Table,
                           const HChar* compdir,
-                          CUConst* cc, ULong debug_line_offset,
+                          const CUConst* cc, ULong debug_line_offset,
                           Bool td3 )
 {
    Bool   is_dw64;
@@ -1847,10 +1848,10 @@ void read_filename_table( /*MOD*/XArray* /* of UInt* */ fndn_ix_Table,
    Word   i;
    UShort version;
    UChar  opcode_base;
-   const  HChar* str;
+   const HChar* str;
    XArray* dirname_xa;   /* xarray of HChar* dirname */
    ULong  dir_xa_ix;     /* Index in dirname_xa, as read from dwarf info. */
-   HChar* dirname;
+   const HChar* dirname;
    UInt   fndn_ix;
 
    vg_assert(fndn_ix_Table && cc && cc->barf);
@@ -1962,8 +1963,8 @@ static void trace_DIE(
    UWord posn,
    Int level,
    UWord saved_die_c_offset,
-   g_abbv *abbv,
-   CUConst* cc)
+   const g_abbv *abbv,
+   const CUConst* cc)
 {
    Cursor c;
    FormContents cts;
@@ -2020,8 +2021,8 @@ static void dump_bad_die_and_barf(
    Int level,
    Cursor* c_die,
    UWord saved_die_c_offset,
-   g_abbv *abbv,
-   CUConst* cc)
+   const g_abbv *abbv,
+   const CUConst* cc)
 {
    trace_DIE (dtag, posn, level, saved_die_c_offset, abbv, cc);
    VG_(printf)("%s:\n", whichparser);
@@ -2045,7 +2046,7 @@ static void parse_var_DIE (
    UWord posn,
    Int level,
    Cursor* c_die,
-   g_abbv *abbv,
+   const g_abbv *abbv,
    CUConst* cc,
    Bool td3
 )
@@ -2324,7 +2325,7 @@ static void parse_var_DIE (
             stack. */
          GExpr*   fbGX = NULL;
          Word     i, nRanges;
-         XArray*  /* of AddrRange */ xa;
+         const XArray*  /* of AddrRange */ xa;
          TempVar* tv;
          /* Stack can't be empty; we put a dummy entry on it for the
             entire address range before starting with the DIEs for
@@ -2549,10 +2550,10 @@ typedef
    table is kept, while we must handle all abbreviations in all CUs
    referenced by an absori (being a reference to an alt CU, or a previous
    or following CU). */
-static const HChar* get_inlFnName (Int absori, CUConst* cc, Bool td3)
+static const HChar* get_inlFnName (Int absori, const CUConst* cc, Bool td3)
 {
    Cursor c;
-   g_abbv *abbv;
+   const g_abbv *abbv;
    ULong  atag, abbv_code;
    UInt   has_children;
    UWord  posn;
@@ -2660,7 +2661,7 @@ static Bool parse_inl_DIE (
    UWord posn,
    Int level,
    Cursor* c_die,
-   g_abbv *abbv,
+   const g_abbv *abbv,
    CUConst* cc,
    Bool td3
 )
@@ -2861,7 +2862,8 @@ typedef
    }
    D3TypeParser;
 
-static void typestack_show ( D3TypeParser* parser, const HChar* str ) {
+static void typestack_show ( const D3TypeParser* parser, const HChar* str )
+{
    Word i;
    VG_(printf)("  typestack (%s) {\n", str);
    for (i = 0; i <= parser->sp; i++) {
@@ -2896,12 +2898,13 @@ void typestack_preen ( D3TypeParser* parser, Bool td3, Int level )
       typestack_show( parser, "after preen" );
 }
 
-static Bool typestack_is_empty ( D3TypeParser* parser ) {
+static Bool typestack_is_empty ( const D3TypeParser* parser )
+{
    vg_assert(parser->sp >= -1 && parser->sp < N_D3_TYPE_STACK);
    return parser->sp == -1;
 }
 
-static void typestack_push ( CUConst* cc,
+static void typestack_push ( const CUConst* cc,
                              D3TypeParser* parser,
                              Bool td3,
                              TyEnt* parentE, Int level ) {
@@ -2933,7 +2936,7 @@ static void typestack_push ( CUConst* cc,
 }
 
 /* True if the subrange type being parsed gives the bounds of an array. */
-static Bool subrange_type_denotes_array_bounds ( D3TypeParser* parser,
+static Bool subrange_type_denotes_array_bounds ( const D3TypeParser* parser,
                                                  DW_TAG dtag ) {
    vg_assert(dtag == DW_TAG_subrange_type);
    /* For most languages, a subrange_type dtag always gives the 
@@ -2983,8 +2986,8 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents,
                              UWord posn,
                              Int level,
                              Cursor* c_die,
-                             g_abbv *abbv,
-                             CUConst* cc,
+                             const g_abbv *abbv,
+                             const CUConst* cc,
                              Bool td3 )
 {
    FormContents cts;
@@ -4116,7 +4119,7 @@ static void read_DIE (
    Cursor* c, Bool td3, CUConst* cc, Int level
 )
 {
-   g_abbv *abbv;
+   const g_abbv *abbv;
    ULong  atag, abbv_code;
    UWord  posn;
    UInt   has_children;
@@ -4250,7 +4253,7 @@ static void read_DIE (
 
 }
 
-static void trace_debug_loc (struct _DebugInfo* di,
+static void trace_debug_loc (const DebugInfo* di,
                              __attribute__((noreturn)) void (*barf)( const HChar* ),
                              DiSlice escn_debug_loc)
 {
@@ -4317,7 +4320,7 @@ static void trace_debug_loc (struct _DebugInfo* di,
 #endif
 }
 
-static void trace_debug_ranges (struct _DebugInfo* di,
+static void trace_debug_ranges (const DebugInfo* di,
                                 __attribute__((noreturn)) void (*barf)( const HChar* ),
                                 DiSlice escn_debug_ranges)
 {
@@ -4371,7 +4374,7 @@ static void trace_debug_ranges (struct _DebugInfo* di,
    }
 }
 
-static void trace_debug_abbrev (struct _DebugInfo* di,
+static void trace_debug_abbrev (const DebugInfo* di,
                                 __attribute__((noreturn)) void (*barf)( const HChar* ),
                                 DiSlice escn_debug_abbv)
 {
@@ -4413,7 +4416,7 @@ static void trace_debug_abbrev (struct _DebugInfo* di,
 
 static
 void new_dwarf3_reader_wrk ( 
-   struct _DebugInfo* di,
+   DebugInfo* di,
    __attribute__((noreturn)) void (*barf)( const HChar* ),
    DiSlice escn_debug_info,      DiSlice escn_debug_types,
    DiSlice escn_debug_abbv,      DiSlice escn_debug_line,
@@ -5135,7 +5138,7 @@ static __attribute__((noreturn)) void barf ( const HChar* reason ) {
 
 void 
 ML_(new_dwarf3_reader) (
-   struct _DebugInfo* di,
+   DebugInfo* di,
    DiSlice escn_debug_info,      DiSlice escn_debug_types,
    DiSlice escn_debug_abbv,      DiSlice escn_debug_line,
    DiSlice escn_debug_str,       DiSlice escn_debug_ranges,
index 880d83099ea51d81448bc0dc3b085e39c4f03a11..a891e5749fcd13d1029be45be93c536007dda2e6 100644 (file)
 /* Identify an ELF object file by peering at the first few bytes of
    it. */
 
-Bool ML_(is_elf_object_file)( void* image, SizeT n_image, Bool rel_ok )
+Bool ML_(is_elf_object_file)( const void* image, SizeT n_image, Bool rel_ok )
 {
-   ElfXX_Ehdr* ehdr = (ElfXX_Ehdr*)image;
+   const ElfXX_Ehdr* ehdr = image;
    Int ok = 1;
 
    if (n_image < sizeof(ElfXX_Ehdr))
@@ -158,7 +158,7 @@ static Bool is_elf_object_file_by_DiImage( DiImage* img, Bool rel_ok )
 static
 void show_raw_elf_symbol ( DiImage* strtab_img,
                            Int i, 
-                           ElfXX_Sym* sym,
+                           const ElfXX_Sym* sym,
                            DiOffT sym_name_ioff, Addr sym_svma,
                            Bool ppc64_linux_format )
 {
@@ -224,12 +224,12 @@ static
 Bool get_elf_symbol_info ( 
         /* INPUTS */
         struct _DebugInfo* di, /* containing DebugInfo */
-        ElfXX_Sym* sym,        /* ELF symbol */
+        const ElfXX_Sym* sym,        /* ELF symbol */
         DiOffT     sym_name_ioff, /* name, may be absent (DiOffT_INVALID) */
-        DiSlice*   escn_strtab,   /* holds the name */
+        const DiSlice*   escn_strtab,   /* holds the name */
         Addr       sym_svma,   /* address as stated in the object file */
         Bool       symtab_in_debug, /* symbol table is in the debug file */
-        DiSlice*   escn_opd,   /* the .opd (ppc64be-linux only) */
+        const DiSlice*   escn_opd,   /* the .opd (ppc64be-linux only) */
         PtrdiffT   opd_bias,   /* for biasing AVMAs found in .opd */
         /* OUTPUTS */
         DiOffT* sym_name_out_ioff, /* name (in strtab) we should record */
@@ -745,7 +745,7 @@ void read_elf_symtab__normal(
      )
 {
    if (escn_strtab->img == NULL || escn_symtab->img == NULL) {
-      HChar buf[80];
+      HChar buf[80];  // FIXME: allocate dynamically
       vg_assert(VG_(strlen)(tab_name) < 40);
       VG_(sprintf)(buf, "   object doesn't have a %s", tab_name);
       ML_(symerr)(di, False, buf);
@@ -845,7 +845,7 @@ typedef
    }
    TempSym;
 
-static Word cmp_TempSymKey ( TempSymKey* key1, TempSym* elem2 )
+static Word cmp_TempSymKey ( const TempSymKey* key1, const TempSym* elem2 )
 {
    /* Stay sane ... */
    vg_assert(key1->img == elem2->key.img);
@@ -876,7 +876,7 @@ void read_elf_symtab__ppc64be_linux(
    TempSym    *prev;
 
    if (escn_strtab->img == NULL || escn_symtab->img == NULL) {
-      HChar buf[80];
+      HChar buf[80];  // FIXME: allocate dynamically
       vg_assert(VG_(strlen)(tab_name) < 40);
       VG_(sprintf)(buf, "   object doesn't have a %s", tab_name);
       ML_(symerr)(di, False, buf);
@@ -1316,7 +1316,7 @@ DiImage* find_debug_file( struct _DebugInfo* di,
    hacky and dangerous way: check only the --extra-debuginfo-path and
    the --debuginfo-server.  And don't do a consistency check. */
 static
-DiImage* find_debug_file_ad_hoc( struct _DebugInfo* di,
+DiImage* find_debug_file_ad_hoc( const DebugInfo* di,
                                  const HChar* objpath )
 {
    const HChar* extrapath  = VG_(clo_extra_debuginfo_path);
@@ -1522,7 +1522,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
       Bool has_nonempty_rx = False;
       Bool has_nonempty_rw = False;
       for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) {
-         struct _DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
+         DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
          if (!map->rx && !map->rw)
             continue;
          if (map->rx && map->size > 0)
@@ -1598,13 +1598,13 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
    TRACE_SYMTAB("shdr:    ioff %llu nent %ld ent_szB %ld\n",
                shdr_mioff, shdr_mnent, shdr_ment_szB);
    for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) {
-      struct _DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
+      const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
       if (map->rx)
          TRACE_SYMTAB("rx_map:  avma %#lx   size %lu  foff %lu\n",
                       map->avma, map->size, map->foff);
    }
    for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) {
-      struct _DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
+      const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
       if (map->rw)
          TRACE_SYMTAB("rw_map:  avma %#lx   size %lu  foff %lu\n",
                       map->avma, map->size, map->foff);
@@ -1688,7 +1688,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
             if (a_phdr.p_memsz > 0) {
                Bool loaded = False;
                for (j = 0; j < VG_(sizeXA)(di->fsm.maps); j++) {
-                  struct _DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, j);
+                  const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, j);
                   if (   (map->rx || map->rw)
                       && map->size > 0 /* stay sane */
                       && a_phdr.p_offset >= map->foff
@@ -1805,27 +1805,27 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
    TRACE_SYMTAB("\n");
    TRACE_SYMTAB("------ Examining the section headers ------\n");
    for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) {
-      struct _DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
+      const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
       if (map->rx)
          TRACE_SYMTAB("rx: at %#lx are mapped foffsets %ld .. %ld\n",
                       map->avma, map->foff, map->foff + map->size - 1 );
    }
    TRACE_SYMTAB("rx: contains these svma regions:\n");
    for (i = 0; i < VG_(sizeXA)(svma_ranges); i++) {
-      RangeAndBias* reg = VG_(indexXA)(svma_ranges, i);
+      const RangeAndBias* reg = VG_(indexXA)(svma_ranges, i);
       if (reg->exec)
          TRACE_SYMTAB("  svmas %#lx .. %#lx with bias %#lx\n",
                       reg->svma_base, reg->svma_limit - 1, reg->bias );
    }
    for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) {
-      struct _DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
+      const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
       if (map->rw)
          TRACE_SYMTAB("rw: at %#lx are mapped foffsets %ld .. %ld\n",
                       map->avma, map->foff, map->foff + map->size - 1 );
    }
    TRACE_SYMTAB("rw: contains these svma regions:\n");
    for (i = 0; i < VG_(sizeXA)(svma_ranges); i++) {
-      RangeAndBias* reg = VG_(indexXA)(svma_ranges, i);
+      const RangeAndBias* reg = VG_(indexXA)(svma_ranges, i);
       if (!reg->exec)
          TRACE_SYMTAB("  svmas %#lx .. %#lx with bias %#lx\n",
                       reg->svma_base, reg->svma_limit - 1, reg->bias );
@@ -2577,7 +2577,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
                            sizeof(a_phdr));
             if (a_phdr.p_type == PT_LOAD) {
                for (j = 0; j < VG_(sizeXA)(di->fsm.maps); j++) {
-                  struct _DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, j);
+                  const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, j);
                   if (   a_phdr.p_offset >= map->foff
                       && a_phdr.p_offset <  map->foff + map->size
                       && a_phdr.p_offset + a_phdr.p_filesz
index 2502bf80f4fb12e0a00bd7cf90e39533045a35df..814acb12169ab36455638377fc904ec2868b9d1a 100644 (file)
@@ -949,7 +949,7 @@ union codeview_symbol
 
 struct pdb_reader
 {
-   void* (*read_file)(struct pdb_reader*, unsigned, unsigned *);
+   void* (*read_file)(const struct pdb_reader*, unsigned, unsigned *);
    // JRS 2009-Apr-8: .uu_n_pdbimage is never used.
    UChar* pdbimage;      // image address
    SizeT  uu_n_pdbimage; // size
@@ -966,8 +966,8 @@ struct pdb_reader
 };
 
 
-static void* pdb_ds_read( struct pdb_reader* pdb,
-                          unsigned* block_list,
+static void* pdb_ds_read( const struct pdb_reader* pdb,
+                          const unsigned* block_list,
                           unsigned  size )
 {
    unsigned  blocksize, nBlocks;
@@ -992,8 +992,8 @@ static void* pdb_ds_read( struct pdb_reader* pdb,
 }
 
 
-static void* pdb_jg_read( struct pdb_reader* pdb,
-                          unsigned short* block_list,
+static void* pdb_jg_read( const struct pdb_reader* pdb,
+                          const unsigned short* block_list,
                           int size )
 {
    unsigned  blocksize, nBlocks;
@@ -1028,7 +1028,7 @@ static void* find_pdb_header( void* pdbimage,
 }
 
 
-static void* pdb_ds_read_file( struct pdb_reader* reader,
+static void* pdb_ds_read_file( const struct pdb_reader* reader,
                                unsigned  file_number,
                                unsigned* plength )
 {
@@ -1053,7 +1053,7 @@ static void* pdb_ds_read_file( struct pdb_reader* reader,
 }
 
 
-static void* pdb_jg_read_file( struct pdb_reader* pdb,
+static void* pdb_jg_read_file( const struct pdb_reader* pdb,
                                unsigned fileNr,
                                unsigned *plength )
 {
@@ -1108,10 +1108,8 @@ static void pdb_jg_init( struct pdb_reader* reader,
 }
 
 
-
-
 static 
-void pdb_check_root_version_and_timestamp( HChar* pdbname,
+void pdb_check_root_version_and_timestamp( const HChar* pdbname,
                                            ULong  pdbmtime,
                                            unsigned  version,
                                            UInt TimeDateStamp )
@@ -1137,7 +1135,7 @@ void pdb_check_root_version_and_timestamp( HChar* pdbname,
 }
 
 
-static DWORD pdb_get_file_size( struct pdb_reader* reader, unsigned idx )
+static DWORD pdb_get_file_size( const struct pdb_reader* reader, unsigned idx )
 {
    if (reader->read_file == pdb_jg_read_file)
       return reader->u.jg.toc->file[idx].size;
@@ -1203,8 +1201,8 @@ static void pdb_convert_symbols_header( PDB_SYMBOLS *symbols,
 static ULong DEBUG_SnarfCodeView(
                 DebugInfo* di,
                 PtrdiffT bias,
-                IMAGE_SECTION_HEADER* sectp,
-                void* root, /* FIXME: better name */
+                const IMAGE_SECTION_HEADER* sectp,
+                const void* root, /* FIXME: better name */
                 Int offset,
                 Int size
              )
@@ -1212,7 +1210,7 @@ static ULong DEBUG_SnarfCodeView(
    Int    i, length;
    DiSym  vsym;
    const  HChar* nmstr;
-   HChar  symname[4096 /*WIN32_PATH_MAX*/];
+   HChar  symname[4096 /*WIN32_PATH_MAX*/];  // FIXME: really ?
 
    Bool  debug = di->trace_symtab;
    ULong n_syms_read = 0;
@@ -1229,7 +1227,8 @@ static ULong DEBUG_SnarfCodeView(
     */
    for ( i = offset; i < size; i += length )
    {
-      union codeview_symbol *sym = (union codeview_symbol *)((char *)root + i);
+      const union codeview_symbol *sym =
+         (const union codeview_symbol *)((const char *)root + i);
 
       length = sym->generic.len + 2;
 
@@ -1238,14 +1237,13 @@ static ULong DEBUG_SnarfCodeView(
 
       default:
          if (0) {
+            const int *isym = (const int *)sym;
             VG_(printf)("unknown id 0x%x len=0x%x at %p\n",
                         sym->generic.id, sym->generic.len, sym);
             VG_(printf)("  %8x  %8x  %8x  %8x\n", 
-                        ((int *)sym)[1],((int *)sym)[2],
-                        ((int *)sym)[3],((int *)sym)[4]);
+                        isym[1], isym[2], isym[3], isym[4]);
             VG_(printf)("  %8x  %8x  %8x  %8x\n",
-                        ((int *)sym)[5],((int *)sym)[6],
-                        ((int *)sym)[7],((int *)sym)[8]);
+                        isym[5], isym[6], isym[7], isym[8]);
          }
          break;
       /*
@@ -1479,7 +1477,7 @@ static ULong DEBUG_SnarfCodeView(
       case S_PROCREF_V1:
       case S_DATAREF_V1:
       case S_LPROCREF_V1: {
-         unsigned char *name = (unsigned char *)sym + length;
+         const unsigned char *name = (const unsigned char *)sym + length;
          length += (*name + 1 + 3) & ~3;
          break;
       }
@@ -1518,8 +1516,8 @@ struct startend
 static ULong DEBUG_SnarfLinetab(
           DebugInfo* di,
           PtrdiffT bias,
-          IMAGE_SECTION_HEADER* sectp,
-          void* linetab,
+          const IMAGE_SECTION_HEADER* sectp,
+          const void* linetab,
           Int size
        )
 {
@@ -1560,7 +1558,7 @@ static ULong DEBUG_SnarfLinetab(
     */
    nseg = 0;
    for (i = 0; i < nfile; i++) {
-      pnt2.c = (HChar *)linetab + filetab[i];
+      pnt2.c = (const HChar *)linetab + filetab[i];
       nseg += *pnt2.s;
    }
 
@@ -1573,7 +1571,7 @@ static ULong DEBUG_SnarfLinetab(
       /*
        * Get the pointer into the segment information.
        */
-      pnt2.c = (HChar *)linetab + filetab[i];
+      pnt2.c = (const HChar *)linetab + filetab[i];
       file_segcount = *pnt2.s;
 
       pnt2.ui++;
@@ -1606,7 +1604,7 @@ static ULong DEBUG_SnarfLinetab(
          Int linecount;
          Int segno;
 
-         pnt2.c = (HChar *)linetab + lt_ptr[k];
+         pnt2.c = (const HChar *)linetab + lt_ptr[k];
 
          segno = *pnt2.s++;
          linecount = *pnt2.s++;
@@ -1660,7 +1658,7 @@ static ULong DEBUG_SnarfLinetab(
  * an array (starting at <lineblk_offset>) of codeview_linetab2_block structures
  */
 
-struct codeview_linetab2_file
+typedef struct codeview_linetab2_file
 {
     DWORD       offset;         /* offset in string table for filename */
     WORD        unk;            /* always 0x0110... type of following
@@ -1668,9 +1666,9 @@ struct codeview_linetab2_file
     BYTE        md5[16];        /* MD5 signature of file (signature on
                                    file's content or name ???) */
     WORD        pad0;           /* always 0 */
-};
+} codeview_linetab2_file;
 
-struct codeview_linetab2_block
+typedef struct codeview_linetab2_block
 {
     DWORD       header;         /* 0x000000f2 */
     DWORD       size_of_block;  /* next block is at # bytes after this field */
@@ -1687,33 +1685,33 @@ struct codeview_linetab2_block
         DWORD   lineno;         /* the line number (OR:ed with
                                    0x80000000 why ???) */
     } l[1];                     /* actually array of <nlines> */
-};
+} codeview_linetab2_block;
 
 static ULong codeview_dump_linetab2(
                 DebugInfo* di,
                 Addr bias,
-                IMAGE_SECTION_HEADER* sectp,
-                HChar* linetab,
+                const IMAGE_SECTION_HEADER* sectp,
+                const HChar* linetab,
                 DWORD size,
-                HChar* strimage,
+                const HChar* strimage,
                 DWORD strsize,
                 const HChar* pfx
              )
 {
    DWORD       offset;
    unsigned    i;
-   struct codeview_linetab2_block* lbh;
-   struct codeview_linetab2_file* fd;
+   const codeview_linetab2_block* lbh;
+   const codeview_linetab2_file* fd;
 
    Bool  debug = di->trace_symtab;
    ULong n_line2s_read = 0;
 
    if (*(const DWORD*)linetab != 0x000000f4)
       return 0;
-   offset = *((DWORD*)linetab + 1);
-   lbh = (struct codeview_linetab2_block*)(linetab + 8 + offset);
+   offset = *((const DWORD*)linetab + 1);
+   lbh = (const codeview_linetab2_block*)(linetab + 8 + offset);
 
-   while ((HChar*)lbh < linetab + size) {
+   while ((const HChar*)lbh < linetab + size) {
 
       const HChar *filename, *dirname;
       UInt filedirname_ix;
@@ -1728,7 +1726,7 @@ static ULong codeview_dump_linetab2(
          VG_(printf)("%sblock from %04x:%08x-%08x (size %u) (%u lines)\n",
                      pfx, lbh->seg, lbh->start, lbh->start + lbh->size - 1,
                      lbh->size, lbh->nlines);
-      fd = (struct codeview_linetab2_file*)(linetab + 8 + lbh->file_offset);
+      fd = (const codeview_linetab2_file*)(linetab + 8 + lbh->file_offset);
       if (debug)
          VG_(printf)(
             "%s  md5=%02x%02x%02x%02x%02x%02x%02x%02x"
@@ -1797,8 +1795,8 @@ static ULong codeview_dump_linetab2(
           n_line2s_read++;
        }
 
-       lbh = (struct codeview_linetab2_block*)
-                ((char*)lbh + 8 + lbh->size_of_block);
+       lbh = (const codeview_linetab2_block*)
+                ((const char*)lbh + 8 + lbh->size_of_block);
     }
     return n_line2s_read;
 }
@@ -1827,11 +1825,11 @@ static Int cmp_FPO_DATA_for_canonicalisation ( const void* f1V,
 
 
 /* JRS fixme: compare with version in current Wine sources */
-static void pdb_dump( struct pdb_reader* pdb,
+static void pdb_dump( const struct pdb_reader* pdb,
                       DebugInfo* di,
                       Addr       pe_avma,
                       PtrdiffT   pe_bias,
-                      IMAGE_SECTION_HEADER* sectp_avma )
+                      const IMAGE_SECTION_HEADER* sectp_avma )
 {
    Int header_size;
 
@@ -1839,7 +1837,7 @@ static void pdb_dump( struct pdb_reader* pdb,
    PDB_SYMBOLS symbols;
    unsigned len_modimage;
    char *modimage;
-   char *file; 
+   const char *file; 
 
    Bool debug = di->trace_symtab;
 
@@ -1863,7 +1861,7 @@ static void pdb_dump( struct pdb_reader* pdb,
          if (0)
             VG_(printf)("wrong header %x expecting 0xeffeeffe\n",
                         *(const DWORD*)filesimage);
-         ML_(dinfo_free)( (void*)filesimage);
+         ML_(dinfo_free)(filesimage);
          filesimage = NULL;
       }
    }
@@ -2073,7 +2071,7 @@ static void pdb_dump( struct pdb_reader* pdb,
       if (VG_(clo_verbosity) > 1)
          VG_(message)(Vg_UserMsg, "Reading global symbols\n" );
       DEBUG_SnarfCodeView( di, pe_avma, sectp_avma, modimage, 0, len_modimage );
-      ML_(dinfo_free)( (void*)modimage );
+      ML_(dinfo_free)( modimage );
    }
 
    /*
@@ -2082,17 +2080,17 @@ static void pdb_dump( struct pdb_reader* pdb,
    file = symbols_image + header_size;
    while ( file - symbols_image < header_size + symbols.module_size ) {
       int file_nr, /* file_index, */ symbol_size, lineno_size;
-      char *file_name;
+      const char *file_name;
 
       if ( symbols.version < 19970000 ) {
-         PDB_SYMBOL_FILE *sym_file = (PDB_SYMBOL_FILE *) file;
+         const PDB_SYMBOL_FILE *sym_file = (const PDB_SYMBOL_FILE *) file;
          file_nr     = sym_file->file;
          file_name   = sym_file->filename;
          /* file_index  = sym_file->range.index; */ /* UNUSED */
          symbol_size = sym_file->symbol_size;
          lineno_size = sym_file->lineno_size;
       } else {
-         PDB_SYMBOL_FILE_EX *sym_file = (PDB_SYMBOL_FILE_EX *) file;
+         const PDB_SYMBOL_FILE_EX *sym_file = (const PDB_SYMBOL_FILE_EX *) file;
          file_nr     = sym_file->file;
          file_name   = sym_file->filename;
          /* file_index  = sym_file->range.index; */ /* UNUSED */
@@ -2146,11 +2144,11 @@ static void pdb_dump( struct pdb_reader* pdb,
                   filessize, "        "
                );
 
-         ML_(dinfo_free)( (void*)modimage );
+         ML_(dinfo_free)( modimage );
       }
 
       file_name += VG_(strlen)(file_name) + 1;
-      file = (char *)( 
+      file = (const char *)( 
                 (unsigned long)(file_name
                                 + VG_(strlen)(file_name) + 1 + 3) & ~3 );
    }
@@ -2189,7 +2187,7 @@ Bool ML_(read_pdb_debug_info)(
         PtrdiffT   obj_bias,
         void*      pdbimage,
         SizeT      n_pdbimage,
-        HChar*     pdbname,
+        const HChar* pdbname,
         ULong      pdbmtime
      )
 {
@@ -2257,7 +2255,7 @@ Bool ML_(read_pdb_debug_info)(
       mapped_avma     = (Addr)obj_avma + pe_sechdr_avma->VirtualAddress;
       mapped_end_avma = mapped_avma + pe_sechdr_avma->Misc.VirtualSize;
 
-      struct _DebugInfoMapping map;
+      DebugInfoMapping map;
       map.avma = mapped_avma;
       map.size = pe_sechdr_avma->Misc.VirtualSize;
       map.foff = pe_sechdr_avma->PointerToRawData;
@@ -2325,14 +2323,14 @@ Bool ML_(read_pdb_debug_info)(
 
    if (VG_(clo_verbosity) > 1) {
       for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) {
-         struct _DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
+         const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
          if (map->rx)
             VG_(message)(Vg_DebugMsg,
                          "rx_map: avma %#lx size %7lu foff %llu\n",
                          map->avma, map->size, (Off64T)map->foff);
       }
       for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) {
-         struct _DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
+         const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i);
          if (map->rw)
             VG_(message)(Vg_DebugMsg,
                          "rw_map: avma %#lx size %7lu foff %llu\n",
@@ -2412,7 +2410,7 @@ Bool ML_(read_pdb_debug_info)(
    ML_(dinfo_free).
 */
 
-HChar* ML_(find_name_of_pdb_file)( HChar* pename )
+HChar* ML_(find_name_of_pdb_file)( const HChar* pename )
 {
    /* This is a giant kludge, of the kind "you did WTF?!?", but it
       works. */
index 458f0c7449304e6e5583652783bf376aecdab596..1cccd31c96cc3608a05b4245d04065a1102c6ed4 100644 (file)
@@ -62,7 +62,7 @@
 /* Show a non-fatal debug info reading error.  Use vg_panic if
    terminal.  'serious' errors are shown regardless of the
    verbosity setting. */
-void ML_(symerr) ( struct _DebugInfo* di, Bool serious, const HChar* msg )
+void ML_(symerr) ( const DebugInfo* di, Bool serious, const HChar* msg )
 {
    /* XML mode hides everything :-( */
    if (VG_(clo_xml))
@@ -92,7 +92,7 @@ void ML_(symerr) ( struct _DebugInfo* di, Bool serious, const HChar* msg )
 
 
 /* Print a symbol. */
-void ML_(ppSym) ( Int idx, DiSym* sym )
+void ML_(ppSym) ( Int idx, const DiSym* sym )
 {
    const HChar** sec_names = sym->sec_names;
    vg_assert(sym->pri_name);
@@ -115,9 +115,9 @@ void ML_(ppSym) ( Int idx, DiSym* sym )
 }
 
 /* Print a call-frame-info summary. */
-void ML_(ppDiCfSI) ( XArray* /* of CfiExpr */ exprs,
+void ML_(ppDiCfSI) ( const XArray* /* of CfiExpr */ exprs,
                      Addr base, UInt len,
-                     DiCfSI_m* si_m )
+                     const DiCfSI_m* si_m )
 {
 #  define SHOW_HOW(_how, _off)                   \
       do {                                       \
@@ -268,7 +268,7 @@ UInt ML_(addFnDn) (struct _DebugInfo* di,
    return fndn_ix;
 }
 
-const HChar* ML_(fndn_ix2filename) (struct _DebugInfo* di,
+const HChar* ML_(fndn_ix2filename) (const DebugInfo* di,
                                     UInt fndn_ix)
 {
    FnDn *fndn;
@@ -280,7 +280,7 @@ const HChar* ML_(fndn_ix2filename) (struct _DebugInfo* di,
    }
 }
 
-const HChar* ML_(fndn_ix2dirname) (struct _DebugInfo* di,
+const HChar* ML_(fndn_ix2dirname) (const DebugInfo* di,
                                    UInt fndn_ix)
 {
    FnDn *fndn;
@@ -343,7 +343,7 @@ void ML_(addSym) ( struct _DebugInfo* di, DiSym* sym )
    vg_assert(di->symtab_used <= di->symtab_size);
 }
 
-UInt ML_(fndn_ix) (struct _DebugInfo* di, Word locno)
+UInt ML_(fndn_ix) (const DebugInfo* di, Word locno)
 {
    UInt fndn_ix;
 
@@ -656,7 +656,7 @@ void ML_(addInlInfo) ( struct _DebugInfo* di,
    addInl ( di, &inl );
 }
 
-DiCfSI_m* ML_(get_cfsi_m) (struct _DebugInfo* di, UInt pos)
+DiCfSI_m* ML_(get_cfsi_m) (const DebugInfo* di, UInt pos)
 {
    UInt cfsi_m_ix;
 
@@ -682,8 +682,8 @@ void ML_(addDiCfSI) ( struct _DebugInfo* di,
    UInt    new_sz;
    DiCfSI* new_tab;
    SSizeT  delta;
-   struct _DebugInfoMapping* map;
-   struct _DebugInfoMapping* map2;
+   DebugInfoMapping* map;
+   DebugInfoMapping* map2;
 
    if (debug) {
       VG_(printf)("adding DiCfSI: ");
@@ -916,7 +916,7 @@ static void ppCfiReg ( CfiReg reg )
    }
 }
 
-void ML_(ppCfiExpr)( XArray* src, Int ix )
+void ML_(ppCfiExpr)( const XArray* src, Int ix )
 {
    /* VG_(indexXA) checks for invalid src/ix values, so we can
       use it indiscriminately. */
@@ -1416,7 +1416,7 @@ static Int compare_DiSym ( const void* va, const void* vb )
    preferred.
  */
 static
-Bool preferName ( DebugInfo* di,
+Bool preferName ( const DebugInfo* di,
                   const HChar* a_name, const HChar* b_name,
                   Addr sym_avma/*exposition only*/ )
 {
@@ -1556,7 +1556,8 @@ Bool preferName ( DebugInfo* di,
 
 /* Add the names in FROM to the names in TO. */
 static
-void add_DiSym_names_to_from ( DebugInfo* di, DiSym* to, DiSym* from )
+void add_DiSym_names_to_from ( const DebugInfo* di, DiSym* to,
+                               const DiSym* from )
 {
    vg_assert(to->pri_name);
    vg_assert(from->pri_name);
@@ -2035,7 +2036,7 @@ static Int compare_DiCfSI ( const void* va, const void* vb )
    return 0;
 }
 
-static void get_cfsi_rd_stats ( struct _DebugInfo* di,
+static void get_cfsi_rd_stats ( const DebugInfo* di,
                                 UWord *n_mergeables, UWord *n_holes )
 {
    Word i;
@@ -2265,7 +2266,7 @@ void ML_(canonicaliseTables) ( struct _DebugInfo* di )
 /* Find a symbol-table index containing the specified pointer, or -1
    if not found.  Binary search.  */
 
-Word ML_(search_one_symtab) ( struct _DebugInfo* di, Addr ptr,
+Word ML_(search_one_symtab) ( const DebugInfo* di, Addr ptr,
                               Bool match_anywhere_in_sym,
                               Bool findText )
 {
@@ -2298,7 +2299,7 @@ Word ML_(search_one_symtab) ( struct _DebugInfo* di, Addr ptr,
 /* Find a location-table index containing the specified pointer, or -1
    if not found.  Binary search.  */
 
-Word ML_(search_one_loctab) ( struct _DebugInfo* di, Addr ptr )
+Word ML_(search_one_loctab) ( const DebugInfo* di, Addr ptr )
 {
    Addr a_mid_lo, a_mid_hi;
    Word mid, 
@@ -2322,7 +2323,7 @@ Word ML_(search_one_loctab) ( struct _DebugInfo* di, Addr ptr )
 /* Find a CFI-table index containing the specified pointer, or -1
    if not found.  Binary search.  */
 
-Word ML_(search_one_cfitab) ( struct _DebugInfo* di, Addr ptr )
+Word ML_(search_one_cfitab) ( const DebugInfo* di, Addr ptr )
 {
    Word mid, 
         lo = 0, 
@@ -2352,7 +2353,7 @@ Word ML_(search_one_cfitab) ( struct _DebugInfo* di, Addr ptr )
 /* Find a FPO-table index containing the specified pointer, or -1
    if not found.  Binary search.  */
 
-Word ML_(search_one_fpotab) ( struct _DebugInfo* di, Addr ptr )
+Word ML_(search_one_fpotab) ( const DebugInfo* di, Addr ptr )
 {
    Addr const addr = ptr - di->fpo_base_avma;
    Addr a_mid_lo, a_mid_hi;
index aece0a5e092a2ba1dbbcdb5fb874ec521314a33c..6cb9096c10bb99b69982df8fa76c37aeb9400ccd 100644 (file)
@@ -48,7 +48,7 @@
 /* Does this TyEnt denote a type, as opposed to some other kind of
    thing? */
 
-Bool ML_(TyEnt__is_type)( TyEnt* te )
+Bool ML_(TyEnt__is_type)( const TyEnt* te )
 {
    switch (te->tag) {
       case Te_EMPTY: case Te_INDIR: case Te_UNKNOWN: 
@@ -67,7 +67,7 @@ Bool ML_(TyEnt__is_type)( TyEnt* te )
 
 /* Print a TyEnt, debug-style. */
 
-static void pp_XArray_of_cuOffs ( XArray* xa )
+static void pp_XArray_of_cuOffs ( const XArray* xa )
 {
    Word i;
    VG_(printf)("{");
@@ -80,7 +80,7 @@ static void pp_XArray_of_cuOffs ( XArray* xa )
    VG_(printf)("}");
 }
 
-void ML_(pp_TyEnt)( TyEnt* te )
+void ML_(pp_TyEnt)( const TyEnt* te )
 {
    VG_(printf)("0x%05lx  ", te->cuOff);
    switch (te->tag) {
@@ -198,7 +198,7 @@ void ML_(pp_TyEnt)( TyEnt* te )
 
 /* Print a whole XArray of TyEnts, debug-style */
 
-void ML_(pp_TyEnts)( XArray* tyents, const HChar* who )
+void ML_(pp_TyEnts)( const XArray* tyents, const HChar* who )
 {
    Word i, n;
    VG_(printf)("------ %s ------\n", who);
@@ -214,7 +214,7 @@ void ML_(pp_TyEnts)( XArray* tyents, const HChar* who )
 
 /* Print a TyEnt, C style, chasing stuff as necessary. */
 
-static void pp_TyBound_C_ishly ( XArray* tyents, UWord cuOff )
+static void pp_TyBound_C_ishly ( const XArray* tyents, UWord cuOff )
 {
    TyEnt* ent = ML_(TyEnts__index_by_cuOff)( tyents, NULL, cuOff );
    if (!ent) {
@@ -235,7 +235,7 @@ static void pp_TyBound_C_ishly ( XArray* tyents, UWord cuOff )
       ML_(pp_TyEnt)( ent );
 }
 
-void ML_(pp_TyEnt_C_ishly)( XArray* /* of TyEnt */ tyents,
+void ML_(pp_TyEnt_C_ishly)( const XArray* /* of TyEnt */ tyents,
                             UWord cuOff )
 {
    TyEnt* ent = ML_(TyEnts__index_by_cuOff)( tyents, NULL, cuOff );
@@ -337,7 +337,7 @@ void ML_(TyEntIndexCache__invalidate) ( TyEntIndexCache* cache )
    }
 }
 
-TyEnt* ML_(TyEnts__index_by_cuOff) ( XArray* /* of TyEnt */ ents,
+TyEnt* ML_(TyEnts__index_by_cuOff) ( const XArray* /* of TyEnt */ ents,
                                      TyEntIndexCache* cache,
                                      UWord cuOff_to_find )
 {
@@ -448,7 +448,7 @@ static inline Word Int__cmp ( Int a, Int b ) {
    if (a > b) return 1;
    return 0;
 }
-static Word XArray_of_UWord__cmp ( XArray* a, XArray* b ) {
+static Word XArray_of_UWord__cmp ( const XArray* a, const XArray* b ) {
    Word i, r;
    Word aN = VG_(sizeXA)( a );
    Word bN = VG_(sizeXA)( b );
@@ -461,7 +461,7 @@ static Word XArray_of_UWord__cmp ( XArray* a, XArray* b ) {
    }
    return 0;
 }
-static Word Bytevector__cmp ( UChar* a, UChar* b, Word n ) {
+static Word Bytevector__cmp ( const UChar* a, const UChar* b, Word n ) {
    Word i, r;
    vg_assert(n >= 0);
    for (i = 0; i < n; i++) {
@@ -667,7 +667,7 @@ static MaybeULong mul_MaybeULong ( MaybeULong mul1, MaybeULong mul2 ) {
    return mul1;
 }
 
-MaybeULong ML_(sizeOfType)( XArray* /* of TyEnt */ tyents,
+MaybeULong ML_(sizeOfType)( const XArray* /* of TyEnt */ tyents,
                             UWord cuOff )
 {
    Word       i;
@@ -746,7 +746,7 @@ static void copy_UWord_into_XA ( XArray* /* of HChar */ xa,
 }
 
 XArray* /*HChar*/ ML_(describe_type)( /*OUT*/PtrdiffT* residual_offset,
-                                      XArray* /* of TyEnt */ tyents,
+                                      const XArray* /* of TyEnt */ tyents,
                                       UWord ty_cuOff, 
                                       PtrdiffT offset )
 {
index 6cbc31e9094eb469b8e73dd276e0f6c9057f2442..2f02c8145a178e731948d9902133754efea31664 100644 (file)
@@ -96,7 +96,7 @@ static UInt n_supp_contexts = 0;
 
 
 /* forwards ... */
-static Supp* is_suppressible_error ( Error* err );
+static Supp* is_suppressible_error ( const Error* err );
 
 static ThreadId last_tid_printed = 1;
 
@@ -291,7 +291,7 @@ Bool VG_(showing_core_errors)(void)
 
 /* Compare errors, to detect duplicates. 
 */
-static Bool eq_Error ( VgRes res, Error* e1, Error* e2 )
+static Bool eq_Error ( VgRes res, const Error* e1, const Error* e2 )
 {
    if (e1->ekind != e2->ekind) 
       return False;
@@ -360,7 +360,7 @@ static void printSuppForIp_nonXML(UInt n, Addr ip, void* textV)
 
 /* Generate a suppression for an error, either in text or XML mode.
 */
-static void gen_suppression(Error* err)
+static void gen_suppression(const Error* err)
 {
    const HChar* name;
    ExeContext* ec;
@@ -521,7 +521,7 @@ Bool VG_(is_action_requested) ( const HChar* action, Bool* clo )
    Note this should not be called in XML mode! 
 */
 static 
-void do_actions_on_error(Error* err, Bool allow_db_attach)
+void do_actions_on_error(const Error* err, Bool allow_db_attach)
 {
    Bool still_noisy = True;
 
@@ -585,7 +585,7 @@ void do_actions_on_error(Error* err, Bool allow_db_attach)
      attach (and detach), and optionally prints a suppression; both
      of these may require user input.
 */
-static void pp_Error ( Error* err, Bool allow_db_attach, Bool xml )
+static void pp_Error ( const Error* err, Bool allow_db_attach, Bool xml )
 {
    /* If this fails, you probably specified your tool's method
       dictionary incorrectly. */
@@ -1173,7 +1173,7 @@ static Bool get_nbnc_line ( Int fd, HChar** bufpp, SizeT* nBufp, Int* lineno )
 }
 
 // True if buf starts with fun: or obj: or is ...
-static Bool is_location_line (HChar* buf)
+static Bool is_location_line (const HChar* buf)
 {
    return VG_(strncmp)(buf, "fun:", 4) == 0
       || VG_(strncmp)(buf, "obj:", 4) == 0
@@ -1213,7 +1213,7 @@ static Bool is_simple_str (const HChar *s)
    after the descriptor (fun: or obj:) part.
    Returns False if failed.
 */
-static Bool setLocationTy ( SuppLoc* p, HChar *buf )
+static Bool setLocationTy ( SuppLoc* p, const HChar *buf )
 {
    if (VG_(strncmp)(buf, "fun:", 4) == 0) {
       p->name = VG_(strdup)("errormgr.sLTy.1", buf+4);
@@ -1240,7 +1240,7 @@ static Bool setLocationTy ( SuppLoc* p, HChar *buf )
 
 
 /* Look for "tool" in a string like "tool1,tool2,tool3" */
-static Bool tool_name_present(const HChar *name, HChar *names)
+static Bool tool_name_present(const HChar *name, const HChar *names)
 {
    Bool  found;
    HChar *s = NULL;   /* Shut gcc up */
@@ -1569,7 +1569,7 @@ typedef
    }
    IPtoFunOrObjCompleter;
 
-static void pp_ip2fo (IPtoFunOrObjCompleter* ip2fo)
+static void pp_ip2fo (const IPtoFunOrObjCompleter* ip2fo)
 {
   Int i, j;
   Int o;
@@ -1597,7 +1597,7 @@ static void pp_ip2fo (IPtoFunOrObjCompleter* ip2fo)
 /* free the memory in ip2fo.
    At debuglog 4, su (or NULL) will be used to show the matching
    (or non matching) with ip2fo. */
-static void clearIPtoFunOrObjCompleter ( Supp  *su, 
+static void clearIPtoFunOrObjCompleter ( const Supp  *su, 
                                          IPtoFunOrObjCompleter* ip2fo)
 {
    if (DEBUG_ERRORMGR || VG_(debugLog_getLevel)() >= 4) {
@@ -1847,7 +1847,8 @@ static Bool supp_pattEQinp ( const void* supplocV, const void* addrV,
 
 /////////////////////////////////////////////////////
 
-static Bool supp_matches_callers(IPtoFunOrObjCompleter* ip2fo, Supp* su)
+static Bool supp_matches_callers(IPtoFunOrObjCompleter* ip2fo,
+                                 const Supp* su)
 {
    /* Unwrap the args and set up the correct parameterisation of
       VG_(generic_match), using supploc_IsStar, supploc_IsQuery and
@@ -1880,7 +1881,7 @@ static Bool supp_matches_callers(IPtoFunOrObjCompleter* ip2fo, Supp* su)
 /////////////////////////////////////////////////////
 
 static
-Bool supp_matches_error(Supp* su, Error* err)
+Bool supp_matches_error(const Supp* su, const Error* err)
 {
    switch (su->skind) {
       //(example code, see comment on CoreSuppKind above)
@@ -1905,7 +1906,7 @@ Bool supp_matches_error(Supp* su, Error* err)
    error?  If so, return a pointer to the Supp record, otherwise NULL.
    Tries to minimise the number of symbol searches since they are expensive.  
 */
-static Supp* is_suppressible_error ( Error* err )
+static Supp* is_suppressible_error ( const Error* err )
 {
    Supp* su;
    Supp* su_prev;
index 2901fd9271a472539469f0d52a06fa87c9252ebe..0ec53dec36dc9fd5193831a27af3a8728c47de3d 100644 (file)
@@ -121,7 +121,7 @@ static ULong ec_cmpAlls;
 /*--- Exported functions.                                  ---*/
 /*------------------------------------------------------------*/
 
-static ExeContext* record_ExeContext_wrk2 ( Addr* ips, UInt n_ips ); /*fwds*/
+static ExeContext* record_ExeContext_wrk2 ( const Addr* ips, UInt n_ips );
 
 /* Initialise this subsystem. */
 static void init_ExeContext_storage ( void )
@@ -203,7 +203,8 @@ void VG_(pp_ExeContext) ( ExeContext* ec )
 
 
 /* Compare two ExeContexts.  Number of callers considered depends on res. */
-Bool VG_(eq_ExeContext) ( VgRes res, ExeContext* e1, ExeContext* e2 )
+Bool VG_(eq_ExeContext) ( VgRes res, const ExeContext* e1,
+                          const ExeContext* e2 )
 {
    Int i;
 
@@ -266,7 +267,7 @@ static inline UWord ROLW ( UWord w, Int n )
    return w;
 }
 
-static UWord calc_hash ( Addr* ips, UInt n_ips, UWord htab_sz )
+static UWord calc_hash ( const Addr* ips, UInt n_ips, UWord htab_sz )
 {
    UInt  i;
    UWord hash = 0;
@@ -351,7 +352,7 @@ static ExeContext* record_ExeContext_wrk ( ThreadId tid, Word first_ip_delta,
    holds a proposed trace.  Find or allocate a suitable ExeContext.
    Note that callers must have done init_ExeContext_storage() before
    getting to this point. */
-static ExeContext* record_ExeContext_wrk2 ( Addr* ips, UInt n_ips )
+static ExeContext* record_ExeContext_wrk2 ( const Addr* ips, UInt n_ips )
 {
    Int         i;
    Bool        same;
@@ -467,12 +468,12 @@ StackTrace VG_(get_ExeContext_StackTrace) ( ExeContext* e ) {
    return e->ips;
 }  
 
-UInt VG_(get_ECU_from_ExeContext)( ExeContext* e ) {
+UInt VG_(get_ECU_from_ExeContext)( const ExeContext* e ) {
    vg_assert(VG_(is_plausible_ECU)(e->ecu));
    return e->ecu;
 }
 
-Int VG_(get_ExeContext_n_ips)( ExeContext* e ) {
+Int VG_(get_ExeContext_n_ips)( const ExeContext* e ) {
    vg_assert(e->n_ips >= 1);
    return e->n_ips;
 }
@@ -492,7 +493,7 @@ ExeContext* VG_(get_ExeContext_from_ECU)( UInt ecu )
    return NULL;
 }
 
-ExeContext* VG_(make_ExeContext_from_StackTrace)( Addr* ips, UInt n_ips )
+ExeContext* VG_(make_ExeContext_from_StackTrace)( const Addr* ips, UInt n_ips )
 {
    init_ExeContext_storage();
    return record_ExeContext_wrk2(ips, n_ips);
index f982ff96aa9a98fb3f2780aa6e650cbee528f42b..d8fe92316372f3fc8bc46c052e66df58a4c21cc3 100644 (file)
@@ -298,7 +298,7 @@ void VG_(client_exit)( Int status )
 static void show_sched_status_wrk ( Bool host_stacktrace,
                                     Bool stack_usage,
                                     Bool exited_threads,
-                                    UnwindStartRegs* startRegsIN)
+                                    const UnwindStartRegs* startRegsIN)
 {
    Int i; 
    if (host_stacktrace) {
@@ -385,7 +385,7 @@ void VG_(show_sched_status) ( Bool host_stacktrace,
 
 __attribute__ ((noreturn))
 static void report_and_quit ( const HChar* report,
-                              UnwindStartRegs* startRegsIN )
+                              const UnwindStartRegs* startRegsIN )
 {
    show_sched_status_wrk (True,  // host_stacktrace
                           False, // stack_usage
@@ -458,7 +458,7 @@ void VG_(assert_fail) ( Bool isCore, const HChar* expr, const HChar* file,
 
 __attribute__ ((noreturn))
 static void panic ( const HChar* name, const HChar* report, const HChar* str,
-                    UnwindStartRegs* startRegs )
+                    const UnwindStartRegs* startRegs )
 {
    if (VG_(clo_xml))
       VG_(printf_xml)("</valgrindoutput>\n");
@@ -466,7 +466,7 @@ static void panic ( const HChar* name, const HChar* report, const HChar* str,
    report_and_quit(report, startRegs);
 }
 
-void VG_(core_panic_at) ( const HChar* str, UnwindStartRegs* startRegs )
+void VG_(core_panic_at) ( const HChar* str, const UnwindStartRegs* startRegs )
 {
    panic("valgrind", VG_BUGS_TO, str, startRegs);
 }
index 24d06aed19972d3c4853478e972fef5e00fef5ce..38aaea955b351f1762ef2edc14234b7b0a6acfc7 100644 (file)
@@ -74,8 +74,8 @@ Bool   VG_(clo_trace_children) = False;
 const HChar* VG_(clo_trace_children_skip) = NULL;
 const HChar* VG_(clo_trace_children_skip_by_arg) = NULL;
 Bool   VG_(clo_child_silent_after_fork) = False;
-HChar* VG_(clo_log_fname_expanded) = NULL;
-HChar* VG_(clo_xml_fname_expanded) = NULL;
+const HChar* VG_(clo_log_fname_expanded) = NULL;
+const HChar* VG_(clo_xml_fname_expanded) = NULL;
 Bool   VG_(clo_time_stamp)     = False;
 Int    VG_(clo_input_fd)       = 0; /* stdin */
 Bool   VG_(clo_default_supp)   = True;
@@ -289,8 +289,8 @@ static HChar const* consume_field ( HChar const* c ) {
    of the executable.  'child_argv' must not include the name of the
    executable itself; iow child_argv[0] must be the first arg, if any,
    for the child. */
-Bool VG_(should_we_trace_this_child) ( HChar* child_exe_name,
-                                       HChar** child_argv )
+Bool VG_(should_we_trace_this_child) ( const HChar* child_exe_name,
+                                       const HChar** child_argv )
 {
    // child_exe_name is pulled out of the guest's space.  We
    // should be at least marginally cautious with it, lest it
index dcb9b83d9cadefe9e14f60a97fee400fa42cae5c..daed001c5008a8b60a1534ba5b35be34a21f9ce1 100644 (file)
@@ -57,9 +57,9 @@ struct _RangeMap {
 
 /* fwds */
 static void preen (/*MOD*/RangeMap* rm);
-static Word find ( RangeMap* rm, UWord key );
+static Word find ( const RangeMap* rm, UWord key );
 static void split_at ( /*MOD*/RangeMap* rm, UWord key );
-static void show ( RangeMap* rm );
+static void show ( const RangeMap* rm );
 
 
 RangeMap* VG_(newRangeMap) ( void*(*alloc_fn)(const HChar*,SizeT), 
@@ -114,7 +114,7 @@ void VG_(bindRangeMap) ( RangeMap* rm,
 }
 
 void VG_(lookupRangeMap) ( /*OUT*/UWord* key_min, /*OUT*/UWord* key_max,
-                           /*OUT*/UWord* val, RangeMap* rm, UWord key )
+                           /*OUT*/UWord* val, const RangeMap* rm, UWord key )
 {
    Word   i   = find(rm, key);
    Range* rng = (Range*)VG_(indexXA)(rm->ranges, i);
@@ -123,14 +123,14 @@ void VG_(lookupRangeMap) ( /*OUT*/UWord* key_min, /*OUT*/UWord* key_max,
    *val     = rng->val;
 }
 
-Word VG_(sizeRangeMap) ( RangeMap* rm )
+Word VG_(sizeRangeMap) ( const RangeMap* rm )
 {
    vg_assert(rm && rm->ranges);
    return VG_(sizeXA)(rm->ranges);
 }
 
 void VG_(indexRangeMap) ( /*OUT*/UWord* key_min, /*OUT*/UWord* key_max,
-                          /*OUT*/UWord* val, RangeMap* rm, Word ix )
+                          /*OUT*/UWord* val, const RangeMap* rm, Word ix )
 {
    vg_assert(rm && rm->ranges);
    Range* rng = (Range*)VG_(indexXA)(rm->ranges, ix);
@@ -158,7 +158,7 @@ static void preen (/*MOD*/RangeMap* rm)
    }
 }
 
-static Word find ( RangeMap* rm, UWord key )
+static Word find ( const RangeMap* rm, UWord key )
 {
    XArray* ranges = rm->ranges;
    Word    lo     = 0;
@@ -198,7 +198,7 @@ static void split_at ( /*MOD*/RangeMap* rm, UWord key )
 }
 
 __attribute__((unused))
-static void show ( RangeMap* rm )
+static void show ( const RangeMap* rm )
 {
    Word i;
    VG_(printf)("<< %ld entries:\n", VG_(sizeXA)(rm->ranges) );
index caca7c96657e79966aa120a03df432b1db06c980..07122db283a4bf266790c3eec698fa0e4d1a0a2d 100644 (file)
@@ -256,7 +256,7 @@ typedef
 typedef
    struct _TopSpec {
       struct _TopSpec* next; /* linked list */
-      DebugInfo* seginfo;    /* symbols etc */
+      const DebugInfo* seginfo;    /* symbols etc */
       Spec*      specs;      /* specs pulled out of seginfo */
       Bool       mark; /* transient temporary used during deletion */
    }
@@ -308,12 +308,12 @@ static HChar* dinfo_strdup(const HChar* ec, const HChar*);
 static Bool   is_plausible_guest_addr(Addr);
 
 static void   show_redir_state ( const HChar* who );
-static void   show_active ( const HChar* left, Active* act );
+static void   show_active ( const HChar* left, const Active* act );
 
 static void   handle_maybe_load_notifier( const HChar* soname, 
                                           const HChar* symbol, Addr addr );
 
-static void   handle_require_text_symbols ( DebugInfo* );
+static void   handle_require_text_symbols ( const DebugInfo* );
 
 /*------------------------------------------------------------*/
 /*--- NOTIFICATIONS                                        ---*/
@@ -325,7 +325,7 @@ void generate_and_add_actives (
         Spec*    specs, 
         TopSpec* parent_spec,
        /* debuginfo and the owning TopSpec */
-        DebugInfo* di,
+        const DebugInfo* di,
         TopSpec* parent_sym 
      );
 
@@ -388,7 +388,7 @@ static HChar const* advance_to_comma ( HChar const* c ) {
 
 #define N_DEMANGLED 256
 
-void VG_(redir_notify_new_DebugInfo)( DebugInfo* newdi )
+void VG_(redir_notify_new_DebugInfo)( const DebugInfo* newdi )
 {
    Bool         ok, isWrap;
    Int          i, nsyms, becTag, becPrio;
@@ -750,7 +750,7 @@ void generate_and_add_actives (
         Spec*    specs, 
         TopSpec* parent_spec,
        /* seginfo and the owning TopSpec */
-        DebugInfo* di,
+        const DebugInfo* di,
         TopSpec* parent_sym 
      )
 {
@@ -1017,7 +1017,7 @@ static void maybe_add_active ( Active act )
    simple -- just get rid of all actives derived from it, and free up
    the associated list elements. */
 
-void VG_(redir_notify_delete_DebugInfo)( DebugInfo* delsi )
+void VG_(redir_notify_delete_DebugInfo)( const DebugInfo* delsi )
 {
    TopSpec* ts;
    TopSpec* tsPrev;
@@ -1575,7 +1575,7 @@ void handle_maybe_load_notifier( const HChar* soname,
    symbols that satisfy any --require-text-symbol= specifications that
    apply to it, and abort the run with an error message if not.
 */
-static void handle_require_text_symbols ( DebugInfo* di )
+static void handle_require_text_symbols ( const DebugInfo* di )
 {
    /* First thing to do is figure out which, if any,
       --require-text-symbol specification strings apply to this
@@ -1690,7 +1690,7 @@ static void handle_require_text_symbols ( DebugInfo* di )
 /*--- SANITY/DEBUG                                         ---*/
 /*------------------------------------------------------------*/
 
-static void show_spec ( const HChar* left, Spec* spec )
+static void show_spec ( const HChar* left, const Spec* spec )
 {
    VG_(message)( Vg_DebugMsg, 
                  "%s%25s %30s %s-> (%04d.%d) 0x%08llx\n",
@@ -1701,7 +1701,7 @@ static void show_spec ( const HChar* left, Spec* spec )
                  (ULong)spec->to_addr );
 }
 
-static void show_active ( const HChar* left, Active* act )
+static void show_active ( const HChar* left, const Active* act )
 {
    Bool ok;
    HChar name1[64] = "";
index 53f9715872a8236a5ec50a0dfc3a6604e7429e78..197fff51c8cf19c2445cea60c7727561fe478123 100644 (file)
@@ -46,7 +46,7 @@
 static UInt n_profiles = 0;
 
 static 
-void show_SB_profile ( SBProfEntry tops[], UInt n_tops,
+void show_SB_profile ( const SBProfEntry tops[], UInt n_tops,
                        ULong score_total, ULong ecs_done )
 {
    ULong score_cumul, score_cumul_saved, score_here;
index be171b5f74c167a5ee35da65dfb5bce6d77fbe9b..b4fb86da748c3f8527381450fee266da709f7fa7 100644 (file)
@@ -139,7 +139,7 @@ static UInt fp_CF_verif_generation = 0;
 UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
                                /*OUT*/Addr* ips, UInt max_n_ips,
                                /*OUT*/Addr* sps, /*OUT*/Addr* fps,
-                               UnwindStartRegs* startRegs,
+                               const UnwindStartRegs* startRegs,
                                Addr fp_max_orig )
 {
    const Bool do_stats = False; // compute and output some stats regularly.
@@ -457,7 +457,7 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
 UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
                                /*OUT*/Addr* ips, UInt max_n_ips,
                                /*OUT*/Addr* sps, /*OUT*/Addr* fps,
-                               UnwindStartRegs* startRegs,
+                               const UnwindStartRegs* startRegs,
                                Addr fp_max_orig )
 {
    Bool  debug = False;
@@ -628,7 +628,7 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
 UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
                                /*OUT*/Addr* ips, UInt max_n_ips,
                                /*OUT*/Addr* sps, /*OUT*/Addr* fps,
-                               UnwindStartRegs* startRegs,
+                               const UnwindStartRegs* startRegs,
                                Addr fp_max_orig )
 {
    Bool  lr_is_first_RA = False;
@@ -898,7 +898,7 @@ static Bool looks_like_RA ( Addr ra )
 UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
                                /*OUT*/Addr* ips, UInt max_n_ips,
                                /*OUT*/Addr* sps, /*OUT*/Addr* fps,
-                               UnwindStartRegs* startRegs,
+                               const UnwindStartRegs* startRegs,
                                Addr fp_max_orig )
 {
    Bool  debug = False;
@@ -1044,7 +1044,7 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
 UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
                                /*OUT*/Addr* ips, UInt max_n_ips,
                                /*OUT*/Addr* sps, /*OUT*/Addr* fps,
-                               UnwindStartRegs* startRegs,
+                               const UnwindStartRegs* startRegs,
                                Addr fp_max_orig )
 {
    Bool  debug = False;
@@ -1140,7 +1140,7 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
 UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
                                /*OUT*/Addr* ips, UInt max_n_ips,
                                /*OUT*/Addr* sps, /*OUT*/Addr* fps,
-                               UnwindStartRegs* startRegs,
+                               const UnwindStartRegs* startRegs,
                                Addr fp_max_orig )
 {
    Bool  debug = False;
@@ -1223,7 +1223,7 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
 UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
                                /*OUT*/Addr* ips, UInt max_n_ips,
                                /*OUT*/Addr* sps, /*OUT*/Addr* fps,
-                               UnwindStartRegs* startRegs,
+                               const UnwindStartRegs* startRegs,
                                Addr fp_max_orig )
 {
    Bool  debug = False;
index 7e49124e169dbab0fb81fed3ead4ba757f4050f3..121b0644f0fed45949556c368a184ddf0349c1e0 100644 (file)
@@ -2735,7 +2735,7 @@ PRE(sys_execve)
    // Decide whether or not we want to follow along
    { // Make 'child_argv' be a pointer to the child's arg vector
      // (skipping the exe name)
-     HChar** child_argv = (HChar**)ARG2;
+     const HChar** child_argv = (const HChar**)ARG2;
      if (child_argv && child_argv[0] == NULL)
         child_argv = NULL;
      trace_this_child = VG_(should_we_trace_this_child)( (HChar*)ARG1, child_argv );
index e261ecb8ebe90b53881aecf549d6bf103bc827f6..e9cfd0260ff8f2ee45d2bfcd2899f435aab2d91d 100644 (file)
@@ -469,7 +469,7 @@ static void TTEntry__init ( TTEntry* tte )
    VG_(memset)(tte, 0, sizeof(*tte));
 }
 
-static UWord InEdgeArr__size ( InEdgeArr* iea )
+static UWord InEdgeArr__size ( const InEdgeArr* iea )
 {
    if (iea->var) {
       vg_assert(iea->n_fixed == 0);
@@ -546,7 +546,7 @@ void InEdgeArr__add ( InEdgeArr* iea, InEdge* ie )
    }
 }
 
-static UWord OutEdgeArr__size ( OutEdgeArr* oea )
+static UWord OutEdgeArr__size ( const OutEdgeArr* oea )
 {
    if (oea->var) {
       vg_assert(oea->n_fixed == 0);
@@ -680,8 +680,8 @@ Bool find_TTEntry_from_hcode( /*OUT*/UInt* from_sNo,
       if (UNLIKELY(sno == -1))
          return False; /* run out of sectors to search */
 
-      Sector* sec = &sectors[sno];
-      XArray* /* of HostExtent */ host_extents = sec->host_extents;
+      const Sector* sec = &sectors[sno];
+      const XArray* /* of HostExtent */ host_extents = sec->host_extents;
       vg_assert(host_extents);
 
       HostExtent key;
@@ -722,15 +722,15 @@ Bool find_TTEntry_from_hcode( /*OUT*/UInt* from_sNo,
 /* Figure out whether or not hcode is jitted code present in the main
    code cache (but not in the no-redir cache).  Used for sanity
    checking. */
-static Bool is_in_the_main_TC ( void* hcode )
+static Bool is_in_the_main_TC ( const void* hcode )
 {
    Int i, sno;
    for (i = 0; i < n_sectors; i++) {
       sno = sector_search_order[i];
       if (sno == -1)
          break; /* run out of sectors to search */
-      if ((UChar*)hcode >= (UChar*)sectors[sno].tc
-          && (UChar*)hcode <= (UChar*)sectors[sno].tc_next
+      if ((const UChar*)hcode >= (const UChar*)sectors[sno].tc
+          && (const UChar*)hcode <= (const UChar*)sectors[sno].tc_next
                               + sizeof(ULong) - 1)
          return True;
    }
@@ -963,8 +963,9 @@ static Int range_to_eclass ( Addr64 start, UInt len )
 
 static 
 Int vexGuestExtents_to_eclasses ( /*OUT*/Int* eclasses,
-                                  VexGuestExtents* vge )
+                                  const VexGuestExtents* vge )
 {
+
 #  define SWAP(_lv1,_lv2) \
       do { Int t = _lv1; _lv1 = _lv2; _lv2 = t; } while (0)
 
@@ -1084,7 +1085,7 @@ void upd_eclasses_after_add ( /*MOD*/Sector* sec, Int tteno )
 /* Check the eclass info in 'sec' to ensure it is consistent.  Returns
    True if OK, False if something's not right.  Expensive. */
 
-static Bool sanity_check_eclasses_in_sector ( Sector* sec )
+static Bool sanity_check_eclasses_in_sector ( const Sector* sec )
 {
 #  define BAD(_str) do { whassup = (_str); goto bad; } while (0)
 
@@ -1296,7 +1297,7 @@ static Bool sanity_check_all_sectors ( void )
 /*--- Add/find translations                                 ---*/
 /*-------------------------------------------------------------*/
 
-static UInt vge_osize ( VexGuestExtents* vge )
+static UInt vge_osize ( const VexGuestExtents* vge )
 {
    UInt i, n = 0;
    for (i = 0; i < vge->n_used; i++)
@@ -1511,7 +1512,7 @@ static void initialiseSector ( Int sno )
    pre: youngest_sector points to a valid (although possibly full)
    sector.
 */
-void VG_(add_to_transtab)( VexGuestExtents* vge,
+void VG_(add_to_transtab)( const VexGuestExtents* vge,
                            Addr64           entry,
                            AddrH            code,
                            UInt             code_len,
@@ -1769,7 +1770,7 @@ Bool overlap1 ( Addr64 s1, ULong r1, Addr64 s2, ULong r2 )
 }
 
 static inline
-Bool overlaps ( Addr64 start, ULong range, VexGuestExtents* vge )
+Bool overlaps ( Addr64 start, ULong range, const VexGuestExtents* vge )
 {
    if (overlap1(start, range, vge->base[0], (UInt)vge->len[0]))
       return True;
@@ -2104,7 +2105,7 @@ static Bool sanity_check_redir_tt_tc ( void )
 /* Add an UNREDIRECTED translation of vge to TT/TC.  The translation
    is temporarily in code[0 .. code_len-1].
 */
-void VG_(add_to_unredir_transtab)( VexGuestExtents* vge,
+void VG_(add_to_unredir_transtab)( const VexGuestExtents* vge,
                                    Addr64           entry,
                                    AddrH            code,
                                    UInt             code_len )
@@ -2318,7 +2319,7 @@ void VG_(print_tt_tc_stats) ( void )
 /*--- Printing out of profiling results.                   ---*/
 /*------------------------------------------------------------*/
 
-static ULong score ( TTEntry* tte )
+static ULong score ( const TTEntry* tte )
 {
    return ((ULong)tte->weight) * ((ULong)tte->count);
 }
index 8060e824d6ec397994d0e8574279cfbe0f5d5996..23075b853fa08a610ec320179505c57416841829 100644 (file)
@@ -214,7 +214,8 @@ extern Addr VG_(get_tocptr) ( Addr guest_code_addr );
    platforms, a symbol is deemed to be found only if it has a nonzero
    TOC pointer.  */
 extern
-Bool VG_(lookup_symbol_SLOW)(const HChar* sopatt, HChar* name, SymAVMAs* avmas);
+Bool VG_(lookup_symbol_SLOW)(const HChar* sopatt, const HChar* name,
+                             SymAVMAs* avmas);
 
 #endif   // __PUB_CORE_DEBUGINFO_H
 
index 6e1df85a906d3f4386350bd28bd459ec36d85a6f..32cfc50461031e9ea852fc156c58f10360e15c05 100644 (file)
@@ -64,7 +64,7 @@
 __attribute__ ((__noreturn__))
 extern void  VG_(core_panic)      ( const HChar* str );
 __attribute__ ((__noreturn__))
-extern void  VG_(core_panic_at)   ( const HChar* str, UnwindStartRegs* );
+extern void  VG_(core_panic_at)   ( const HChar* str, const UnwindStartRegs* );
 
 /* Exits with status as client exit code. */
 extern void VG_(client_exit)( Int status );
index 707399f8517797912af3e0e62d39f0348203edbb..cec1012f3521d0a8d9ed3c29645091c0e347f827 100644 (file)
@@ -50,7 +50,8 @@ extern Bool VG_(resolve_filename) ( Int fd, HChar** buf );
 extern Long VG_(fsize) ( Int fd );
 
 /* Lookup an extended attribute for a file */
-extern SysRes VG_(getxattr) ( const HChar* file_name, const HChar* attr_name, Addr attr_value, SizeT attr_value_len );
+extern SysRes VG_(getxattr) ( const HChar* file_name, const HChar* attr_name,
+                              Addr attr_value, SizeT attr_value_len );
 
 /* Is the file a directory? */
 extern Bool VG_(is_dir) ( const HChar* f );
index e98a88c1676cbfe206ffe5f26cf7fcb065f7e557..30457424a0dc99123246b9eab712c8c367120b89 100644 (file)
@@ -116,8 +116,8 @@ extern Bool  VG_(clo_child_silent_after_fork);
 
 /* If the user specified --log-file=STR and/or --xml-file=STR, these
    hold STR after expansion of the %p and %q templates. */
-extern HChar* VG_(clo_log_fname_expanded);
-extern HChar* VG_(clo_xml_fname_expanded);
+extern const HChar* VG_(clo_log_fname_expanded);
+extern const HChar* VG_(clo_xml_fname_expanded);
 
 /* Add timestamps to log messages?  default: NO */
 extern Bool  VG_(clo_time_stamp);
@@ -351,8 +351,8 @@ extern Bool VG_(clo_dsymutil);
    of the executable.  'child_argv' must not include the name of the
    executable itself; iow child_argv[0] must be the first arg, if any,
    for the child. */
-extern Bool VG_(should_we_trace_this_child) ( HChar* child_exe_name,
-                                              HChar** child_argv );
+extern Bool VG_(should_we_trace_this_child) ( const HChar* child_exe_name,
+                                              const HChar** child_argv );
 
 /* Whether illegal instructions should be reported/diagnosed.
    Can be explicitly set through --sigill-diagnostics otherwise
index d8325b27b71b770036a1b7c25c934819f7b62b7a..3f2541b3d24ed892e7edd46c29775313f04ff54f 100644 (file)
 //--------------------------------------------------------------------
 
 /* Notify the module of a new DebugInfo (called from m_debuginfo). */
-extern void VG_(redir_notify_new_DebugInfo)( DebugInfo* );
+extern void VG_(redir_notify_new_DebugInfo)( const DebugInfo* );
 
 /* Notify the module of the disappearance of a DebugInfo (also called
    from m_debuginfo). */
-extern void VG_(redir_notify_delete_DebugInfo)( DebugInfo* );
+extern void VG_(redir_notify_delete_DebugInfo)( const DebugInfo* );
 
 /* Initialise the module, and load initial "hardwired" redirects. */
 extern void VG_(redir_initialise)( void );
index 478e67c4c1e658eed70ebcaf5ffb0122f290e6e5..5ec37aadfd8d87bd19502610a4279392b37daaea 100644 (file)
@@ -54,7 +54,7 @@
 UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
                                /*OUT*/Addr* ips, UInt n_ips,
                                /*OUT*/Addr* sps, /*OUT*/Addr* fps,
-                               UnwindStartRegs* startRegs,
+                               const UnwindStartRegs* startRegs,
                                Addr fp_max_orig );
 
 #endif   // __PUB_CORE_STACKTRACE_H
index 6f810f84feb9cd424bb0cb98528bb5b3e0306d6a..e9e3233d07c7c453321a1e1f7cc8b3acc8b5455f 100644 (file)
@@ -78,7 +78,7 @@ extern void VG_(init_tt_tc)       ( void );
 #endif
 
 extern
-void VG_(add_to_transtab)( VexGuestExtents* vge,
+void VG_(add_to_transtab)( const VexGuestExtents* vge,
                            Addr64           entry,
                            AddrH            code,
                            UInt             code_len,
@@ -109,7 +109,7 @@ extern UInt VG_(get_bbs_translated) ( void );
    table. */
 
 extern
-void VG_(add_to_unredir_transtab)( VexGuestExtents* vge,
+void VG_(add_to_unredir_transtab)( const VexGuestExtents* vge,
                                    Addr64           entry,
                                    AddrH            code,
                                    UInt             code_len );
index 0e55042441a3176453d902c278574f864450fca5..ce2c232d327029bb4408d89e355db0d2b7f64c2a 100644 (file)
@@ -190,14 +190,14 @@ extern void VG_(clear_addrinfo) ( AddrInfo* ai);
 
 /* Prints the AddrInfo ai describing a.
    Note that an ai with tag Addr_Undescribed will cause an assert.*/
-extern void VG_(pp_addrinfo) ( Addr a, AddrInfo* ai );
+extern void VG_(pp_addrinfo) ( Addr a, const AddrInfo* ai );
 
 /* Same as VG_(pp_addrinfo) but provides some memcheck specific behaviour:
    * maybe_gcc indicates Addr a was just below the stack ptr when the error
      with a was encountered.
    * the message for Unknown tag is slightly different, as memcheck
      has a recently freed list. */
-extern void VG_(pp_addrinfo_mc) ( Addr a, AddrInfo* ai, Bool maybe_gcc );
+extern void VG_(pp_addrinfo_mc) ( Addr a, const AddrInfo* ai, Bool maybe_gcc );
 
 #endif   // __PUB_TOOL_ADDRINFO_H
 
index a78d66e441fc53f579a1af01146d741b84aaecc0..39f4a56733787c7edb482942d09d0986e52ae83d 100644 (file)
@@ -81,7 +81,8 @@ extern void VG_(apply_ExeContext)( void(*action)(UInt n, Addr ip),
 //   Vg_LowRes:  2
 //   Vg_MedRes:  4
 //   Vg_HighRes: all
-extern Bool VG_(eq_ExeContext) ( VgRes res, ExeContext* e1, ExeContext* e2 );
+extern Bool VG_(eq_ExeContext) ( VgRes res, const ExeContext* e1,
+                                 const ExeContext* e2 );
 
 // Print an ExeContext.
 extern void VG_(pp_ExeContext) ( ExeContext* ec );
@@ -90,10 +91,10 @@ extern void VG_(pp_ExeContext) ( ExeContext* ec );
 // (the "ExeContext Unique").  Guaranteed to be nonzero and to be a
 // multiple of four (iow, the lowest two bits are guaranteed to
 // be zero, so that callers can store other information there.
-extern UInt VG_(get_ECU_from_ExeContext)( ExeContext* e );
+extern UInt VG_(get_ECU_from_ExeContext)( const ExeContext* e );
 
 // How many entries (frames) in this ExeContext?
-extern Int VG_(get_ExeContext_n_ips)( ExeContext* e );
+extern Int VG_(get_ExeContext_n_ips)( const ExeContext* e );
 
 // Find the ExeContext that has the given ECU, if any.
 // NOTE: very slow.  Do not call often.
@@ -110,7 +111,7 @@ static inline Bool VG_(is_plausible_ECU)( UInt ecu ) {
 }
 
 // Make an ExeContext containing exactly the specified stack frames.
-ExeContext* VG_(make_ExeContext_from_StackTrace)( Addr* ips, UInt n_ips );
+ExeContext* VG_(make_ExeContext_from_StackTrace)( const Addr* ips, UInt n_ips );
 
 // Returns the "null" exe context. The null execontext is an artificial
 // exe context, with a stack trace made of one Addr (the NULL address).
index dba0fcfb3ef4636a26dcceb9527d72a239b15490..657fad60e6ba325125c74a8c2177604633b08cc0 100644 (file)
@@ -68,14 +68,14 @@ void VG_(bindRangeMap) ( RangeMap* rm,
    entire key space.  This is fast: O(log N) in the number of
    ranges. */
 void VG_(lookupRangeMap) ( /*OUT*/UWord* key_min, /*OUT*/UWord* key_max,
-                           /*OUT*/UWord* val, RangeMap* rm, UWord key );
+                           /*OUT*/UWord* val, const RangeMap* rm, UWord key );
 
 /* How many elements are there in the map? */
-Word VG_(sizeRangeMap) ( RangeMap* rm );
+Word VG_(sizeRangeMap) ( const RangeMap* rm );
 
 /* Get the i'th component */
 void VG_(indexRangeMap) ( /*OUT*/UWord* key_min, /*OUT*/UWord* key_max,
-                          /*OUT*/UWord* val, RangeMap* rm, Word ix );
+                          /*OUT*/UWord* val, const RangeMap* rm, Word ix );
 
 #endif   // __PUB_TOOL_RANGEMAP_H