From: Florian Krohm Date: Thu, 15 Nov 2012 04:27:04 +0000 (+0000) Subject: Char/HChar fixups for m_debuginfo and m_gdbserver. X-Git-Tag: svn/VALGRIND_3_9_0~546 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=117196ac6dcd9bdea3ffc8661ec0ec491f53a559;p=thirdparty%2Fvalgrind.git Char/HChar fixups for m_debuginfo and m_gdbserver. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13122 --- diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index a795547af5..16f0cf7b0d 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -168,7 +168,7 @@ static ULong handle_counter = 1; /* Allocate and zero out a new DebugInfo record. */ static -DebugInfo* alloc_DebugInfo( const UChar* filename ) +DebugInfo* alloc_DebugInfo( const HChar* filename ) { Bool traceme; DebugInfo* di; @@ -313,7 +313,7 @@ static void discard_DebugInfo ( DebugInfo* di ) di->text_avma, di->text_avma + di->text_size, curr->fsm.filename ? curr->fsm.filename - : (UChar*)"???", + : "???", reason); vg_assert(*prev_next_ptr == curr); *prev_next_ptr = curr->next; @@ -455,7 +455,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 ( UChar* filename ) +static DebugInfo* find_or_create_DebugInfo_for ( HChar* filename ) { DebugInfo* di; vg_assert(filename); @@ -1045,8 +1045,8 @@ void VG_(di_notify_pdb_debuginfo)( Int fd_obj, Addr avma_obj, Int i, r, sz_exename; ULong obj_mtime, pdb_mtime; HChar exename[VKI_PATH_MAX]; - Char* pdbname = NULL; - Char* dot; + HChar* pdbname = NULL; + HChar* dot; SysRes sres; Int fd_pdbimage; SizeT n_pdbimage; @@ -1418,7 +1418,7 @@ static void search_all_loctabs ( Addr ptr, /*OUT*/DebugInfo** pdi, static Bool get_sym_name ( Bool do_cxx_demangling, Bool do_z_demangling, Bool do_below_main_renaming, - Addr a, Char* buf, Int nbuf, + Addr a, HChar* buf, Int nbuf, Bool match_anywhere_in_sym, Bool show_offset, Bool findText, /*OUT*/PtrdiffT* offsetP ) { @@ -1448,9 +1448,9 @@ Bool get_sym_name ( Bool do_cxx_demangling, Bool do_z_demangling, if (offsetP) *offsetP = offset; if (show_offset && offset != 0) { - Char buf2[12]; - Char* symend = buf + VG_(strlen)(buf); - Char* end = buf + nbuf; + HChar buf2[12]; + HChar* symend = buf + VG_(strlen)(buf); + HChar* end = buf + nbuf; Int len; len = VG_(sprintf)(buf2, "%c%ld", @@ -1459,7 +1459,7 @@ Bool get_sym_name ( Bool do_cxx_demangling, Bool do_z_demangling, vg_assert(len < (Int)sizeof(buf2)); if (len < (end - symend)) { - Char *cp = buf2; + HChar *cp = buf2; VG_(memcpy)(symend, cp, len+1); } } @@ -1488,7 +1488,7 @@ Addr VG_(get_tocptr) ( Addr guest_code_addr ) /* This is available to tools... always demangle C++ names, match anywhere in function, but don't show offsets. */ -Bool VG_(get_fnname) ( Addr a, Char* buf, Int nbuf ) +Bool VG_(get_fnname) ( Addr a, HChar* buf, Int nbuf ) { return get_sym_name ( /*C++-demangle*/True, /*Z-demangle*/True, /*below-main-renaming*/True, @@ -1501,7 +1501,7 @@ Bool VG_(get_fnname) ( Addr a, Char* buf, Int nbuf ) /* This is available to tools... always demangle C++ names, match anywhere in function, and show offset if nonzero. */ -Bool VG_(get_fnname_w_offset) ( Addr a, Char* buf, Int nbuf ) +Bool VG_(get_fnname_w_offset) ( Addr a, HChar* buf, Int nbuf ) { return get_sym_name ( /*C++-demangle*/True, /*Z-demangle*/True, /*below-main-renaming*/True, @@ -1515,7 +1515,7 @@ Bool VG_(get_fnname_w_offset) ( Addr a, Char* buf, Int nbuf ) /* This is available to tools... always demangle C++ names, only succeed if 'a' matches first instruction of function, and don't show offsets. */ -Bool VG_(get_fnname_if_entry) ( Addr a, Char* buf, Int nbuf ) +Bool VG_(get_fnname_if_entry) ( Addr a, HChar* buf, Int nbuf ) { return get_sym_name ( /*C++-demangle*/True, /*Z-demangle*/True, /*below-main-renaming*/True, @@ -1529,7 +1529,7 @@ Bool VG_(get_fnname_if_entry) ( Addr a, Char* buf, Int nbuf ) /* This is only available to core... don't C++-demangle, don't Z-demangle, don't rename below-main, match anywhere in function, and don't show offsets. */ -Bool VG_(get_fnname_raw) ( Addr a, Char* buf, Int nbuf ) +Bool VG_(get_fnname_raw) ( Addr a, HChar* buf, Int nbuf ) { return get_sym_name ( /*C++-demangle*/False, /*Z-demangle*/False, /*below-main-renaming*/False, @@ -1543,7 +1543,7 @@ Bool VG_(get_fnname_raw) ( Addr a, Char* buf, Int nbuf ) /* This is only available to core... don't demangle C++ names, but do do Z-demangling and below-main-renaming, match anywhere in function, and don't show offsets. */ -Bool VG_(get_fnname_no_cxx_demangle) ( Addr a, Char* buf, Int nbuf ) +Bool VG_(get_fnname_no_cxx_demangle) ( Addr a, HChar* buf, Int nbuf ) { return get_sym_name ( /*C++-demangle*/False, /*Z-demangle*/True, /*below-main-renaming*/True, @@ -1560,7 +1560,7 @@ Bool VG_(get_fnname_no_cxx_demangle) ( Addr a, Char* buf, Int nbuf ) Bool VG_(get_inst_offset_in_function)( Addr a, /*OUT*/PtrdiffT* offset ) { - Char fnname[64]; + HChar fnname[64]; return get_sym_name ( /*C++-demangle*/False, /*Z-demangle*/False, /*below-main-renaming*/False, a, fnname, 64, @@ -1570,7 +1570,7 @@ Bool VG_(get_inst_offset_in_function)( Addr a, offset ); } -Vg_FnNameKind VG_(get_fnname_kind) ( Char* name ) +Vg_FnNameKind VG_(get_fnname_kind) ( HChar* name ) { if (VG_STREQ("main", name)) { return Vg_FnNameMain; @@ -1597,7 +1597,7 @@ Vg_FnNameKind VG_(get_fnname_kind_from_IP) ( Addr ip ) { // We don't need a big buffer; all the special names are small. #define BUFLEN 50 - Char buf[50]; + HChar buf[50]; // We don't demangle, because it's faster not to, and the special names // we're looking for won't be demangled. @@ -1614,7 +1614,7 @@ Vg_FnNameKind VG_(get_fnname_kind_from_IP) ( Addr ip ) which is guaranteed to be zero terminated. Also data_addr's offset from the symbol start is put into *offset. */ Bool VG_(get_datasym_and_offset)( Addr data_addr, - /*OUT*/Char* dname, Int n_dname, + /*OUT*/HChar* dname, Int n_dname, /*OUT*/PtrdiffT* offset ) { Bool ok; @@ -1635,7 +1635,7 @@ Bool VG_(get_datasym_and_offset)( Addr data_addr, /* Map a code address to the name of a shared object file or the executable. Returns False if no idea; otherwise True. Doesn't require debug info. Caller supplies buf and nbuf. */ -Bool VG_(get_objname) ( Addr a, Char* buf, Int nbuf ) +Bool VG_(get_objname) ( Addr a, HChar* buf, Int nbuf ) { DebugInfo* di; const NSegment *seg; @@ -1687,7 +1687,7 @@ DebugInfo* VG_(find_DebugInfo) ( Addr a ) } /* Map a code address to a filename. Returns True if successful. */ -Bool VG_(get_filename)( Addr a, Char* filename, Int n_filename ) +Bool VG_(get_filename)( Addr a, HChar* filename, Int n_filename ) { DebugInfo* si; Word locno; @@ -1715,8 +1715,8 @@ Bool VG_(get_linenum)( Addr a, UInt* lineno ) See prototype for detailed description of behaviour. */ Bool VG_(get_filename_linenum) ( Addr a, - /*OUT*/Char* filename, Int n_filename, - /*OUT*/Char* dirname, Int n_dirname, + /*OUT*/HChar* filename, Int n_filename, + /*OUT*/HChar* dirname, Int n_dirname, /*OUT*/Bool* dirname_available, /*OUT*/UInt* lineno ) { @@ -1765,7 +1765,7 @@ 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)(UChar* sopatt, UChar* name, +Bool VG_(lookup_symbol_SLOW)(HChar* sopatt, HChar* name, Addr* pEnt, Addr* pToc) { Bool require_pToc = False; @@ -1784,7 +1784,7 @@ Bool VG_(lookup_symbol_SLOW)(UChar* sopatt, UChar* name, continue; } for (i = 0; i < si->symtab_used; i++) { - UChar* pri_name = si->symtab[i].pri_name; + HChar* pri_name = si->symtab[i].pri_name; tl_assert(pri_name); if (0==VG_(strcmp)(name, pri_name) && (require_pToc ? si->symtab[i].tocptr : True)) { @@ -1792,7 +1792,7 @@ Bool VG_(lookup_symbol_SLOW)(UChar* sopatt, UChar* name, *pToc = si->symtab[i].tocptr; return True; } - UChar** sec_names = si->symtab[i].sec_names; + HChar** sec_names = si->symtab[i].sec_names; if (sec_names) { tl_assert(sec_names[0]); while (*sec_names) { @@ -1817,7 +1817,7 @@ Bool VG_(lookup_symbol_SLOW)(UChar* sopatt, UChar* name, /* Copy str into buf starting at n, but not going past buf[n_buf-1] and always ensuring that buf is zero-terminated. */ -static Int putStr ( Int n, Int n_buf, Char* buf, Char* str ) +static Int putStr ( Int n, Int n_buf, HChar* buf, const HChar* str ) { vg_assert(n_buf > 0); vg_assert(n >= 0 && n < n_buf); @@ -1831,9 +1831,9 @@ static Int putStr ( Int n, Int n_buf, Char* buf, Char* str ) /* Same as putStr, but escaping chars for XML output, and also not adding more than count chars to n_buf. */ -static Int putStrEsc ( Int n, Int n_buf, Int count, Char* buf, Char* str ) +static Int putStrEsc ( Int n, Int n_buf, Int count, HChar* buf, HChar* str ) { - Char alt[2]; + HChar alt[2]; vg_assert(n_buf > 0); vg_assert(count >= 0 && count < n_buf); vg_assert(n >= 0 && n < n_buf); @@ -1872,7 +1872,7 @@ static Int putStrEsc ( Int n, Int n_buf, Int count, Char* buf, Char* str ) return n; } -Char* VG_(describe_IP)(Addr eip, Char* buf, Int n_buf) +HChar* VG_(describe_IP)(Addr eip, HChar* buf, Int n_buf) { # define APPEND(_str) \ n = putStr(n, n_buf, buf, _str) @@ -1881,13 +1881,13 @@ Char* VG_(describe_IP)(Addr eip, Char* buf, Int n_buf) # define BUF_LEN 4096 UInt lineno; - UChar ibuf[50]; + HChar ibuf[50]; Int n = 0; - static UChar buf_fn[BUF_LEN]; - static UChar buf_obj[BUF_LEN]; - static UChar buf_srcloc[BUF_LEN]; - static UChar buf_dirname[BUF_LEN]; + static HChar buf_fn[BUF_LEN]; + static HChar buf_obj[BUF_LEN]; + static HChar buf_srcloc[BUF_LEN]; + static HChar buf_dirname[BUF_LEN]; buf_fn[0] = buf_obj[0] = buf_srcloc[0] = buf_dirname[0] = 0; Bool know_dirinfo = False; @@ -1977,7 +1977,7 @@ Char* VG_(describe_IP)(Addr eip, Char* buf, Int n_buf) if (know_srcloc) { APPEND(" ("); // Get the directory name, if any, possibly pruned, into dirname. - UChar* dirname = NULL; + HChar* dirname = NULL; if (VG_(clo_n_fullpath_after) > 0) { Int i; dirname = buf_dirname; @@ -1985,8 +1985,8 @@ Char* VG_(describe_IP)(Addr eip, Char* buf, Int n_buf) // If user supplied --fullpath-after=foo, this will remove // a leading string which matches '.*foo' (not greedy). for (i = 0; i < VG_(clo_n_fullpath_after); i++) { - UChar* prefix = (UChar *)VG_(clo_fullpath_after)[i]; // FIXME - UChar* str = VG_(strstr)(dirname, prefix); + const HChar* prefix = VG_(clo_fullpath_after)[i]; + HChar* str = VG_(strstr)(dirname, prefix); if (str) { dirname = str + VG_(strlen)(prefix); break; @@ -2767,10 +2767,10 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, { Bool have_descr, have_srcloc; Bool xml = VG_(clo_xml); - UChar* vo_plural = var_offset == 1 ? "" : "s"; - UChar* ro_plural = residual_offset == 1 ? "" : "s"; - UChar* basetag = "auxwhat"; /* a constant */ - UChar tagL[32], tagR[32], xagL[32], xagR[32]; + const HChar* vo_plural = var_offset == 1 ? "" : "s"; + const HChar* ro_plural = residual_offset == 1 ? "" : "s"; + const HChar* basetag = "auxwhat"; /* a constant */ + HChar tagL[32], tagR[32], xagL[32], xagR[32]; if (frameNo < -1) { vg_assert(0); /* Not allowed */ @@ -3817,12 +3817,12 @@ SizeT VG_(DebugInfo_get_got_size)(const DebugInfo* di) return di->got_present ? di->got_size : 0; } -const UChar* VG_(DebugInfo_get_soname)(const DebugInfo* di) +const HChar* VG_(DebugInfo_get_soname)(const DebugInfo* di) { return di->soname; } -const UChar* VG_(DebugInfo_get_filename)(const DebugInfo* di) +const HChar* VG_(DebugInfo_get_filename)(const DebugInfo* di) { return di->fsm.filename; } @@ -3884,7 +3884,7 @@ const HChar* VG_(pp_SectKind)( VgSectKind kind ) characters of the object's name is put in name[0 .. n_name-2], and name[n_name-1] is set to zero (guaranteed zero terminated). */ -VgSectKind VG_(DebugInfo_sect_kind)( /*OUT*/UChar* name, SizeT n_name, +VgSectKind VG_(DebugInfo_sect_kind)( /*OUT*/HChar* name, SizeT n_name, Addr a) { DebugInfo* di; diff --git a/coregrind/m_debuginfo/misc.c b/coregrind/m_debuginfo/misc.c index a003a21052..08abfa421e 100644 --- a/coregrind/m_debuginfo/misc.c +++ b/coregrind/m_debuginfo/misc.c @@ -55,12 +55,12 @@ void ML_(dinfo_free) ( void* v ) { VG_(arena_free)( VG_AR_DINFO, v ); } -UChar* ML_(dinfo_strdup) ( const HChar* cc, const UChar* str ) { +HChar* ML_(dinfo_strdup) ( const HChar* cc, const HChar* str ) { return VG_(arena_strdup)( VG_AR_DINFO, cc, str ); } -UChar* ML_(dinfo_memdup) ( const HChar* cc, UChar* str, SizeT nStr ) { - UChar* dst = VG_(arena_malloc)( VG_AR_DINFO, cc, nStr ); +void* ML_(dinfo_memdup) ( const HChar* cc, void* str, SizeT nStr ) { + void* dst = VG_(arena_malloc)( VG_AR_DINFO, cc, nStr ); tl_assert(dst); VG_(memcpy)(dst, str, nStr); return dst; diff --git a/coregrind/m_debuginfo/priv_misc.h b/coregrind/m_debuginfo/priv_misc.h index 6c2e66c9e7..ea871dd884 100644 --- a/coregrind/m_debuginfo/priv_misc.h +++ b/coregrind/m_debuginfo/priv_misc.h @@ -40,8 +40,8 @@ /* Allocate(zeroed), free, strdup, memdup, all in VG_AR_DINFO. */ void* ML_(dinfo_zalloc)( const HChar* cc, SizeT szB ); void ML_(dinfo_free)( void* v ); -UChar* ML_(dinfo_strdup)( const HChar* cc, const UChar* str ); -UChar* ML_(dinfo_memdup)( const HChar* cc, UChar* str, SizeT nStr ); +HChar* ML_(dinfo_strdup)( const HChar* cc, const HChar* str ); +void* ML_(dinfo_memdup)( const HChar* cc, void* str, SizeT nStr ); /* Extract (possibly unaligned) data of various sizes from a buffer. */ Short ML_(read_Short)( UChar* data ); diff --git a/coregrind/m_debuginfo/priv_readdwarf.h b/coregrind/m_debuginfo/priv_readdwarf.h index 027b5ecfe2..efc56bedec 100644 --- a/coregrind/m_debuginfo/priv_readdwarf.h +++ b/coregrind/m_debuginfo/priv_readdwarf.h @@ -48,8 +48,8 @@ void ML_(read_debuginfo_dwarf3) UChar* debug_types_img, Word debug_types_sz, /* .debug_types */ UChar* debug_abbv_img, Word debug_abbv_sz, /* .debug_abbrev */ UChar* debug_line_img, Word debug_line_sz, /* .debug_line */ - UChar* debug_str_img, Word debug_str_sz, /* .debug_str */ - UChar* debug_str_alt_img, Word debug_str_alt_sz ); /* .debug_str */ + HChar* debug_str_img, Word debug_str_sz, /* .debug_str */ + HChar* debug_str_alt_img, Word debug_str_alt_sz ); /* .debug_str */ /* -------------------- DWARF1 reader diff --git a/coregrind/m_debuginfo/priv_readdwarf3.h b/coregrind/m_debuginfo/priv_readdwarf3.h index 69280ac311..cfc2895727 100644 --- a/coregrind/m_debuginfo/priv_readdwarf3.h +++ b/coregrind/m_debuginfo/priv_readdwarf3.h @@ -46,13 +46,13 @@ ML_(new_dwarf3_reader) ( UChar* debug_types_img, SizeT debug_types_sz, UChar* debug_abbv_img, SizeT debug_abbv_sz, UChar* debug_line_img, SizeT debug_line_sz, - UChar* debug_str_img, SizeT debug_str_sz, + HChar* debug_str_img, SizeT debug_str_sz, UChar* debug_ranges_img, SizeT debug_ranges_sz, UChar* debug_loc_img, SizeT debug_loc_sz, UChar* debug_info_alt_img, SizeT debug_info_alt_sz, UChar* debug_abbv_alt_img, SizeT debug_abbv_alt_sz, UChar* debug_line_alt_img, SizeT debug_line_alt_sz, - UChar* debug_str_alt_img, SizeT debug_str_alt_sz + HChar* debug_str_alt_img, SizeT debug_str_alt_sz ); #endif /* ndef __PRIV_READDWARF3_H */ diff --git a/coregrind/m_debuginfo/priv_readpdb.h b/coregrind/m_debuginfo/priv_readpdb.h index be8405a213..328e5f0ba9 100644 --- a/coregrind/m_debuginfo/priv_readpdb.h +++ b/coregrind/m_debuginfo/priv_readpdb.h @@ -44,7 +44,7 @@ extern Bool ML_(read_pdb_debug_info)( PtrdiffT obj_bias, void* pdbimage, SizeT n_pdbimage, - Char* pdbname, + HChar* pdbname, ULong pdbmtime ); diff --git a/coregrind/m_debuginfo/priv_readstabs.h b/coregrind/m_debuginfo/priv_readstabs.h index 22f3110f32..f0e657dda6 100644 --- a/coregrind/m_debuginfo/priv_readstabs.h +++ b/coregrind/m_debuginfo/priv_readstabs.h @@ -43,7 +43,7 @@ extern void ML_(read_debuginfo_stabs) ( struct _DebugInfo* di, UChar* stabC, Int stab_sz, - UChar* stabstr, Int stabstr_sz ); + HChar* stabstr, Int stabstr_sz ); #endif /* ndef __PRIV_READSTABS_H */ diff --git a/coregrind/m_debuginfo/priv_storage.h b/coregrind/m_debuginfo/priv_storage.h index 5da5f5a784..dd90f187da 100644 --- a/coregrind/m_debuginfo/priv_storage.h +++ b/coregrind/m_debuginfo/priv_storage.h @@ -66,8 +66,8 @@ typedef struct { Addr addr; /* lowest address of entity */ Addr tocptr; /* ppc64-linux only: value that R2 should have */ - UChar* pri_name; /* primary name, never NULL */ - UChar** sec_names; /* NULL, or a NULL term'd array of other names */ + HChar* pri_name; /* primary name, never NULL */ + HChar** sec_names; /* NULL, or a NULL term'd array of other names */ // XXX: this could be shrunk (on 32-bit platforms) by using 30 // bits for the size and 1 bit each for isText and isIFunc. If you // do this, make sure that all assignments to the latter two use @@ -107,9 +107,9 @@ typedef UShort size:LOC_SIZE_BITS; /* # bytes; we catch overflows of this */ UInt lineno:LINENO_BITS; /* source line number, or zero */ /* Word 3 */ - UChar* filename; /* source filename */ + const HChar* filename; /* source filename */ /* Word 4 */ - UChar* dirname; /* source directory name */ + const HChar* dirname; /* source directory name */ } DiLoc; @@ -405,11 +405,11 @@ typedef typedef struct { - UChar* name; /* in DebugInfo.strchunks */ + HChar* name; /* in DebugInfo.strchunks */ UWord typeR; /* a cuOff */ GExpr* gexpr; /* on DebugInfo.gexprs list */ GExpr* fbGX; /* SHARED. */ - UChar* fileName; /* where declared; may be NULL. in + HChar* fileName; /* where declared; may be NULL. in DebugInfo.strchunks */ Int lineNo; /* where declared; may be zero. */ } @@ -465,7 +465,7 @@ struct _DebugInfoMapping struct _DebugInfoFSM { - UChar* filename; /* in mallocville (VG_AR_DINFO) */ + HChar* filename; /* in mallocville (VG_AR_DINFO) */ 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? */ @@ -536,7 +536,7 @@ struct _DebugInfo { is, at the point where .have_dinfo is set to True). */ /* The file's soname. */ - UChar* soname; + HChar* soname; /* Description of some important mapped segments. The presence or absence of the mapping is denoted by the _present field, since @@ -775,7 +775,7 @@ struct _DebugInfo { struct strchunk { UInt strtab_used; struct strchunk* next; - UChar strtab[SEGINFO_STRCHUNKSIZE]; + HChar strtab[SEGINFO_STRCHUNKSIZE]; } *strchunks; /* Variable scope information, as harvested from Dwarf3 files. @@ -834,8 +834,8 @@ extern void ML_(addSym) ( struct _DebugInfo* di, DiSym* sym ); /* Add a line-number record to a DebugInfo. */ extern void ML_(addLineInfo) ( struct _DebugInfo* di, - UChar* filename, - UChar* dirname, /* NULL is allowable */ + const HChar* filename, + const HChar* dirname, /* NULL is allowable */ Addr this, Addr next, Int lineno, Int entry); /* Add a CFI summary record. The supplied DiCfSI is copied. */ @@ -843,17 +843,17 @@ extern void ML_(addDiCfSI) ( struct _DebugInfo* di, DiCfSI* cfsi ); /* Add a string to the string table of a DebugInfo. If len==-1, ML_(addStr) will itself measure the length of the string. */ -extern UChar* ML_(addStr) ( struct _DebugInfo* di, UChar* str, Int len ); +extern HChar* ML_(addStr) ( struct _DebugInfo* di, HChar* str, Int len ); extern void ML_(addVar)( struct _DebugInfo* di, Int level, Addr aMin, Addr aMax, - UChar* name, + HChar* name, UWord typeR, /* a cuOff */ GExpr* gexpr, GExpr* fbGX, /* SHARED. */ - UChar* fileName, /* where decl'd - may be NULL */ + HChar* fileName, /* where decl'd - may be NULL */ Int lineNo, /* where decl'd - may be zero */ Bool show ); diff --git a/coregrind/m_debuginfo/priv_tytypes.h b/coregrind/m_debuginfo/priv_tytypes.h index 26282a2962..4ed2dab001 100644 --- a/coregrind/m_debuginfo/priv_tytypes.h +++ b/coregrind/m_debuginfo/priv_tytypes.h @@ -74,12 +74,12 @@ typedef struct { } UNKNOWN; struct { - UChar* name; /* in mallocville */ + HChar* name; /* in mallocville */ Bool valueKnown; /* atoms w/ unknown value are possible */ Long value; } Atom; struct { - UChar* name; /* in mallocville */ + HChar* name; /* in mallocville */ UWord typeR; /* should be Te_TyXXXX */ union { UChar* loc; /* location expr, in mallocville */ @@ -97,7 +97,7 @@ typedef Long boundU; } Bound; struct { - UChar* name; /* in mallocville */ + HChar* name; /* in mallocville */ Int szB; UChar enc; /* S:signed U:unsigned F:floating C:complex float */ } TyBase; @@ -106,18 +106,18 @@ typedef UWord typeR; } TyPorR; struct { - UChar* name; /* in mallocville */ + HChar* name; /* in mallocville */ UWord typeR; /* MAY BE D3_INVALID_CUOFF, denoting unknown */ } TyTyDef; struct { - UChar* name; /* in mallocville */ + HChar* name; /* in mallocville */ UWord szB; XArray* /* of UWord */ fieldRs; Bool complete; Bool isStruct; } TyStOrUn; struct { - UChar* name; /* in mallocville */ + HChar* name; /* in mallocville */ Int szB; XArray* /* of UWord */ atomRs; } TyEnum; diff --git a/coregrind/m_debuginfo/readdwarf.c b/coregrind/m_debuginfo/readdwarf.c index 1ac2402ba4..7cb2380f9d 100644 --- a/coregrind/m_debuginfo/readdwarf.c +++ b/coregrind/m_debuginfo/readdwarf.c @@ -152,8 +152,8 @@ DebugLineInfo; typedef struct { /* Feel free to add more members here if you need ! */ - Char* compdir; /* Compilation directory - points to .debug_info */ - Char* name; /* Main file name - points to .debug_info */ + HChar* compdir; /* Compilation directory - points to .debug_info */ + HChar* name; /* Main file name - points to .debug_info */ ULong stmt_list; /* Offset in .debug_line */ Bool dw64; /* 64-bit Dwarf? */ } @@ -308,9 +308,9 @@ void reset_state_machine ( Int is_stmt ) /* Look up a directory name, or return NULL if unknown. */ static -Char* lookupDir ( Int filename_index, - WordArray* fnidx2dir, - WordArray* dirnames ) +HChar* lookupDir ( Int filename_index, + WordArray* fnidx2dir, + WordArray* dirnames ) { Bool inRange; Word diridx, dirname; @@ -321,7 +321,7 @@ Char* lookupDir ( Int filename_index, dirname = index_WordArray( &inRange, dirnames, (Int)diridx ); if (!inRange) goto bad; - return (Char*)dirname; + return (HChar*)dirname; bad: return NULL; } @@ -341,7 +341,7 @@ Word process_extended_line_op( struct _DebugInfo* di, UChar op_code; Int bytes_read; UInt len; - UChar* name; + HChar* name; Addr adr; len = read_leb128 (data, & bytes_read, 0); @@ -370,9 +370,9 @@ Word process_extended_line_op( struct _DebugInfo* di, if (state_machine_regs.is_stmt) { if (state_machine_regs.last_address) { Bool inRange = False; - Char* filename - = (Char*)index_WordArray( &inRange, filenames, - state_machine_regs.last_file); + HChar* filename + = (HChar*)index_WordArray( &inRange, filenames, + state_machine_regs.last_file); if (!inRange || !filename) filename = "???"; ML_(addLineInfo) ( @@ -401,7 +401,7 @@ Word process_extended_line_op( struct _DebugInfo* di, break; case DW_LNE_define_file: - name = data; + name = (HChar *)data; addto_WordArray( filenames, (Word)ML_(addStr)(di,name,-1) ); data += VG_(strlen) ((char *) data) + 1; read_leb128 (data, & bytes_read, 0); @@ -636,7 +636,7 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di, while (* data != 0) { # define NBUF 4096 - static Char buf[NBUF]; + static HChar buf[NBUF]; if (di->ddump_line) VG_(printf)(" %s\n", data); @@ -649,23 +649,23 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di, /* not an absolute path */ && ui->compdir != NULL /* actually got something sensible for compdir */ - && VG_(strlen)(ui->compdir) + VG_(strlen)(data) + 5/*paranoia*/ < NBUF + && VG_(strlen)(ui->compdir) + VG_(strlen)((HChar *)data) + 5/*paranoia*/ < NBUF /* it's short enough to concatenate */) { buf[0] = 0; VG_(strcat)(buf, ui->compdir); VG_(strcat)(buf, "/"); - VG_(strcat)(buf, data); + VG_(strcat)(buf, (HChar *)data); vg_assert(VG_(strlen)(buf) < NBUF); addto_WordArray( &dirnames, (Word)ML_(addStr)(di,buf,-1) ); if (0) VG_(printf)("rel path %s\n", buf); } else { /* just use 'data'. */ - addto_WordArray( &dirnames, (Word)ML_(addStr)(di,data,-1) ); + addto_WordArray( &dirnames, (Word)ML_(addStr)(di,(HChar *)data,-1) ); if (0) VG_(printf)("abs path %s\n", data); } - data += VG_(strlen)(data) + 1; + data += VG_(strlen)((HChar *)data) + 1; # undef NBUF } @@ -690,11 +690,11 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di, i = 1; while (* data != 0) { - UChar* name; + HChar* name; Int bytes_read, diridx; Int uu_time, uu_size; /* unused, and a guess */ - name = data; - data += VG_(strlen) ((Char *) data) + 1; + name = (HChar *)data; + data += VG_(strlen) (name) + 1; diridx = read_leb128 (data, & bytes_read, 0); data += bytes_read; @@ -762,9 +762,9 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di, /* only add a statement if there was a previous boundary */ if (state_machine_regs.last_address) { Bool inRange = False; - Char* filename - = (Char*)index_WordArray( &inRange, &filenames, - state_machine_regs.last_file); + const HChar* filename + = (HChar*)index_WordArray( &inRange, &filenames, + state_machine_regs.last_file); if (!inRange || !filename) filename = "???"; ML_(addLineInfo)( @@ -801,9 +801,9 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di, /* only add a statement if there was a previous boundary */ if (state_machine_regs.last_address) { Bool inRange = False; - Char* filename - = (Char*)index_WordArray( &inRange, &filenames, - state_machine_regs.last_file ); + const HChar* filename + = (HChar*)index_WordArray( &inRange, &filenames, + state_machine_regs.last_file ); if (!inRange || !filename) filename = "???"; ML_(addLineInfo)( @@ -985,8 +985,8 @@ static void read_unitinfo_dwarf2( /*OUT*/UnitInfo* ui, UChar* unitblock_img, UChar* debugabbrev_img, - UChar* debugstr_img, - UChar* debugstr_alt_img ) + HChar* debugstr_img, + HChar* debugstr_alt_img ) { UInt acode, abcode; ULong atoffs, blklen; @@ -1060,7 +1060,7 @@ void read_unitinfo_dwarf2( /*OUT*/UnitInfo* ui, /* Read entry definition */ UInt name, form; ULong cval = -1LL; /* Constant value read */ - Char *sval = NULL; /* String value read */ + HChar *sval = NULL; /* String value read */ name = read_leb128U( &abbrev_img ); form = read_leb128U( &abbrev_img ); if ( name == 0 ) @@ -1097,8 +1097,8 @@ void read_unitinfo_dwarf2( /*OUT*/UnitInfo* ui, sval = debugstr_img + ML_(read_ULong)(p); p += ui->dw64 ? 8 : 4; break; - case 0x08: /* FORM_string */ sval = (Char*)p; - p += VG_(strlen)((Char*)p) + 1; break; + case 0x08: /* FORM_string */ sval = (HChar*)p; + p += VG_(strlen)(sval) + 1; break; case 0x0b: /* FORM_data1 */ cval = *p; p++; break; case 0x17: /* FORM_sec_offset */if (ui->dw64) { cval = ML_(read_ULong)(p); p += 8; @@ -1179,8 +1179,8 @@ void ML_(read_debuginfo_dwarf3) UChar* debug_types_img, Word debug_types_sz, /* .debug_types */ UChar* debug_abbv_img, Word debug_abbv_sz, /* .debug_abbrev */ UChar* debug_line_img, Word debug_line_sz, /* .debug_line */ - UChar* debug_str_img, Word debug_str_sz, /* .debug_str */ - UChar* debug_str_alt_img, Word debug_str_alt_sz ) /* .debug_str */ + HChar* debug_str_img, Word debug_str_sz, /* .debug_str */ + HChar* debug_str_alt_img, Word debug_str_alt_sz ) /* .debug_str */ { UnitInfo ui; UShort ver; @@ -1415,7 +1415,7 @@ void ML_(read_debuginfo_dwarf1) ( Int die_offset, die_szb, at_offset; UShort die_kind, at_kind; UChar* at_base; - UChar* src_filename; + HChar* src_filename; if (0) VG_(printf)("read_debuginfo_dwarf1 ( %p, %d, %p, %d )\n", @@ -1478,7 +1478,7 @@ void ML_(read_debuginfo_dwarf1) ( case AT_comp_dir: /* Zero terminated string, step over it. */ if (at_kind == AT_name) - src_filename = at_base + at_offset; + src_filename = (HChar *)(at_base + at_offset); while (at_offset < die_szb-6 && at_base[at_offset] != 0) at_offset++; at_offset++; @@ -1507,7 +1507,7 @@ void ML_(read_debuginfo_dwarf1) ( */ Addr base; Int len; - Char* curr_filenm; + HChar* curr_filenm; UChar* ptr; UInt prev_line, prev_delta; @@ -3862,7 +3862,7 @@ void ML_(read_callframe_info_dwarf3) Int this_CIE; UChar cie_version; - UChar* cie_augmentation; + HChar* cie_augmentation; /* --------- CIE --------- */ if (di->trace_cfi) @@ -3900,7 +3900,7 @@ void ML_(read_callframe_info_dwarf3) goto bad; } - cie_augmentation = data; + cie_augmentation = (HChar *)data; data += 1 + VG_(strlen)(cie_augmentation); if (di->trace_cfi) VG_(printf)("cie.augment = \"%s\"\n", cie_augmentation); diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c index 38f07accc5..7e924aa067 100644 --- a/coregrind/m_debuginfo/readdwarf3.c +++ b/coregrind/m_debuginfo/readdwarf3.c @@ -217,7 +217,7 @@ static /*signed*/Word get_remaining_length_Cursor ( Cursor* c ) { return c->region_szB - c->region_next; } -static UChar* get_address_of_Cursor ( Cursor* c ) { +static void* get_address_of_Cursor ( Cursor* c ) { vg_assert(is_sane_Cursor(c)); return &c->region_start_img[ c->region_next ]; } @@ -309,9 +309,9 @@ static Long get_SLEB128 ( Cursor* c ) { the string with ML_(addStr), since (w.r.t. image overruns) the process of advancing past the terminating zero will already have "vetted" the string. */ -static UChar* get_AsciiZ ( Cursor* c ) { +static HChar* get_AsciiZ ( Cursor* c ) { UChar uc; - UChar* res = get_address_of_Cursor(c); + HChar* res = get_address_of_Cursor(c); do { uc = get_UChar(c); } while (uc != 0); return res; } @@ -402,7 +402,7 @@ typedef /* Upper bound on size thereof (an overestimate, in general) */ UWord debug_abbv_maxszB; /* Where is .debug_str ? */ - UChar* debug_str_img; + HChar* debug_str_img; UWord debug_str_sz; /* Where is .debug_ranges ? */ UChar* debug_ranges_img; @@ -423,7 +423,7 @@ typedef UChar* debug_info_alt_img; UWord debug_info_alt_sz; /* Where is alternate .debug_str ? */ - UChar* debug_str_alt_img; + HChar* debug_str_alt_img; UWord debug_str_alt_sz; /* How much to add to .debug_types resp. alternate .debug_info offsets in cook_die*. */ @@ -1176,21 +1176,21 @@ void get_Form_contents ( /*OUT*/ULong* cts, case DW_FORM_strp: { /* this is an offset into .debug_str */ - UChar* str; + HChar* str; UWord uw = (UWord)get_Dwarfish_UWord( c, cc->is_dw64 ); if (cc->debug_str_img == NULL || uw >= cc->debug_str_sz) cc->barf("get_Form_contents: DW_FORM_strp " "points outside .debug_str"); /* FIXME: check the entire string lies inside debug_str, not just the first byte of it. */ - str = (UChar*)cc->debug_str_img + uw; + str = cc->debug_str_img + uw; TRACE_D3("(indirect string, offset: 0x%lx): %s", uw, str); *cts = (ULong)(UWord)str; *ctsMemSzB = 1 + (ULong)VG_(strlen)(str); break; } case DW_FORM_string: { - UChar* str = get_AsciiZ(c); + HChar* str = get_AsciiZ(c); TRACE_D3("%s", str); *cts = (ULong)(UWord)str; /* strlen is safe because get_AsciiZ already 'vetted' the @@ -1343,14 +1343,14 @@ void get_Form_contents ( /*OUT*/ULong* cts, case DW_FORM_GNU_strp_alt: { /* this is an offset into alternate .debug_str */ - UChar* str; + HChar* str; UWord uw = (UWord)get_Dwarfish_UWord( c, cc->is_dw64 ); if (cc->debug_str_alt_img == NULL || uw >= cc->debug_str_alt_sz) cc->barf("get_Form_contents: DW_FORM_GNU_strp_alt " "points outside alternate .debug_str"); /* FIXME: check the entire string lies inside debug_str, not just the first byte of it. */ - str = (UChar*)cc->debug_str_alt_img + uw; + str = cc->debug_str_alt_img + uw; TRACE_D3("(indirect alt string, offset: 0x%lx): %s", uw, str); *cts = (ULong)(UWord)str; *ctsMemSzB = 1 + (ULong)VG_(strlen)(str); @@ -1374,7 +1374,7 @@ void get_Form_contents ( /*OUT*/ULong* cts, typedef struct _TempVar { - UChar* name; /* in DebugInfo's .strchunks */ + HChar* name; /* in DebugInfo's .strchunks */ /* Represent ranges economically. nRanges is the number of ranges. Cases: 0: .rngOneMin .rngOneMax .manyRanges are all zero @@ -1397,7 +1397,7 @@ typedef GExpr* gexpr; /* for this variable */ GExpr* fbGX; /* to find the frame base of the enclosing fn, if any */ - UChar* fName; /* declaring file name, or NULL */ + HChar* fName; /* declaring file name, or NULL */ Int fLine; /* declaring file line number, or zero */ /* offset in .debug_info, so that abstract instances can be found to satisfy references from concrete instances. */ @@ -1568,7 +1568,7 @@ void read_filename_table( /*MOD*/D3VarParser* parser, Word i; UShort version; UChar opcode_base; - UChar* str; + HChar* str; vg_assert(parser && cc && cc->barf); if ((!cc->debug_line_img) @@ -1851,14 +1851,14 @@ static void parse_var_DIE ( } if (dtag == DW_TAG_variable || dtag == DW_TAG_formal_parameter) { - UChar* name = NULL; + HChar* name = NULL; UWord typeR = D3_INVALID_CUOFF; Bool external = False; GExpr* gexpr = NULL; Int n_attrs = 0; UWord abs_ori = (UWord)D3_INVALID_CUOFF; Int lineNo = 0; - UChar* fileName = NULL; + HChar* fileName = NULL; while (True) { DW_AT attr = (DW_AT) get_ULEB128( c_abbv ); DW_FORM form = (DW_FORM)get_ULEB128( c_abbv ); @@ -1867,7 +1867,7 @@ static void parse_var_DIE ( cc, c_die, False/*td3*/, form ); n_attrs++; if (attr == DW_AT_name && ctsMemSzB > 0) { - name = ML_(addStr)( cc->di, (UChar*)(UWord)cts, -1 ); + name = ML_(addStr)( cc->di, (HChar*)(UWord)cts, -1 ); } if (attr == DW_AT_location && ((ctsMemSzB > 0 && ctsSzB == 0) @@ -1895,7 +1895,7 @@ static void parse_var_DIE ( Int ftabIx = (Int)cts; if (ftabIx >= 1 && ftabIx < VG_(sizeXA)( parser->filenameTable )) { - fileName = *(UChar**) + fileName = *(HChar**) VG_(indexXA)( parser->filenameTable, ftabIx ); vg_assert(fileName); } @@ -2367,7 +2367,7 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents, if (attr == DW_AT_name && ctsMemSzB > 0) { typeE.Te.TyBase.name = ML_(dinfo_strdup)( "di.readdwarf3.ptD.base_type.1", - (UChar*)(UWord)cts ); + (HChar*)(UWord)cts ); } if (attr == DW_AT_byte_size && ctsSzB > 0) { typeE.Te.TyBase.szB = cts; @@ -2506,7 +2506,7 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents, if (attr == DW_AT_name && ctsMemSzB > 0) { typeE.Te.TyEnum.name = ML_(dinfo_strdup)( "di.readdwarf3.pTD.enum_type.2", - (UChar*)(UWord)cts ); + (HChar*)(UWord)cts ); } if (attr == DW_AT_byte_size && ctsSzB > 0) { typeE.Te.TyEnum.szB = cts; @@ -2588,7 +2588,7 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents, if (attr == DW_AT_name && ctsMemSzB > 0) { atomE.Te.Atom.name = ML_(dinfo_strdup)( "di.readdwarf3.pTD.enumerator.1", - (UChar*)(UWord)cts ); + (HChar*)(UWord)cts ); } if (attr == DW_AT_const_value && ctsSzB > 0) { atomE.Te.Atom.value = cts; @@ -2641,7 +2641,7 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents, if (attr == DW_AT_name && ctsMemSzB > 0) { typeE.Te.TyStOrUn.name = ML_(dinfo_strdup)( "di.readdwarf3.ptD.struct_type.2", - (UChar*)(UWord)cts ); + (HChar*)(UWord)cts ); } if (attr == DW_AT_byte_size && ctsSzB >= 0) { typeE.Te.TyStOrUn.szB = cts; @@ -2711,7 +2711,7 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents, if (attr == DW_AT_name && ctsMemSzB > 0) { fieldE.Te.Field.name = ML_(dinfo_strdup)( "di.readdwarf3.ptD.member.1", - (UChar*)(UWord)cts ); + (HChar*)(UWord)cts ); } if (attr == DW_AT_type && ctsSzB > 0) { fieldE.Te.Field.typeR = cook_die_using_form( cc, (UWord)cts, form ); @@ -2915,7 +2915,7 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents, if (attr == DW_AT_name && ctsMemSzB > 0) { typeE.Te.TyTyDef.name = ML_(dinfo_strdup)( "di.readdwarf3.ptD.typedef.1", - (UChar*)(UWord)cts ); + (HChar*)(UWord)cts ); } if (attr == DW_AT_type && ctsSzB > 0) { typeE.Te.TyTyDef.typeR = cook_die_using_form( cc, (UWord)cts, @@ -3523,13 +3523,13 @@ void new_dwarf3_reader_wrk ( UChar* debug_types_img, SizeT debug_types_sz, UChar* debug_abbv_img, SizeT debug_abbv_sz, UChar* debug_line_img, SizeT debug_line_sz, - UChar* debug_str_img, SizeT debug_str_sz, + HChar* debug_str_img, SizeT debug_str_sz, UChar* debug_ranges_img, SizeT debug_ranges_sz, UChar* debug_loc_img, SizeT debug_loc_sz, UChar* debug_info_alt_img, SizeT debug_info_alt_sz, UChar* debug_abbv_alt_img, SizeT debug_abbv_alt_sz, UChar* debug_line_alt_img, SizeT debug_line_alt_sz, - UChar* debug_str_alt_img, SizeT debug_str_alt_sz + HChar* debug_str_alt_img, SizeT debug_str_alt_sz ) { XArray* /* of TyEnt */ tyents; @@ -4128,7 +4128,7 @@ void new_dwarf3_reader_wrk ( VG_(printf)("<%lx> addVar: level %d: %s :: ", varp->dioff, varp->level, - varp->name ? varp->name : (UChar*)"" ); + varp->name ? varp->name : "" ); if (varp->typeR) { ML_(pp_TyEnt_C_ishly)( tyents_to_keep, varp->typeR ); } else { @@ -4149,7 +4149,7 @@ void new_dwarf3_reader_wrk ( VG_(printf)(" FrB=none\n"); } VG_(printf)(" declared at: %s:%d\n", - varp->fName ? varp->fName : (UChar*)"NULL", + varp->fName ? varp->fName : "NULL", varp->fLine ); if (varp->absOri != (UWord)D3_INVALID_CUOFF) VG_(printf)(" abstract origin: <%lx>\n", varp->absOri); @@ -4356,13 +4356,13 @@ ML_(new_dwarf3_reader) ( UChar* debug_types_img, SizeT debug_types_sz, UChar* debug_abbv_img, SizeT debug_abbv_sz, UChar* debug_line_img, SizeT debug_line_sz, - UChar* debug_str_img, SizeT debug_str_sz, + HChar* debug_str_img, SizeT debug_str_sz, UChar* debug_ranges_img, SizeT debug_ranges_sz, UChar* debug_loc_img, SizeT debug_loc_sz, UChar* debug_info_alt_img, SizeT debug_info_alt_sz, UChar* debug_abbv_alt_img, SizeT debug_abbv_alt_sz, UChar* debug_line_alt_img, SizeT debug_line_alt_sz, - UChar* debug_str_alt_img, SizeT debug_str_alt_sz + HChar* debug_str_alt_img, SizeT debug_str_alt_sz ) { volatile Int jumped; diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c index 2d08b676be..6e022a5f4e 100644 --- a/coregrind/m_debuginfo/readelf.c +++ b/coregrind/m_debuginfo/readelf.c @@ -146,7 +146,7 @@ Bool ML_(is_elf_object_file)( void* image, SizeT n_image, Bool rel_ok ) static void show_raw_elf_symbol ( Int i, - ElfXX_Sym* sym, Char* sym_name, Addr sym_svma, + ElfXX_Sym* sym, const HChar* sym_name, Addr sym_svma, Bool ppc64_linux_format ) { HChar* space = ppc64_linux_format ? " " : ""; @@ -171,7 +171,7 @@ void show_raw_elf_symbol ( Int i, } VG_(printf)(": svma %#010lx, %ssz %4ld %s\n", sym_svma, space, sym->st_size + 0UL, - ( sym->st_name ? sym_name : (Char*)"NONAME" ) ); + ( sym->st_name ? sym_name : "NONAME" ) ); } @@ -207,13 +207,13 @@ Bool get_elf_symbol_info ( /* INPUTS */ struct _DebugInfo* di, /* containing DebugInfo */ ElfXX_Sym* sym, /* ELF symbol */ - Char* sym_name, /* name */ + HChar* sym_name, /* name */ Addr sym_svma, /* address as stated in the object file */ Bool symtab_in_debug, /* symbol table is in the debug file */ UChar* opd_img, /* oimage of .opd sec (ppc64-linux only) */ PtrdiffT opd_bias, /* for biasing AVMAs found in .opd */ /* OUTPUTS */ - Char** sym_name_out, /* name we should record */ + HChar** sym_name_out, /* name we should record */ Addr* sym_avma_out, /* addr we should record */ Int* sym_size_out, /* symbol size */ Addr* sym_tocptr_out, /* ppc64-linux only: R2 value to be @@ -613,16 +613,16 @@ Bool get_elf_symbol_info ( static __attribute__((unused)) /* not referred to on all targets */ void read_elf_symtab__normal( - struct _DebugInfo* di, UChar* tab_name, + struct _DebugInfo* di, const HChar* tab_name, ElfXX_Sym* symtab_img, SizeT symtab_szB, - UChar* strtab_img, SizeT strtab_szB, + HChar* strtab_img, SizeT strtab_szB, Bool symtab_in_debug, UChar* opd_img /* ppc64-linux only */ ) { Word i; Addr sym_svma, sym_avma_really; - Char *sym_name, *sym_name_really; + HChar *sym_name, *sym_name_really; Int sym_size; Addr sym_tocptr; Bool from_opd, is_text, is_ifunc; @@ -630,7 +630,7 @@ void read_elf_symtab__normal( ElfXX_Sym *sym; if (strtab_img == NULL || symtab_img == NULL) { - Char buf[80]; + HChar buf[80]; vg_assert(VG_(strlen)(tab_name) < 40); VG_(sprintf)(buf, " object doesn't have a %s", tab_name); ML_(symerr)(di, False, buf); @@ -644,7 +644,7 @@ void read_elf_symtab__normal( 0 always denotes 'unknown symbol'. */ for (i = 1; i < (Word)(symtab_szB/sizeof(ElfXX_Sym)); i++) { sym = & symtab_img[i]; - sym_name = (UChar*)(strtab_img + sym->st_name); + sym_name = strtab_img + sym->st_name; sym_svma = sym->st_value; if (di->trace_symtab) @@ -692,7 +692,7 @@ void read_elf_symtab__normal( typedef struct { Addr addr; - UChar* name; + HChar* name; } TempSymKey; @@ -716,9 +716,9 @@ static Word cmp_TempSymKey ( TempSymKey* key1, TempSym* elem2 ) { static __attribute__((unused)) /* not referred to on all targets */ void read_elf_symtab__ppc64_linux( - struct _DebugInfo* di, UChar* tab_name, + struct _DebugInfo* di, const HChar* tab_name, ElfXX_Sym* symtab_img, SizeT symtab_szB, - UChar* strtab_img, SizeT strtab_szB, + HChar* strtab_img, SizeT strtab_szB, Bool symtab_in_debug, UChar* opd_img /* ppc64-linux only */ ) @@ -726,7 +726,7 @@ void read_elf_symtab__ppc64_linux( Word i; Int old_size; Addr sym_svma, sym_avma_really; - Char *sym_name, *sym_name_really; + HChar *sym_name, *sym_name_really; Int sym_size; Addr sym_tocptr; Bool from_opd, modify_size, modify_tocptr, is_text, is_ifunc; @@ -738,7 +738,7 @@ void read_elf_symtab__ppc64_linux( TempSym *prev; if (strtab_img == NULL || symtab_img == NULL) { - Char buf[80]; + HChar buf[80]; vg_assert(VG_(strlen)(tab_name) < 40); VG_(sprintf)(buf, " object doesn't have a %s", tab_name); ML_(symerr)(di, False, buf); @@ -758,7 +758,7 @@ void read_elf_symtab__ppc64_linux( 0 always denotes 'unknown symbol'. */ for (i = 1; i < (Word)(symtab_szB/sizeof(ElfXX_Sym)); i++) { sym = & symtab_img[i]; - sym_name = (Char*)(strtab_img + sym->st_name); + sym_name = strtab_img + sym->st_name; sym_svma = sym->st_value; if (di->trace_symtab) @@ -902,9 +902,9 @@ void read_elf_symtab__ppc64_linux( * http://fedoraproject.org/wiki/RolandMcGrath/BuildID */ static -Char *find_buildid(Addr image, UWord n_image, Bool rel_ok) +HChar *find_buildid(Addr image, UWord n_image, Bool rel_ok) { - Char* buildid = NULL; + HChar* buildid = NULL; __attribute__((unused)) /* on Android, at least */ ElfXX_Ehdr* ehdr = (ElfXX_Ehdr*)image; @@ -922,7 +922,7 @@ Char *find_buildid(Addr image, UWord n_image, Bool rel_ok) while (offset < phdr->p_offset + phdr->p_filesz) { ElfXX_Nhdr* note = (ElfXX_Nhdr*)(image + offset); - Char* name = (Char *)note + sizeof(ElfXX_Nhdr); + HChar *name = (HChar *)note + sizeof(ElfXX_Nhdr); UChar *desc = (UChar *)name + ((note->n_namesz + 3) & ~3); Word j; @@ -956,7 +956,7 @@ Char *find_buildid(Addr image, UWord n_image, Bool rel_ok) while (offset < shdr->sh_offset + shdr->sh_size) { ElfXX_Nhdr* note = (ElfXX_Nhdr*)(image + offset); - Char* name = (Char *)note + sizeof(ElfXX_Nhdr); + HChar *name = (HChar *)note + sizeof(ElfXX_Nhdr); UChar *desc = (UChar *)name + ((note->n_namesz + 3) & ~3); Word j; @@ -1058,8 +1058,8 @@ calc_gnu_debuglink_crc32(UInt crc, const UChar *buf, Int len) * not match the value from the main object file. */ static -Addr open_debug_file( Char* name, Char* buildid, UInt crc, Bool rel_ok, - /*OUT*/UWord* size ) +Addr open_debug_file( const HChar* name, const HChar* buildid, UInt crc, + Bool rel_ok, /*OUT*/UWord* size ) { SysRes fd, sres; struct vg_stat stat_buf; @@ -1088,7 +1088,7 @@ Addr open_debug_file( Char* name, Char* buildid, UInt crc, Bool rel_ok, return 0; if (buildid) { - Char* debug_buildid = find_buildid(sr_Res(sres), *size, rel_ok); + HChar* debug_buildid = find_buildid(sr_Res(sres), *size, rel_ok); if (debug_buildid == NULL || VG_(strcmp)(buildid, debug_buildid) != 0) { SysRes res = VG_(am_munmap_valgrind)(sr_Res(sres), *size); vg_assert(!sr_isError(res)); @@ -1128,7 +1128,7 @@ Addr open_debug_file( Char* name, Char* buildid, UInt crc, Bool rel_ok, Android; does nothing on any other platform. */ static Bool find_ad_hoc_debug_image( struct _DebugInfo* di, - Char* filename, + HChar* filename, /*OUT*/Addr* dimage, /*OUT*/SizeT* n_dimage ) { @@ -1206,12 +1206,12 @@ Bool find_ad_hoc_debug_image( struct _DebugInfo* di, unchanged. The caller should set them to zero before the call. */ static void find_debug_file( struct _DebugInfo* di, - Char* objpath, Char* buildid, - Char* debugname, UInt crc, Bool rel_ok, + const HChar* objpath, const HChar* buildid, + const HChar* debugname, UInt crc, Bool rel_ok, /*OUT*/Addr* dimage, /*OUT*/SizeT* n_dimage ) { - Char* debugpath = NULL; + HChar* debugpath = NULL; Addr addr = 0; UWord size = 0; @@ -1233,8 +1233,8 @@ void find_debug_file( struct _DebugInfo* di, } if (addr == 0 && debugname != NULL && !rel_ok) { - Char *objdir = ML_(dinfo_strdup)("di.fdf.2", objpath); - Char *objdirptr; + HChar *objdir = ML_(dinfo_strdup)("di.fdf.2", objpath); + HChar *objdirptr; if ((objdirptr = VG_(strrchr)(objdir, '/')) != NULL) *objdirptr = '\0'; @@ -1358,7 +1358,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) ElfXX_Shdr* shdr_img = NULL; UWord shdr_nent = 0; UWord shdr_ent_szB = 0; - UChar* shdr_strtab_img = NULL; + HChar* shdr_strtab_img = NULL; /* SVMAs covered by rx and rw segments and corresponding biases. Normally each object would provide just one rx and one rw area, @@ -1376,7 +1376,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) XArray* /* of RangeAndBias */ svma_ranges = NULL; /* Build ID */ - Char* buildid = NULL; + HChar* buildid = NULL; vg_assert(di); vg_assert(di->fsm.have_rx_map == True); @@ -1535,8 +1535,8 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) vg_assert( ehdr_img->e_shstrndx != SHN_UNDEF ); shdr_strtab_img - = (UChar*)( ((UChar*)ehdr_img) - + shdr_img[ehdr_img->e_shstrndx].sh_offset); + = ((HChar*)ehdr_img) + + shdr_img[ehdr_img->e_shstrndx].sh_offset; if (!contained_within( oimage, n_oimage, (Addr)shdr_strtab_img, 1/*bogus, but we don't know the real size*/ )) { @@ -1630,7 +1630,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) ElfXX_Dyn* dyn_img = (ElfXX_Dyn*)( ((UChar*)ehdr_img) + phdr->p_offset); Word stroff = -1; - UChar* strtab = NULL; + HChar* strtab = NULL; for (j = 0; dyn_img[j].d_tag != DT_NULL; j++) { switch (dyn_img[j].d_tag) { case DT_SONAME: { @@ -1647,7 +1647,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) ); if (ok2 && strtab == NULL) { vg_assert(offset >= 0 && offset <= n_oimage); - strtab = ((UChar*)ehdr_img) + offset; + strtab = ((HChar*)ehdr_img) + offset; } break; } @@ -1710,7 +1710,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) /* Iterate over section headers */ for (i = 0; i < shdr_nent; i++) { ElfXX_Shdr* shdr = INDEX_BIS( shdr_img, i, shdr_ent_szB ); - UChar* name = shdr_strtab_img + shdr->sh_name; + HChar* name = shdr_strtab_img + shdr->sh_name; Addr svma = shdr->sh_addr; OffT foff = shdr->sh_offset; UWord size = shdr->sh_size; /* Do not change this to be signed. */ @@ -1932,7 +1932,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) "mapped r-x only - ignoring .bss syms\n"); VG_(message)(Vg_UserMsg, " %s\n", di->fsm.filename ? di->fsm.filename - : (UChar*)"(null?!)" ); + : "(null?!)" ); } } else @@ -2137,26 +2137,26 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) transiently loaded oimage, not in the fragments of the file mapped in by the guest's dynamic linker. */ /* TOPLEVEL */ - UChar* strtab_img = NULL; /* .strtab */ + HChar* strtab_img = NULL; /* .strtab */ ElfXX_Sym* symtab_img = NULL; /* .symtab */ - UChar* dynstr_img = NULL; /* .dynstr */ + HChar* dynstr_img = NULL; /* .dynstr */ ElfXX_Sym* dynsym_img = NULL; /* .dynsym */ - UChar* debuglink_img = NULL; /* .gnu_debuglink */ + HChar* debuglink_img = NULL; /* .gnu_debuglink */ UChar* debugaltlink_img = NULL; /* .gnu_debugaltlink */ UChar* stab_img = NULL; /* .stab (stabs) */ - UChar* stabstr_img = NULL; /* .stabstr (stabs) */ + HChar* stabstr_img = NULL; /* .stabstr (stabs) */ UChar* debug_line_img = NULL; /* .debug_line (dwarf2) */ UChar* debug_info_img = NULL; /* .debug_info (dwarf2) */ UChar* debug_types_img = NULL; /* .debug_types (dwarf4) */ UChar* debug_abbv_img = NULL; /* .debug_abbrev (dwarf2) */ - UChar* debug_str_img = NULL; /* .debug_str (dwarf2) */ + HChar* debug_str_img = NULL; /* .debug_str (dwarf2) */ UChar* debug_ranges_img = NULL; /* .debug_ranges (dwarf2) */ UChar* debug_loc_img = NULL; /* .debug_loc (dwarf2) */ UChar* debug_frame_img = NULL; /* .debug_frame (dwarf2) */ UChar* debug_line_alt_img = NULL; /* .debug_line (alternate) */ UChar* debug_info_alt_img = NULL; /* .debug_info (alternate) */ UChar* debug_abbv_alt_img = NULL; /* .debug_abbrev (alternate) */ - UChar* debug_str_alt_img = NULL; /* .debug_str (alternate) */ + HChar* debug_str_alt_img = NULL; /* .debug_str (alternate) */ UChar* dwarf1d_img = NULL; /* .debug (dwarf1) */ UChar* dwarf1l_img = NULL; /* .line (dwarf1) */ UChar* opd_img = NULL; /* .opd (dwarf2, @@ -2217,8 +2217,8 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) # define FINDX(_sec_name, _sec_size, _sec_img, _post_fx) \ do { ElfXX_Shdr* shdr \ = INDEX_BIS( shdr_img, i, shdr_ent_szB ); \ - if (0 == VG_(strcmp)(_sec_name, shdr_strtab_img \ - + shdr->sh_name)) { \ + if (0 == VG_(strcmp)(_sec_name, (HChar *)(shdr_strtab_img \ + + shdr->sh_name))) { \ Bool nobits; \ _sec_img = (void*)(oimage + shdr->sh_offset); \ _sec_size = shdr->sh_size; \ @@ -2306,7 +2306,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) vg_assert(crc_offset + sizeof(UInt) <= debuglink_sz); /* Extract the CRC from the debuglink section */ - crc = ML_(read_UInt)(debuglink_img + crc_offset); + crc = ML_(read_UInt)((UChar *)debuglink_img + crc_offset); /* See if we can find a matching debug file */ find_debug_file( di, di->fsm.filename, buildid, @@ -2439,7 +2439,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) = INDEX_BIS( shdr_dimg, i, shdr_dent_szB ); \ if (di->sec##_present \ && 0 == VG_(strcmp)("." #sec, \ - shdr_strtab_dimg + shdr->sh_name)) { \ + (HChar *)(shdr_strtab_dimg + shdr->sh_name))) { \ vg_assert(di->sec##_size == shdr->sh_size); \ vg_assert(di->sec##_avma + shdr->sh_addr + seg##_dbias); \ /* Assume we have a correct value for the main */ \ @@ -2479,7 +2479,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) = INDEX_BIS( shdr_dimg, i, shdr_dent_szB ); \ if (condition \ && 0 == VG_(strcmp)(sec_name, \ - shdr_strtab_dimg + shdr->sh_name)) { \ + (HChar *)(shdr_strtab_dimg + shdr->sh_name))) { \ Bool nobits; \ if (0 != sec_img) \ VG_(core_panic)("repeated section!\n"); \ @@ -2527,11 +2527,11 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) /* Look for alternate debug image */ if (debugaltlink_img != NULL) { - UInt buildid_offset = VG_(strlen)(debugaltlink_img)+1; + UInt buildid_offset = VG_(strlen)((HChar *)debugaltlink_img)+1; vg_assert(buildid_offset < debugaltlink_sz); - Char *altbuildid + HChar *altbuildid = ML_(dinfo_zalloc)("di.fbi.4", (debugaltlink_sz - buildid_offset) * 2 + 1); @@ -2596,7 +2596,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) do { ElfXX_Shdr* shdr \ = INDEX_BIS( shdr_aimg, i, shdr_dent_szB ); \ if (0 == VG_(strcmp)(sec_name, \ - shdr_strtab_aimg + shdr->sh_name)) { \ + (HChar *)(shdr_strtab_aimg + shdr->sh_name))) { \ if (0 != sec_img) \ VG_(core_panic)("repeated section!\n"); \ sec_img = (void*)(aimage + shdr->sh_offset); \ @@ -2626,9 +2626,9 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di ) /* Read symbols */ { - void (*read_elf_symtab)(struct _DebugInfo*,UChar*, + void (*read_elf_symtab)(struct _DebugInfo*, const HChar*, ElfXX_Sym*,SizeT, - UChar*,SizeT, + HChar*,SizeT, Bool,UChar*); Bool symtab_in_debug; # if defined(VGP_ppc64_linux) diff --git a/coregrind/m_debuginfo/readpdb.c b/coregrind/m_debuginfo/readpdb.c index a29c443a94..ada70e4320 100644 --- a/coregrind/m_debuginfo/readpdb.c +++ b/coregrind/m_debuginfo/readpdb.c @@ -1011,18 +1011,19 @@ static void* pdb_jg_read( struct pdb_reader* pdb, } -static void* find_pdb_header( UChar* pdbimage, +static void* find_pdb_header( void* pdbimage, unsigned* signature ) { - static char pdbtxt[]= "Microsoft C/C++"; - UChar* txteof = (UChar*)VG_(strchr)(pdbimage, '\032'); + static const HChar pdbtxt[]= "Microsoft C/C++"; + HChar* txteof = VG_(strchr)(pdbimage, '\032'); if (! txteof) return NULL; if (0!=VG_(strncmp)(pdbimage, pdbtxt, -1+ sizeof(pdbtxt))) return NULL; *signature = *(unsigned*)(1+ txteof); - return (void*)((~3& (3+ (4+ 1+ (txteof - pdbimage)))) + pdbimage); + HChar *img_addr = pdbimage; // so we can do address arithmetic + return ((~3& (3+ (4+ 1+ (txteof - img_addr)))) + img_addr); } @@ -1094,7 +1095,7 @@ static void pdb_ds_init( struct pdb_reader * reader, static void pdb_jg_init( struct pdb_reader* reader, - char* pdbimage, + void* pdbimage, unsigned n_pdbimage ) { reader->read_file = pdb_jg_read_file; @@ -1109,7 +1110,7 @@ static void pdb_jg_init( struct pdb_reader* reader, static -void pdb_check_root_version_and_timestamp( char* pdbname, +void pdb_check_root_version_and_timestamp( HChar* pdbname, ULong pdbmtime, unsigned version, UInt TimeDateStamp ) @@ -1209,8 +1210,8 @@ static ULong DEBUG_SnarfCodeView( { Int i, length; DiSym vsym; - UChar* nmstr; - Char symname[4096 /*WIN32_PATH_MAX*/]; + HChar* nmstr; + HChar symname[4096 /*WIN32_PATH_MAX*/]; Bool debug = di->trace_symtab; ULong n_syms_read = 0; @@ -1517,13 +1518,13 @@ static ULong DEBUG_SnarfLinetab( DebugInfo* di, PtrdiffT bias, IMAGE_SECTION_HEADER* sectp, - Char* linetab, + void* linetab, Int size ) { //VG_(printf)("DEBUG_SnarfLinetab %p %p %p %d\n", di, sectp, linetab, size); Int file_segcount; - Char filename[WIN32_PATH_MAX]; + HChar filename[WIN32_PATH_MAX]; UInt * filetab; UChar * fn; Int i; @@ -1558,19 +1559,19 @@ static ULong DEBUG_SnarfLinetab( */ nseg = 0; for (i = 0; i < nfile; i++) { - pnt2.c = linetab + filetab[i]; + pnt2.c = (HChar *)linetab + filetab[i]; nseg += *pnt2.s; } this_seg = 0; for (i = 0; i < nfile; i++) { - UChar *fnmstr; - UChar *dirstr; + HChar *fnmstr; + HChar *dirstr; /* * Get the pointer into the segment information. */ - pnt2.c = linetab + filetab[i]; + pnt2.c = (HChar *)linetab + filetab[i]; file_segcount = *pnt2.s; pnt2.ui++; @@ -1602,7 +1603,7 @@ static ULong DEBUG_SnarfLinetab( Int linecount; Int segno; - pnt2.c = linetab + lt_ptr[k]; + pnt2.c = (HChar *)linetab + lt_ptr[k]; segno = *pnt2.s++; linecount = *pnt2.s++; @@ -1687,11 +1688,11 @@ static ULong codeview_dump_linetab2( DebugInfo* di, Addr bias, IMAGE_SECTION_HEADER* sectp, - Char* linetab, + HChar* linetab, DWORD size, - Char* strimage, + HChar* strimage, DWORD strsize, - Char* pfx + const HChar* pfx ) { DWORD offset; @@ -1707,7 +1708,7 @@ static ULong codeview_dump_linetab2( offset = *((DWORD*)linetab + 1); lbh = (struct codeview_linetab2_block*)(linetab + 8 + offset); - while ((Char*)lbh < linetab + size) { + while ((HChar*)lbh < linetab + size) { HChar *filename, *dirname; Addr svma_s, svma_e; @@ -2125,7 +2126,7 @@ static void pdb_dump( struct pdb_reader* pdb, n_line2s_read += codeview_dump_linetab2( di, pe_avma, sectp_avma, - (char*)modimage + symbol_size + lineno_size, + (HChar*)modimage + symbol_size + lineno_size, total_size - (symbol_size + lineno_size), /* if filesimage is NULL, pass that directly onwards to codeview_dump_linetab2, so it knows not to @@ -2177,7 +2178,7 @@ Bool ML_(read_pdb_debug_info)( PtrdiffT obj_bias, void* pdbimage, SizeT n_pdbimage, - Char* pdbname, + HChar* pdbname, ULong pdbmtime ) { diff --git a/coregrind/m_debuginfo/readstabs.c b/coregrind/m_debuginfo/readstabs.c index d667fcee9a..86bdf44e82 100644 --- a/coregrind/m_debuginfo/readstabs.c +++ b/coregrind/m_debuginfo/readstabs.c @@ -98,14 +98,14 @@ typedef enum { N_UNDEF = 0, /* undefined symbol, new stringtab */ */ void ML_(read_debuginfo_stabs) ( DebugInfo* di, UChar* stabC, Int stab_sz, - UChar* stabstr, Int stabstr_sz ) + HChar* stabstr, Int stabstr_sz ) { const Bool debug = False; const Bool contdebug = False; Int i; Int n_stab_entries; struct nlist* stab = (struct nlist*)stabC; - UChar *next_stabstr = NULL; + HChar *next_stabstr = NULL; /* state for various things */ struct { Addr start; /* start address */ @@ -113,7 +113,7 @@ void ML_(read_debuginfo_stabs) ( DebugInfo* di, Int line; /* first line */ } func = { 0, 0, -1 }; struct { - Char *name; + HChar *name; Bool same; } file = { NULL, True }; struct { @@ -143,7 +143,7 @@ void ML_(read_debuginfo_stabs) ( DebugInfo* di, for (i = 0; i < n_stab_entries; i++) { const struct nlist *st = &stab[i]; - Char *string; + HChar *string; if (di->trace_symtab) { VG_(printf) ( "%2d type=%d othr=%d desc=%d " @@ -158,7 +158,7 @@ void ML_(read_debuginfo_stabs) ( DebugInfo* di, { Int qbuflen = 0; Int qidx = 0; - Char* qbuf = NULL; + HChar* qbuf = NULL; Int qlen; Bool qcontinuing = False; UInt qstringidx; @@ -189,7 +189,7 @@ void ML_(read_debuginfo_stabs) ( DebugInfo* di, /* XXX this is silly. The si->strtab should have a way of appending to the last added string... */ if ((qidx + qlen) >= qbuflen) { - Char *n; + HChar *n; if (qbuflen == 0) qbuflen = 16; @@ -266,7 +266,7 @@ void ML_(read_debuginfo_stabs) ( DebugInfo* di, /* FALLTHROUGH */ case N_SO: { /* new source file */ - UChar *nm = string; + HChar *nm = string; UInt len = VG_(strlen)(nm); Addr addr = func.start + st->n_value; diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c index b3186292b8..840753ef4f 100644 --- a/coregrind/m_debuginfo/storage.c +++ b/coregrind/m_debuginfo/storage.c @@ -75,7 +75,7 @@ void ML_(symerr) ( struct _DebugInfo* di, Bool serious, HChar* msg ) VG_(message)(Vg_DebugMsg, "When reading debug info from %s:\n", (di && di->fsm.filename) ? di->fsm.filename - : (UChar*)"???"); + : "???"); } VG_(message)(Vg_DebugMsg, "%s\n", msg); @@ -91,7 +91,7 @@ void ML_(symerr) ( struct _DebugInfo* di, Bool serious, HChar* msg ) /* Print a symbol. */ void ML_(ppSym) ( Int idx, DiSym* sym ) { - UChar** sec_names = sym->sec_names; + HChar** sec_names = sym->sec_names; vg_assert(sym->pri_name); if (sec_names) vg_assert(sec_names); @@ -215,11 +215,11 @@ void ML_(ppDiCfSI) ( XArray* /* of CfiExpr */ exprs, DiCfSI* si ) a chunking memory allocator rather than reallocating, so the pointers are stable. */ -UChar* ML_(addStr) ( struct _DebugInfo* di, UChar* str, Int len ) +HChar* ML_(addStr) ( struct _DebugInfo* di, HChar* str, Int len ) { struct strchunk *chunk; Int space_needed; - UChar* p; + HChar* p; if (len == -1) { len = VG_(strlen)(str); @@ -337,8 +337,8 @@ static void shrinkLocTab ( struct _DebugInfo* di ) /* Top-level place to call to add a source-location mapping entry. */ void ML_(addLineInfo) ( struct _DebugInfo* di, - UChar* filename, - UChar* dirname, /* NULL == directory is unknown */ + const HChar* filename, + const HChar* dirname, /* NULL == directory is unknown */ Addr this, Addr next, Int lineno, @@ -354,7 +354,7 @@ void ML_(addLineInfo) ( struct _DebugInfo* di, if (debug) VG_(printf)( " src %s %s line %d %#lx-%#lx\n", - dirname ? dirname : (UChar*)"(unknown)", + dirname ? dirname : "(unknown)", filename, lineno, this, next ); /* Maximum sanity checking. Some versions of GNU as do a shabby @@ -896,11 +896,11 @@ void ML_(addVar)( struct _DebugInfo* di, Int level, Addr aMin, Addr aMax, - UChar* name, /* in di's .strchunks */ + HChar* name, /* in di's .strchunks */ UWord typeR, /* a cuOff */ GExpr* gexpr, GExpr* fbGX, - UChar* fileName, /* where decl'd - may be NULL. + HChar* fileName, /* where decl'd - may be NULL. in di's .strchunks */ Int lineNo, /* where decl'd - may be zero */ Bool show ) @@ -1174,12 +1174,12 @@ static Int compare_DiSym ( void* va, void* vb ) */ static Bool preferName ( struct _DebugInfo* di, - UChar* a_name, UChar* b_name, + HChar* a_name, HChar* b_name, Addr sym_avma/*exposition only*/ ) { Word cmp; Word vlena, vlenb; /* length without version */ - const UChar *vpa, *vpb; + const HChar *vpa, *vpb; Bool preferA = False; Bool preferB = False; @@ -1233,7 +1233,7 @@ Bool preferName ( struct _DebugInfo* di, { Bool blankA = True; Bool blankB = True; - Char *s; + HChar *s; s = a_name; while (*s) { if (!VG_(isspace)(*s++)) { @@ -1317,8 +1317,8 @@ void add_DiSym_names_to_from ( DebugInfo* di, DiSym* to, DiSym* from ) vg_assert(from->pri_name); /* Figure out how many names there will be in the new combined secondary vector. */ - UChar** to_sec = to->sec_names; - UChar** from_sec = from->sec_names; + HChar** to_sec = to->sec_names; + HChar** from_sec = from->sec_names; Word n_new_sec = 1; if (from_sec) { while (*from_sec) { @@ -1336,8 +1336,8 @@ void add_DiSym_names_to_from ( DebugInfo* di, DiSym* to, DiSym* from ) TRACE_SYMTAB("merge: -> %ld\n", n_new_sec); /* Create the new sec and copy stuff into it, putting the new entries at the end. */ - UChar** new_sec = ML_(dinfo_zalloc)( "di.storage.aDntf.1", - (n_new_sec+1) * sizeof(UChar*) ); + HChar** new_sec = ML_(dinfo_zalloc)( "di.storage.aDntf.1", + (n_new_sec+1) * sizeof(HChar*) ); from_sec = from->sec_names; to_sec = to->sec_names; Word i = 0; @@ -1368,7 +1368,7 @@ static void canonicaliseSymtab ( struct _DebugInfo* di ) { Word i, j, n_truncated; Addr sta1, sta2, end1, end2, toc1, toc2; - UChar *pri1, *pri2, **sec1, **sec2; + HChar *pri1, *pri2, **sec1, **sec2; Bool ist1, ist2, isf1, isf2; # define SWAP(ty,aa,bb) \ @@ -1492,7 +1492,7 @@ static void canonicaliseSymtab ( struct _DebugInfo* di ) if (end1 > end2) { sta1 = end2 + 1; SWAP(Addr,sta1,sta2); SWAP(Addr,end1,end2); SWAP(Addr,toc1,toc2); - SWAP(UChar*,pri1,pri2); SWAP(UChar**,sec1,sec2); + SWAP(HChar*,pri1,pri2); SWAP(HChar**,sec1,sec2); SWAP(Bool,ist1,ist2); SWAP(Bool,isf1,isf2); } else if (end1 < end2) { @@ -1561,7 +1561,7 @@ static void canonicaliseSymtab ( struct _DebugInfo* di ) show the user. */ for (i = 0; i < ((Word)di->symtab_used)-1; i++) { DiSym* sym = &di->symtab[i]; - UChar** sec = sym->sec_names; + HChar** sec = sym->sec_names; if (!sec) continue; /* Slow but simple. Copy all the cands into a temp array, @@ -1569,8 +1569,8 @@ static void canonicaliseSymtab ( struct _DebugInfo* di ) Word n_tmp = 1; while (*sec) { n_tmp++; sec++; } j = 0; - UChar** tmp = ML_(dinfo_zalloc)( "di.storage.cS.1", - (n_tmp+1) * sizeof(UChar*) ); + HChar** tmp = ML_(dinfo_zalloc)( "di.storage.cS.1", + (n_tmp+1) * sizeof(HChar*) ); tmp[j++] = sym->pri_name; sec = sym->sec_names; while (*sec) { tmp[j++] = *sec; sec++; } @@ -1588,7 +1588,7 @@ static void canonicaliseSymtab ( struct _DebugInfo* di ) vg_assert(best >= 0 && best < n_tmp); /* Copy back */ sym->pri_name = tmp[best]; - UChar** cursor = sym->sec_names; + HChar** cursor = sym->sec_names; for (j = 0; j < n_tmp; j++) { if (j == best) continue; diff --git a/coregrind/m_debuginfo/tytypes.c b/coregrind/m_debuginfo/tytypes.c index d85d0ac943..95b391cd5b 100644 --- a/coregrind/m_debuginfo/tytypes.c +++ b/coregrind/m_debuginfo/tytypes.c @@ -102,12 +102,12 @@ void ML_(pp_TyEnt)( TyEnt* te ) if (te->Te.Field.nLoc == -1) VG_(printf)("Te_Field(ty=0x%05lx,pos.offset=%ld,\"%s\")", te->Te.Field.typeR, te->Te.Field.pos.offset, - te->Te.Field.name ? te->Te.Field.name : (UChar*)""); + te->Te.Field.name ? te->Te.Field.name : ""); else VG_(printf)("Te_Field(ty=0x%05lx,nLoc=%lu,pos.loc=%p,\"%s\")", te->Te.Field.typeR, te->Te.Field.nLoc, te->Te.Field.pos.loc, - te->Te.Field.name ? te->Te.Field.name : (UChar*)""); + te->Te.Field.name ? te->Te.Field.name : ""); break; case Te_Bound: VG_(printf)("Te_Bound["); @@ -126,7 +126,7 @@ void ML_(pp_TyEnt)( TyEnt* te ) VG_(printf)("Te_TyBase(%d,%c,\"%s\")", te->Te.TyBase.szB, te->Te.TyBase.enc, te->Te.TyBase.name ? te->Te.TyBase.name - : (UChar*)"(null)" ); + : "(null)" ); break; case Te_TyPtr: VG_(printf)("Te_TyPtr(%d,0x%05lx)", te->Te.TyPorR.szB, @@ -148,7 +148,7 @@ void ML_(pp_TyEnt)( TyEnt* te ) VG_(printf)("Te_TyTyDef(0x%05lx,\"%s\")", te->Te.TyTyDef.typeR, te->Te.TyTyDef.name ? te->Te.TyTyDef.name - : (UChar*)"" ); + : "" ); break; case Te_TyStOrUn: if (te->Te.TyStOrUn.complete) { @@ -157,7 +157,7 @@ void ML_(pp_TyEnt)( TyEnt* te ) te->Te.TyStOrUn.isStruct ? 'S' : 'U', te->Te.TyStOrUn.fieldRs, te->Te.TyStOrUn.name ? te->Te.TyStOrUn.name - : (UChar*)"" ); + : "" ); if (te->Te.TyStOrUn.fieldRs) pp_XArray_of_cuOffs( te->Te.TyStOrUn.fieldRs ); } else { @@ -169,7 +169,7 @@ void ML_(pp_TyEnt)( TyEnt* te ) VG_(printf)("Te_TyEnum(%d,%p,\"%s\")", te->Te.TyEnum.szB, te->Te.TyEnum.atomRs, te->Te.TyEnum.name ? te->Te.TyEnum.name - : (UChar*)"" ); + : "" ); if (te->Te.TyEnum.atomRs) pp_XArray_of_cuOffs( te->Te.TyEnum.atomRs ); break; @@ -272,7 +272,7 @@ void ML_(pp_TyEnt_C_ishly)( XArray* /* of TyEnt */ tyents, VG_(printf)("%s %s", ent->Te.TyStOrUn.isStruct ? "struct" : "union", ent->Te.TyStOrUn.name ? ent->Te.TyStOrUn.name - : (UChar*)"" ); + : "" ); break; case Te_TyArray: ML_(pp_TyEnt_C_ishly)(tyents, ent->Te.TyArray.typeR); @@ -469,7 +469,7 @@ static Word Bytevector__cmp ( UChar* a, UChar* b, Word n ) { } return 0; } -static Word Asciiz__cmp ( UChar* a, UChar* b ) { +static Word Asciiz__cmp ( const HChar* a, const HChar* b ) { /* A wrapper around strcmp that handles NULL strings safely. */ if (a == NULL && b == NULL) return 0; if (a == NULL && b != NULL) return -1; @@ -736,15 +736,15 @@ MaybeULong ML_(sizeOfType)( XArray* /* of TyEnt */ tyents, /* Describe where in the type 'offset' falls. Caller must deallocate the resulting XArray. */ -static void copy_UWord_into_XA ( XArray* /* of UChar */ xa, +static void copy_UWord_into_XA ( XArray* /* of HChar */ xa, UWord uw ) { - UChar buf[32]; + HChar buf[32]; VG_(memset)(buf, 0, sizeof(buf)); VG_(sprintf)(buf, "%lu", uw); VG_(addBytesToXA)( xa, buf, VG_(strlen)(buf)); } -XArray* /*UChar*/ ML_(describe_type)( /*OUT*/PtrdiffT* residual_offset, +XArray* /*HChar*/ ML_(describe_type)( /*OUT*/PtrdiffT* residual_offset, XArray* /* of TyEnt */ tyents, UWord ty_cuOff, PtrdiffT offset ) @@ -752,7 +752,7 @@ XArray* /*UChar*/ ML_(describe_type)( /*OUT*/PtrdiffT* residual_offset, TyEnt* ty; XArray* xa = VG_(newXA)( ML_(dinfo_zalloc), "di.tytypes.dt.1", ML_(dinfo_free), - sizeof(UChar) ); + sizeof(HChar) ); vg_assert(xa); ty = ML_(TyEnts__index_by_cuOff)(tyents, NULL, ty_cuOff); diff --git a/coregrind/m_gdbserver/m_gdbserver.c b/coregrind/m_gdbserver/m_gdbserver.c index e20dc23031..c7b77f3faf 100644 --- a/coregrind/m_gdbserver/m_gdbserver.c +++ b/coregrind/m_gdbserver/m_gdbserver.c @@ -60,7 +60,7 @@ VG_REGPARM(1) void VG_(helperc_CallDebugger) ( HWord iaddr ); VG_REGPARM(1) void VG_(helperc_invalidate_if_not_gdbserved) ( Addr addr ); -static void invalidate_current_ip (ThreadId tid, char *who); +static void invalidate_current_ip (ThreadId tid, const HChar *who); /* reasons of call to call_gdbserver. */ typedef @@ -74,7 +74,7 @@ typedef exit_reason} // process terminated CallReason; -static char* ppCallReason(CallReason reason) +static const HChar* ppCallReason(CallReason reason) { switch (reason) { case init_reason: return "init_reason"; @@ -138,9 +138,9 @@ static void call_gdbserver ( ThreadId tid , CallReason reason); /* Describes the address addr (for debugging/printing purposes). Last two results are kept. A third call will replace the oldest result. */ -static char* sym (Addr addr, Bool is_code) +static HChar* sym (Addr addr, Bool is_code) { - static char buf[2][200]; + static HChar buf[2][200]; static int w = 0; PtrdiffT offset; if (w == 2) w = 0; @@ -209,7 +209,7 @@ static Addr HT_addr ( Addr addr ) #endif } -static void add_gs_address (Addr addr, GS_Kind kind, char* from) +static void add_gs_address (Addr addr, GS_Kind kind, const HChar* from) { GS_Address *p; @@ -223,7 +223,7 @@ static void add_gs_address (Addr addr, GS_Kind kind, char* from) VG_(discard_translations) (addr, 2, from); } -static void remove_gs_address (GS_Address* g, char* from) +static void remove_gs_address (GS_Address* g, const HChar* from) { VG_(HT_remove) (gs_addresses, g->addr); // See add_gs_address for the explanation for the range 2 below. @@ -231,7 +231,7 @@ static void remove_gs_address (GS_Address* g, char* from) VG_(arena_free) (VG_AR_CORE, g); } -char* VG_(ppPointKind) (PointKind kind) +const HChar* VG_(ppPointKind) (PointKind kind) { switch(kind) { case software_breakpoint: return "software_breakpoint"; @@ -563,14 +563,14 @@ static void clear_watched_addresses(void) gs_watches = NULL; } -static void invalidate_if_jump_not_yet_gdbserved (Addr addr, char* from) +static void invalidate_if_jump_not_yet_gdbserved (Addr addr, const HChar* from) { if (VG_(HT_lookup) (gs_addresses, (UWord)HT_addr(addr))) return; add_gs_address (addr, GS_jump, from); } -static void invalidate_current_ip (ThreadId tid, char *who) +static void invalidate_current_ip (ThreadId tid, const HChar *who) { invalidate_if_jump_not_yet_gdbserved (VG_(get_IP) (tid), who); } @@ -1045,7 +1045,7 @@ static void VG_(add_stmt_call_invalidate_if_not_gdbserved) { void* fn; - HChar* nm; + const HChar* nm; IRExpr** args; Int nargs; IRDirty* di; @@ -1084,7 +1084,7 @@ static void VG_(add_stmt_call_gdbserver) IRSB* irsb) /* irsb block to which call is added */ { void* fn; - HChar* nm; + const HChar* nm; IRExpr** args; Int nargs; IRDirty* di; @@ -1233,7 +1233,7 @@ IRSB* VG_(instrument_for_gdbserver_if_needed) } struct mon_out_buf { - char buf[DATASIZ+1]; + HChar buf[DATASIZ+1]; int next; UInt ret; }; @@ -1269,14 +1269,14 @@ UInt VG_(gdb_printf) ( const HChar *format, ... ) return b.ret; } -Int VG_(keyword_id) (Char* keywords, Char* input_word, kwd_report_error report) +Int VG_(keyword_id) (HChar* keywords, HChar* input_word, kwd_report_error report) { const Int il = (input_word == NULL ? 0 : VG_(strlen) (input_word)); HChar iw[il+1]; HChar kwds[VG_(strlen)(keywords)+1]; HChar *kwdssaveptr; - Char* kw; /* current keyword, its length, its position */ + HChar* kw; /* current keyword, its length, its position */ Int kwl; Int kpos = -1; @@ -1299,7 +1299,7 @@ Int VG_(keyword_id) (Char* keywords, Char* input_word, kwd_report_error report) VG_(strcpy) (kwds, keywords); if (pass == 1) VG_(gdb_printf) ("%s can match", - (il == 0 ? "" : (char *) iw)); + (il == 0 ? "" : iw)); for (kw = VG_(strtok_r) (kwds, " ", &kwdssaveptr); kw != NULL; kw = VG_(strtok_r) (NULL, " ", &kwdssaveptr)) { @@ -1358,7 +1358,7 @@ Int VG_(keyword_id) (Char* keywords, Char* input_word, kwd_report_error report) } /* True if string can be a 0x number */ -static Bool is_zero_x (Char *s) +static Bool is_zero_x (const HChar *s) { if (strlen (s) >= 3 && s[0] == '0' && s[1] == 'x') return True; @@ -1367,7 +1367,7 @@ static Bool is_zero_x (Char *s) } /* True if string can be a 0b number */ -static Bool is_zero_b (Char *s) +static Bool is_zero_b (const HChar *s) { if (strlen (s) >= 3 && s[0] == '0' && s[1] == 'b') return True; @@ -1399,7 +1399,7 @@ void VG_(strtok_get_address_and_size) (Addr* address, *szB = VG_(strtoull16) (ws, &endptr); } else if (is_zero_b (ws)) { Int j; - Char *parsews = ws; + HChar *parsews = ws; Int n_bits = VG_(strlen) (ws) - 2; *szB = 0; ws = NULL; // assume the below loop gives a correct nr. diff --git a/coregrind/m_gdbserver/server.c b/coregrind/m_gdbserver/server.c index 5dcb139d5e..1d6ff8a6c0 100644 --- a/coregrind/m_gdbserver/server.c +++ b/coregrind/m_gdbserver/server.c @@ -599,7 +599,7 @@ void handle_query (char *arg_own_buf, int *new_packet_len_p) } VG_(lseek) (fd, ofs, VKI_SEEK_SET); len_read = VG_(read) (fd, toread, len); - *new_packet_len_p = write_qxfer_response (arg_own_buf, toread, + *new_packet_len_p = write_qxfer_response (arg_own_buf, (unsigned char *)toread, len_read, ofs + len_read < doc_len); VG_(close) (fd); return; diff --git a/coregrind/m_gdbserver/valgrind-low-arm.c b/coregrind/m_gdbserver/valgrind-low-arm.c index a3ea36f57a..e7ac5f079f 100644 --- a/coregrind/m_gdbserver/valgrind-low-arm.c +++ b/coregrind/m_gdbserver/valgrind-low-arm.c @@ -144,7 +144,7 @@ Addr thumb_pc (Addr pc) // pc aligned on 4 bytes. We need to use debug info. { - Char fnname[200]; // ??? max size + HChar fnname[200]; // ??? max size Addr entrypoint; Addr ptoc; // unused but needed. // If this is a thumb instruction, we need to ask diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 196ee3f745..2df0aa0a32 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -650,7 +650,7 @@ getsockdetails(Int fd) struct vki_sockaddr_in in; struct vki_sockaddr_un un; } laddr; - UInt llen; + Int llen; llen = sizeof(laddr); VG_(memset)(&laddr, 0, llen); @@ -661,7 +661,7 @@ getsockdetails(Int fd) static char lname[32]; static char pname[32]; struct vki_sockaddr_in paddr; - UInt plen = sizeof(struct vki_sockaddr_in); + Int plen = sizeof(struct vki_sockaddr_in); if (VG_(getpeername)(fd, (struct vki_sockaddr *)&paddr, &plen) != -1) { VG_(message)(Vg_UserMsg, "Open AF_INET socket %d: %s <-> %s\n", fd, @@ -703,7 +703,7 @@ void VG_(show_open_fds) (const HChar* when) i->pathname); } else { Int val; - UInt len = sizeof(val); + Int len = sizeof(val); if (VG_(getsockopt)(i->fd, VKI_SOL_SOCKET, VKI_SO_TYPE, &val, &len) == -1) { diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 7c94bd57fe..a906f7cd2b 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -516,7 +516,7 @@ PRE(sys_mount) // by 'data'. *flags |= SfMayBlock; PRINT("sys_mount( %#lx(%s), %#lx(%s), %#lx(%s), %#lx, %#lx )", - ARG1,(Char*)ARG1, ARG2,(Char*)ARG2, ARG3,(Char*)ARG3, ARG4, ARG5); + ARG1,(HChar*)ARG1, ARG2,(HChar*)ARG2, ARG3,(HChar*)ARG3, ARG4, ARG5); PRE_REG_READ5(long, "mount", char *, source, char *, target, char *, type, unsigned long, flags, void *, data); @@ -1867,7 +1867,7 @@ POST(sys_mq_open) SET_STATUS_Failure( VKI_EMFILE ); } else { if (VG_(clo_track_fds)) - ML_(record_fd_open_with_given_name)(tid, RES, (Char*)ARG1); + ML_(record_fd_open_with_given_name)(tid, RES, (HChar*)ARG1); } } @@ -3806,8 +3806,8 @@ PRE(sys_openat) VG_(sprintf)(name, "/proc/%d/cmdline", VG_(getpid)()); if (ML_(safe_to_deref)( (void*)ARG2, 1 ) - && (VG_(strcmp)((Char *)ARG2, name) == 0 - || VG_(strcmp)((Char *)ARG2, "/proc/self/cmdline") == 0)) { + && (VG_(strcmp)((HChar *)ARG2, name) == 0 + || VG_(strcmp)((HChar *)ARG2, "/proc/self/cmdline") == 0)) { sres = VG_(dup)( VG_(cl_cmdline_fd) ); SET_STATUS_from_SysRes( sres ); if (!sr_isError(sres)) { @@ -3822,8 +3822,8 @@ PRE(sys_openat) VG_(sprintf)(name, "/proc/%d/auxv", VG_(getpid)()); if (ML_(safe_to_deref)( (void*)ARG2, 1 ) - && (VG_(strcmp)((Char *)ARG2, name) == 0 - || VG_(strcmp)((Char *)ARG2, "/proc/self/auxv") == 0)) { + && (VG_(strcmp)((HChar *)ARG2, name) == 0 + || VG_(strcmp)((HChar *)ARG2, "/proc/self/auxv") == 0)) { sres = VG_(dup)( VG_(cl_auxv_fd) ); SET_STATUS_from_SysRes( sres ); if (!sr_isError(sres)) { @@ -3846,7 +3846,7 @@ POST(sys_openat) SET_STATUS_Failure( VKI_EMFILE ); } else { if (VG_(clo_track_fds)) - ML_(record_fd_open_with_given_name)(tid, RES, (Char*)ARG2); + ML_(record_fd_open_with_given_name)(tid, RES, (HChar*)ARG2); } } @@ -3970,8 +3970,8 @@ PRE(sys_readlinkat) */ VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)()); if (ML_(safe_to_deref)((void*)ARG2, 1) - && (VG_(strcmp)((Char *)ARG2, name) == 0 - || VG_(strcmp)((Char *)ARG2, "/proc/self/exe") == 0)) { + && (VG_(strcmp)((HChar *)ARG2, name) == 0 + || VG_(strcmp)((HChar *)ARG2, "/proc/self/exe") == 0)) { VG_(sprintf)(name, "/proc/self/fd/%d", VG_(cl_exec_fd)); SET_STATUS_from_SysRes( VG_(do_syscall4)(saved, ARG1, (UWord)name, ARG3, ARG4)); diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c index 7173a06d00..3f84b7fb00 100644 --- a/coregrind/m_transtab.c +++ b/coregrind/m_transtab.c @@ -1815,7 +1815,7 @@ Bool delete_translations_in_sector ( /*MOD*/Sector* sec, UInt secNo, void VG_(discard_translations) ( Addr64 guest_start, ULong range, - HChar* who ) + const HChar* who ) { Sector* sec; Int sno, ec; diff --git a/coregrind/pub_core_debuginfo.h b/coregrind/pub_core_debuginfo.h index a74cd363b6..732fbb37f9 100644 --- a/coregrind/pub_core_debuginfo.h +++ b/coregrind/pub_core_debuginfo.h @@ -86,12 +86,12 @@ extern void VG_(di_discard_ALL_debuginfo)( void ); * It should only be used in cases where the names of interest will have * particular (ie. non-mangled) forms, or the mangled form is acceptable. */ extern -Bool VG_(get_fnname_raw) ( Addr a, Char* buf, Int nbuf ); +Bool VG_(get_fnname_raw) ( Addr a, HChar* buf, Int nbuf ); /* Like VG_(get_fnname), but without C++ demangling. (But it does * Z-demangling and below-main renaming.) */ extern -Bool VG_(get_fnname_no_cxx_demangle) ( Addr a, Char* buf, Int nbuf ); +Bool VG_(get_fnname_no_cxx_demangle) ( Addr a, HChar* buf, Int nbuf ); /* mips-linux only: find the offset of current address. This is needed for stack unwinding for MIPS. @@ -153,7 +153,7 @@ 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)(UChar* sopatt, UChar* name, Addr* pEnt, Addr* pToc); +Bool VG_(lookup_symbol_SLOW)(HChar* sopatt, HChar* name, Addr* pEnt, Addr* pToc); #endif // __PUB_CORE_DEBUGINFO_H diff --git a/coregrind/pub_core_transtab.h b/coregrind/pub_core_transtab.h index 61e7e8c98e..d3b97a37fc 100644 --- a/coregrind/pub_core_transtab.h +++ b/coregrind/pub_core_transtab.h @@ -78,7 +78,7 @@ extern Bool VG_(search_transtab) ( /*OUT*/AddrH* res_hcode, Bool upd_cache ); extern void VG_(discard_translations) ( Addr64 start, ULong range, - HChar* who ); + const HChar* who ); extern void VG_(print_tt_tc_stats) ( void ); diff --git a/include/pub_tool_debuginfo.h b/include/pub_tool_debuginfo.h index e35af22a9a..2875282856 100644 --- a/include/pub_tool_debuginfo.h +++ b/include/pub_tool_debuginfo.h @@ -41,11 +41,11 @@ returns False and nothing is copied. VG_(get_fnname) always demangles C++ function names. VG_(get_fnname_w_offset) is the same, except it appends "+N" to symbol names to indicate offsets. */ -extern Bool VG_(get_filename) ( Addr a, Char* filename, Int n_filename ); -extern Bool VG_(get_fnname) ( Addr a, Char* fnname, Int n_fnname ); +extern Bool VG_(get_filename) ( Addr a, HChar* filename, Int n_filename ); +extern Bool VG_(get_fnname) ( Addr a, HChar* fnname, Int n_fnname ); extern Bool VG_(get_linenum) ( Addr a, UInt* linenum ); extern Bool VG_(get_fnname_w_offset) - ( Addr a, Char* fnname, Int n_fnname ); + ( Addr a, HChar* fnname, Int n_fnname ); /* This one is the most general. It gives filename, line number and optionally directory name. filename and linenum may not be NULL. @@ -60,8 +60,8 @@ extern Bool VG_(get_fnname_w_offset) found. */ extern Bool VG_(get_filename_linenum) ( Addr a, - /*OUT*/Char* filename, Int n_filename, - /*OUT*/Char* dirname, Int n_dirname, + /*OUT*/HChar* filename, Int n_filename, + /*OUT*/HChar* dirname, Int n_dirname, /*OUT*/Bool* dirname_available, /*OUT*/UInt* linenum ); @@ -72,7 +72,7 @@ extern Bool VG_(get_filename_linenum) a particular function. Nb: if an executable/shared object is stripped of its symbols, this function will not be able to recognise function entry points within it. */ -extern Bool VG_(get_fnname_if_entry) ( Addr a, Char* fnname, Int n_fnname ); +extern Bool VG_(get_fnname_if_entry) ( Addr a, HChar* fnname, Int n_fnname ); typedef enum { @@ -82,7 +82,7 @@ typedef } Vg_FnNameKind; // Such names are often filtered. /* Indicates what kind of fnname it is. */ -extern Vg_FnNameKind VG_(get_fnname_kind) ( Char* name ); +extern Vg_FnNameKind VG_(get_fnname_kind) ( HChar* name ); /* Like VG_(get_fnname_kind), but takes a code address. */ extern Vg_FnNameKind VG_(get_fnname_kind_from_IP) ( Addr ip ); @@ -92,7 +92,7 @@ extern Vg_FnNameKind VG_(get_fnname_kind_from_IP) ( Addr ip ); which is guaranteed to be zero terminated. Also data_addr's offset from the symbol start is put into *offset. */ extern Bool VG_(get_datasym_and_offset)( Addr data_addr, - /*OUT*/Char* dname, Int n_dname, + /*OUT*/HChar* dname, Int n_dname, /*OUT*/PtrdiffT* offset ); /* Try to form some description of DATA_ADDR by looking at the DWARF3 @@ -116,7 +116,7 @@ Bool VG_(get_data_description)( /* Succeeds if the address is within a shared object or the main executable. It doesn't matter if debug info is present or not. */ -extern Bool VG_(get_objname) ( Addr a, Char* objname, Int n_objname ); +extern Bool VG_(get_objname) ( Addr a, HChar* objname, Int n_objname ); /* Puts into 'buf' info about the code address %eip: the address, function name (if known) and filename/line number (if known), like this: @@ -125,7 +125,7 @@ extern Bool VG_(get_objname) ( Addr a, Char* objname, Int n_objname ); 'n_buf' gives length of 'buf'. Returns 'buf'. */ -extern Char* VG_(describe_IP)(Addr eip, Char* buf, Int n_buf); +extern HChar* VG_(describe_IP)(Addr eip, HChar* buf, Int n_buf); /* Get an XArray of StackBlock which describe the stack (auto) blocks @@ -190,8 +190,8 @@ Addr VG_(DebugInfo_get_gotplt_avma) ( const DebugInfo *di ); SizeT VG_(DebugInfo_get_gotplt_size) ( const DebugInfo *di ); Addr VG_(DebugInfo_get_got_avma) ( const DebugInfo *di ); SizeT VG_(DebugInfo_get_got_size) ( const DebugInfo *di ); -const UChar* VG_(DebugInfo_get_soname) ( const DebugInfo *di ); -const UChar* VG_(DebugInfo_get_filename) ( const DebugInfo *di ); +const HChar* VG_(DebugInfo_get_soname) ( const DebugInfo *di ); +const HChar* VG_(DebugInfo_get_filename) ( const DebugInfo *di ); PtrdiffT VG_(DebugInfo_get_text_bias) ( const DebugInfo *di ); /* Function for traversing the DebugInfo list. When called with NULL @@ -244,7 +244,7 @@ const HChar* VG_(pp_SectKind)( VgSectKind kind ); it comes from. If name is non-NULL, then the last n_name-1 characters of the object's name is put in name[0 .. n_name-2], and name[n_name-1] is set to zero (guaranteed zero terminated). */ -VgSectKind VG_(DebugInfo_sect_kind)( /*OUT*/UChar* name, SizeT n_name, +VgSectKind VG_(DebugInfo_sect_kind)( /*OUT*/HChar* name, SizeT n_name, Addr a); diff --git a/include/pub_tool_gdbserver.h b/include/pub_tool_gdbserver.h index 03a43b4f73..d6fe139abf 100644 --- a/include/pub_tool_gdbserver.h +++ b/include/pub_tool_gdbserver.h @@ -94,7 +94,7 @@ typedef write_watchpoint, read_watchpoint, access_watchpoint } PointKind; -extern char* VG_(ppPointKind) (PointKind kind); +extern const HChar* VG_(ppPointKind) (PointKind kind); /* watchpoint support --------------------------------------*/ @@ -160,7 +160,7 @@ typedef kwd_report_none, kwd_report_all, kwd_report_duplicated_matches } kwd_report_error; -extern Int VG_(keyword_id) (Char* keywords, Char* input_word, +extern Int VG_(keyword_id) (HChar* keywords, HChar* input_word, kwd_report_error report); /* Extract an address and (optionally) a size from the string