|
From: <sv...@va...> - 2014-10-22 22:25:42
|
Author: florian
Date: Wed Oct 22 23:25:30 2014
New Revision: 14656
Log:
Constify coregrind.
Modified:
trunk/coregrind/m_addrinfo.c
trunk/coregrind/m_debugger.c
trunk/coregrind/m_debuginfo/d3basics.c
trunk/coregrind/m_debuginfo/debuginfo.c
trunk/coregrind/m_debuginfo/image.c
trunk/coregrind/m_debuginfo/misc.c
trunk/coregrind/m_debuginfo/priv_d3basics.h
trunk/coregrind/m_debuginfo/priv_image.h
trunk/coregrind/m_debuginfo/priv_misc.h
trunk/coregrind/m_debuginfo/priv_readelf.h
trunk/coregrind/m_debuginfo/priv_readpdb.h
trunk/coregrind/m_debuginfo/priv_storage.h
trunk/coregrind/m_debuginfo/priv_tytypes.h
trunk/coregrind/m_debuginfo/readdwarf.c
trunk/coregrind/m_debuginfo/readdwarf3.c
trunk/coregrind/m_debuginfo/readelf.c
trunk/coregrind/m_debuginfo/readpdb.c
trunk/coregrind/m_debuginfo/storage.c
trunk/coregrind/m_debuginfo/tytypes.c
trunk/coregrind/m_errormgr.c
trunk/coregrind/m_execontext.c
trunk/coregrind/m_libcassert.c
trunk/coregrind/m_options.c
trunk/coregrind/m_rangemap.c
trunk/coregrind/m_redir.c
trunk/coregrind/m_sbprofile.c
trunk/coregrind/m_stacktrace.c
trunk/coregrind/m_syswrap/syswrap-generic.c
trunk/coregrind/m_transtab.c
trunk/coregrind/pub_core_debuginfo.h
trunk/coregrind/pub_core_libcassert.h
trunk/coregrind/pub_core_libcfile.h
trunk/coregrind/pub_core_options.h
trunk/coregrind/pub_core_redir.h
trunk/coregrind/pub_core_stacktrace.h
trunk/coregrind/pub_core_transtab.h
trunk/include/pub_tool_addrinfo.h
trunk/include/pub_tool_execontext.h
trunk/include/pub_tool_rangemap.h
Modified: trunk/coregrind/m_addrinfo.c
==============================================================================
--- trunk/coregrind/m_addrinfo.c (original)
+++ trunk/coregrind/m_addrinfo.c Wed Oct 22 23:25:30 2014
@@ -349,7 +349,8 @@
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 @@
}
}
-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);
}
Modified: trunk/coregrind/m_debugger.c
==============================================================================
--- trunk/coregrind/m_debugger.c (original)
+++ trunk/coregrind/m_debugger.c Wed Oct 22 23:25:30 2014
@@ -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;
Modified: trunk/coregrind/m_debuginfo/d3basics.c
==============================================================================
--- trunk/coregrind/m_debuginfo/d3basics.c (original)
+++ trunk/coregrind/m_debuginfo/d3basics.c Wed Oct 22 23:25:30 2014
@@ -343,7 +343,7 @@
/* 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 @@
/* 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 @@
/* 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 @@
/* 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_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);
Modified: trunk/coregrind/m_debuginfo/debuginfo.c
==============================================================================
--- trunk/coregrind/m_debuginfo/debuginfo.c (original)
+++ trunk/coregrind/m_debuginfo/debuginfo.c Wed Oct 22 23:25:30 2014
@@ -187,7 +187,7 @@
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 @@
/* 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 @@
/* 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 @@
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 @@
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 @@
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 @@
#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 @@
/* 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 @@
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 @@
}
}
- 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 @@
"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 @@
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 @@
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 @@
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 @@
}
-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 @@
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 @@
// 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 @@
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 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 )
{
Modified: trunk/coregrind/m_debuginfo/image.c
==============================================================================
--- trunk/coregrind/m_debuginfo/image.c (original)
+++ trunk/coregrind/m_debuginfo/image.c Wed Oct 22 23:25:30 2014
@@ -104,7 +104,7 @@
}
}
-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 ULong read_ULong_le ( UChar* src )
+static ULong read_ULong_le ( const UChar* src )
{
ULong r = 0;
Int i;
@@ -168,7 +168,7 @@
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 @@
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 @@
}
/* 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 @@
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 @@
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)))
Modified: trunk/coregrind/m_debuginfo/misc.c
==============================================================================
--- trunk/coregrind/m_debuginfo/misc.c (original)
+++ trunk/coregrind/m_debuginfo/misc.c Wed Oct 22 23:25:30 2014
@@ -62,7 +62,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
}
-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 @@
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 @@
return ptr + sizeof(ULong);
}
-UChar ML_(read_UChar) ( UChar* data ) {
+UChar ML_(read_UChar) ( const UChar* data ) {
return data[0];
}
@@ -246,7 +246,7 @@
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)) {
Modified: trunk/coregrind/m_debuginfo/priv_d3basics.h
==============================================================================
--- trunk/coregrind/m_debuginfo/priv_d3basics.h (original)
+++ trunk/coregrind/m_debuginfo/priv_d3basics.h Wed Oct 22 23:25:30 2014
@@ -613,7 +613,7 @@
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 @@
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 @@
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 );
Modified: trunk/coregrind/m_debuginfo/priv_image.h
==============================================================================
--- trunk/coregrind/m_debuginfo/priv_image.h (original)
+++ trunk/coregrind/m_debuginfo/priv_image.h Wed Oct 22 23:25:30 2014
@@ -75,10 +75,10 @@
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. */
Modified: trunk/coregrind/m_debuginfo/priv_misc.h
==============================================================================
--- trunk/coregrind/m_debuginfo/priv_misc.h (original)
+++ trunk/coregrind/m_debuginfo/priv_misc.h Wed Oct 22 23:25:30 2014
@@ -43,19 +43,19 @@
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 );
Modified: trunk/coregrind/m_debuginfo/priv_readelf.h
==============================================================================
--- trunk/coregrind/m_debuginfo/priv_readelf.h (original)
+++ trunk/coregrind/m_debuginfo/priv_readelf.h Wed Oct 22 23:25:30 2014
@@ -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
Modified: trunk/coregrind/m_debuginfo/priv_readpdb.h
==============================================================================
--- trunk/coregrind/m_debuginfo/priv_readpdb.h (original)
+++ trunk/coregrind/m_debuginfo/priv_readpdb.h Wed Oct 22 23:25:30 2014
@@ -47,14 +47,14 @@
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 */
Modified: trunk/coregrind/m_debuginfo/priv_storage.h
==============================================================================
--- trunk/coregrind/m_debuginfo/priv_storage.h (original)
+++ trunk/coregrind/m_debuginfo/priv_storage.h Wed Oct 22 23:25:30 2014
@@ -439,7 +439,7 @@
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 @@
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 @@
/* 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 @@
/* 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 @@
/* 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 @@
/* 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 @@
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)
Modified: trunk/coregrind/m_debuginfo/priv_tytypes.h
==============================================================================
--- trunk/coregrind/m_debuginfo/priv_tytypes.h (original)
+++ trunk/coregrind/m_debuginfo/priv_tytypes.h Wed Oct 22 23:25:30 2014
@@ -145,16 +145,16 @@
/* 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 @@
/* 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 @@
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 );
Modified: trunk/coregrind/m_debuginfo/readdwarf.c
==============================================================================
--- trunk/coregrind/m_debuginfo/readdwarf.c (original)
+++ trunk/coregrind/m_debuginfo/readdwarf.c Wed Oct 22 23:25:30 2014
@@ -339,7 +339,7 @@
*/
static
void read_dwarf2_lineblock ( struct _DebugInfo* di,
- UnitInfo* ui,
+ const UnitInfo* ui,
DiCursor theBlock, /* IMAGE */
Int noLargerThan )
{
@@ -1898,7 +1898,7 @@
}
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 @@
}
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 @@
/* 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 @@
/*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 @@
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 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 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 @@
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 @@
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 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 @@
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 @@
/* 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 @@
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;
Modified: trunk/coregrind/m_debuginfo/readdwarf3.c
==============================================================================
--- trunk/coregrind/m_debuginfo/readdwarf3.c (original)
+++ trunk/coregrind/m_debuginfo/readdwarf3.c Wed Oct 22 23:25:30 2014
@@ -176,7 +176,7 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
/* 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 @@
/* 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 @@
}
__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 @@
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 @@
}
#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 @@
#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 @@
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 @@
/* 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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
UWord posn,
Int level,
Cursor* c_die,
- g_abbv *abbv,
+ const g_abbv *abbv,
CUConst* cc,
Bool td3
)
@@ -2324,7 +2325,7 @@
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 @@
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 @@
UWord posn,
Int level,
Cursor* c_die,
- g_abbv *abbv,
+ const g_abbv *abbv,
CUConst* cc,
Bool td3
)
@@ -2861,7 +2862,8 @@
}
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 @@
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 @@
}
/* 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 @@
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 @@
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 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 @@
#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_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 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 @@
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,
Modified: trunk/coregrind/m_debuginfo/readelf.c
==============================================================================
--- trunk/coregrind/m_debuginfo/readelf.c (original)
+++ trunk/coregrind/m_debuginfo/readelf.c Wed Oct 22 23:25:30 2014
@@ -109,9 +109,9 @@
/* 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
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 @@
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 @@
)
{
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 @@
}
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 @@
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 @@
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 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 @@
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 @@
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 @@
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 @@
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
Modified: trunk/coregrind/m_debuginfo/readpdb.c
==============================================================================
--- trunk/coregrind/m_debuginfo/readpdb.c (original)
+++ trunk/coregrind/m_debuginfo/readpdb.c Wed Oct 22 23:25:30 2014
@@ -949,7 +949,7 @@
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 @@
};
-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_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* 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_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_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 @@
}
-static DWORD pdb_get_file_size( struct pdb_rea...
[truncated message content] |