From: Florian Krohm Date: Sat, 10 Nov 2012 22:29:54 +0000 (+0000) Subject: Fix more Char/HChar mixups. Closing in... X-Git-Tag: svn/VALGRIND_3_9_0~549 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0aa69c33104d7523310566f45ff53d658ee769e;p=thirdparty%2Fvalgrind.git Fix more Char/HChar mixups. Closing in... git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13119 --- diff --git a/cachegrind/cg-arch.c b/cachegrind/cg-arch.c index f66a83c53c..da20441c65 100644 --- a/cachegrind/cg-arch.c +++ b/cachegrind/cg-arch.c @@ -76,10 +76,11 @@ static const HChar* check_cache(cache_t* cache) } -static void parse_cache_opt ( cache_t* cache, Char* opt, Char* optval ) +static void parse_cache_opt ( cache_t* cache, const HChar* opt, + const HChar* optval ) { Long i1, i2, i3; - Char* endptr; + HChar* endptr; const HChar* checkRes; // Option argument looks like "65536,2,64". Extract them. @@ -112,12 +113,12 @@ static void parse_cache_opt ( cache_t* cache, Char* opt, Char* optval ) } -Bool VG_(str_clo_cache_opt)(Char *arg, +Bool VG_(str_clo_cache_opt)(const HChar *arg, cache_t* clo_I1c, cache_t* clo_D1c, cache_t* clo_LLc) { - Char* tmp_str; + const HChar* tmp_str; if VG_STR_CLO(arg, "--I1", tmp_str) { parse_cache_opt(clo_I1c, arg, tmp_str); diff --git a/cachegrind/cg_arch.h b/cachegrind/cg_arch.h index d35ec73bd9..cd0b74ffff 100644 --- a/cachegrind/cg_arch.h +++ b/cachegrind/cg_arch.h @@ -47,7 +47,7 @@ typedef struct { // If arg is a command line option configuring I1 or D1 or LL cache, // then parses arg to set the relevant cache_t elements. // Returns True if arg is a cache command line option, False otherwise. -Bool VG_(str_clo_cache_opt)(Char *arg, +Bool VG_(str_clo_cache_opt)(const HChar *arg, cache_t* clo_I1c, cache_t* clo_D1c, cache_t* clo_LLc); diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c index f4d94f8c32..8cd633f976 100644 --- a/cachegrind/cg_main.c +++ b/cachegrind/cg_main.c @@ -67,7 +67,7 @@ static Bool clo_cache_sim = True; /* do cache simulation? */ static Bool clo_branch_sim = False; /* do branch simulation? */ -static HChar* clo_cachegrind_out_file = "cachegrind.out.%p"; +static const HChar* clo_cachegrind_out_file = "cachegrind.out.%p"; /*------------------------------------------------------------*/ /*--- Cachesim configuration ---*/ @@ -102,9 +102,9 @@ typedef // - Traversed for dumping stats at end in file/func/line hierarchy. typedef struct { - Char* file; - Char* fn; - Int line; + HChar* file; + HChar* fn; + Int line; } CodeLoc; @@ -191,18 +191,18 @@ static Int no_debugs = 0; static Word stringCmp( const void* key, const void* elem ) { - return VG_(strcmp)(*(Char**)key, *(Char**)elem); + return VG_(strcmp)(*(HChar**)key, *(HChar**)elem); } // Get a permanent string; either pull it out of the string table if it's // been encountered before, or dup it and put it into the string table. -static Char* get_perm_string(Char* s) +static HChar* get_perm_string(HChar* s) { - Char** s_ptr = VG_(OSetGen_Lookup)(stringTable, &s); + HChar** s_ptr = VG_(OSetGen_Lookup)(stringTable, &s); if (s_ptr) { return *s_ptr; } else { - Char** s_node = VG_(OSetGen_AllocNode)(stringTable, sizeof(Char*)); + HChar** s_node = VG_(OSetGen_AllocNode)(stringTable, sizeof(HChar*)); *s_node = VG_(strdup)("cg.main.gps.1", s); VG_(OSetGen_Insert)(stringTable, s_node); return *s_node; @@ -213,10 +213,10 @@ static Char* get_perm_string(Char* s) /*--- CC table operations ---*/ /*------------------------------------------------------------*/ -static void get_debug_info(Addr instr_addr, Char file[FILE_LEN], - Char fn[FN_LEN], Int* line) +static void get_debug_info(Addr instr_addr, HChar file[FILE_LEN], + HChar fn[FN_LEN], UInt* line) { - Char dir[FILE_LEN]; + HChar dir[FILE_LEN]; Bool found_dirname; Bool found_file_line = VG_(get_filename_linenum)( instr_addr, @@ -255,8 +255,8 @@ static void get_debug_info(Addr instr_addr, Char file[FILE_LEN], // Returns a pointer to the line CC, creates a new one if necessary. static LineCC* get_lineCC(Addr origAddr) { - Char file[FILE_LEN], fn[FN_LEN]; - Int line; + HChar file[FILE_LEN], fn[FN_LEN]; + UInt line; CodeLoc loc; LineCC* lineCC; @@ -1308,7 +1308,7 @@ static void fprint_CC_table_and_calc_totals(void) Int i, fd; SysRes sres; HChar buf[512]; - Char *currFile = NULL, *currFn = NULL; + HChar *currFile = NULL, *currFn = NULL; LineCC* lineCC; // Setup output filename. Nb: it's important to do this now, ie. as late @@ -1316,7 +1316,7 @@ static void fprint_CC_table_and_calc_totals(void) // output file format string contains a %p (pid) specifier, both the // parent and child will incorrectly write to the same file; this // happened in 3.3.0. - Char* cachegrind_out_file = + HChar* cachegrind_out_file = VG_(expand_file_name)("--cachegrind-out-file", clo_cachegrind_out_file); sres = VG_(open)(cachegrind_out_file, VKI_O_CREAT|VKI_O_TRUNC|VKI_O_WRONLY, @@ -1698,7 +1698,7 @@ void cg_discard_superblock_info ( Addr64 orig_addr64, VexGuestExtents vge ) /*--- Command line processing ---*/ /*--------------------------------------------------------------------*/ -static Bool cg_process_cmd_line_option(Char* arg) +static Bool cg_process_cmd_line_option(const HChar* arg) { if (VG_(str_clo_cache_opt)(arg, &clo_I1_cache, diff --git a/callgrind/callstack.c b/callgrind/callstack.c index ae08122fde..95c2278526 100644 --- a/callgrind/callstack.c +++ b/callgrind/callstack.c @@ -273,7 +273,8 @@ void CLG_(push_call_stack)(BBCC* from, UInt jmp, BBCC* to, Addr sp, Bool skip) CLG_DEBUGIF(0) { if (CLG_(clo).verbose<2) { if (jcc && jcc->to && jcc->to->bb) { - char spaces[][41] = { " . . . . . . . . . .", + const HChar spaces[][41] = { + " . . . . . . . . . .", " . . . . . . . . . . ", " . . . . . . . . . . ", ". . . . . . . . . . " }; diff --git a/callgrind/clo.c b/callgrind/clo.c index 61afe62252..c35cbf387e 100644 --- a/callgrind/clo.c +++ b/callgrind/clo.c @@ -89,7 +89,7 @@ struct _config_node { config_node* wild_star; config_node* wild_char; - Char name[1]; + HChar name[1]; }; /* root of trie */ @@ -119,7 +119,7 @@ fn_config* new_fnc(void) } -static config_node* new_config(Char* name, int length) +static config_node* new_config(const HChar* name, int length) { int i; config_node* node = (config_node*) CLG_MALLOC("cl.clo.nc.1", @@ -145,7 +145,7 @@ static config_node* new_config(Char* name, int length) } static __inline__ -Bool is_wild(Char n) +Bool is_wild(HChar n) { return (n == '*') || (n == '?'); } @@ -158,7 +158,7 @@ Bool is_wild(Char n) * tree root is stored into <*pnode>, and the created * leaf (fn_config) for the given pattern is returned. */ -static fn_config* get_fnc2(config_node* node, Char* name) +static fn_config* get_fnc2(config_node* node, const HChar* name) { config_node *new_sub, *n, *nprev; int offset, len; @@ -276,7 +276,7 @@ static void print_config_node(int depth, int hash, config_node* node) int i; if (node != fn_configs) { - char sp[] = " "; + const HChar sp[] = " "; if (depth>40) depth=40; VG_(printf)("%s", sp+40-depth); @@ -297,7 +297,7 @@ static void print_config_node(int depth, int hash, config_node* node) } /* get a function config for a name pattern (from command line) */ -static fn_config* get_fnc(Char* name) +static fn_config* get_fnc(const HChar* name) { fn_config* fnc; @@ -354,7 +354,8 @@ static void update_fn_config1(fn_node* fn, fn_config* fnc) * looking for a match to . For every matching leaf, * is updated with the pattern config. */ -static void update_fn_config2(fn_node* fn, Char* name, config_node* node) +static void update_fn_config2(fn_node* fn, const HChar* name, + config_node* node) { config_node* n; @@ -405,9 +406,9 @@ void CLG_(update_fn_config)(fn_node* fn) /*--- Command line processing ---*/ /*--------------------------------------------------------------------*/ -Bool CLG_(process_cmd_line_option)(Char* arg) +Bool CLG_(process_cmd_line_option)(const HChar* arg) { - Char* tmp_str; + const HChar* tmp_str; if VG_BOOL_CLO(arg, "--skip-plt", CLG_(clo).skip_plt) {} @@ -469,7 +470,7 @@ Bool CLG_(process_cmd_line_option)(Char* arg) else if VG_STREQN(12, arg, "--ct-verbose") { fn_config* fnc; - Char* s; + HChar* s; UInt n = VG_(strtoll10)(arg+12, &s); if ((n <= 0) || *s != '=') return False; fnc = get_fnc(s+1); @@ -484,7 +485,7 @@ Bool CLG_(process_cmd_line_option)(Char* arg) else if VG_STREQN(10, arg, "--fn-group") { fn_config* fnc; - Char* s; + HChar* s; UInt n = VG_(strtoll10)(arg+10, &s); if ((n <= 0) || *s != '=') return False; fnc = get_fnc(s+1); @@ -493,7 +494,7 @@ Bool CLG_(process_cmd_line_option)(Char* arg) else if VG_STREQN(18, arg, "--separate-callers") { fn_config* fnc; - Char* s; + HChar* s; UInt n = VG_(strtoll10)(arg+18, &s); if ((n <= 0) || *s != '=') return False; fnc = get_fnc(s+1); @@ -502,7 +503,7 @@ Bool CLG_(process_cmd_line_option)(Char* arg) else if VG_STREQN(15, arg, "--separate-recs") { fn_config* fnc; - Char* s; + HChar* s; UInt n = VG_(strtoll10)(arg+15, &s); if ((n <= 0) || *s != '=') return False; fnc = get_fnc(s+1); diff --git a/callgrind/context.c b/callgrind/context.c index dcadcb6ee9..be6be7053c 100644 --- a/callgrind/context.c +++ b/callgrind/context.c @@ -284,7 +284,7 @@ void CLG_(push_cxt)(fn_node* fn) Int fn_entries; CLG_DEBUG(5, "+ push_cxt(fn '%s'): old ctx %d\n", - fn ? fn->name : (Char*)"0x0", + fn ? fn->name : "0x0", CLG_(current_state).cxt ? CLG_(current_state).cxt->base_number : -1); @@ -313,7 +313,7 @@ void CLG_(push_cxt)(fn_node* fn) CLG_DEBUG(0, "Resize Context Stack: %d => %d (pushing '%s')\n", CLG_(current_fn_stack).size, new_size, - fn ? fn->name : (Char*)"0x0"); + fn ? fn->name : "0x0"); CLG_(current_fn_stack).size = new_size; } @@ -331,7 +331,7 @@ void CLG_(push_cxt)(fn_node* fn) CLG_(current_state).cxt = CLG_(get_cxt)(CLG_(current_fn_stack).top); CLG_DEBUG(5, "- push_cxt(fn '%s'): new cxt %d, fn_sp %ld\n", - fn ? fn->name : (Char*)"0x0", + fn ? fn->name : "0x0", CLG_(current_state).cxt ? CLG_(current_state).cxt->base_number : -1, CLG_(current_fn_stack).top - CLG_(current_fn_stack).bottom + 0L); diff --git a/callgrind/debug.c b/callgrind/debug.c index cf795a4b36..67d083b61d 100644 --- a/callgrind/debug.c +++ b/callgrind/debug.c @@ -39,7 +39,7 @@ static void print_indent(int s) { /* max of 40 spaces */ - char sp[] = " "; + const HChar sp[] = " "; if (s>40) s=40; VG_(printf)("%s", sp+40-s); } @@ -72,7 +72,7 @@ void print_mangled_cxt(Context* cxt, int rec_index) -void CLG_(print_cxt)(int s, Context* cxt, int rec_index) +void CLG_(print_cxt)(Int s, Context* cxt, int rec_index) { if (s<0) { s = -s; @@ -373,9 +373,9 @@ void CLG_(print_bbcc_cost)(int s, BBCC* bbcc) /* dump out an address with source info if available */ void CLG_(print_addr)(Addr addr) { - Char fl_buf[FILENAME_LEN]; - Char fn_buf[FN_NAME_LEN]; - const UChar* obj_name; + HChar fl_buf[FILENAME_LEN]; + HChar fn_buf[FN_NAME_LEN]; + const HChar* obj_name; DebugInfo* di; UInt ln, i=0, opos=0; @@ -435,7 +435,7 @@ void CLG_(print_context)(void) VG_(printf)("\n"); } -void* CLG_(malloc)(HChar* cc, UWord s, char* f) +void* CLG_(malloc)(const HChar* cc, UWord s, const HChar* f) { CLG_DEBUG(3, "Malloc(%lu) in %s.\n", s, f); return VG_(malloc)(cc,s); diff --git a/callgrind/dump.c b/callgrind/dump.c index e923783a78..8cdade63b3 100644 --- a/callgrind/dump.c +++ b/callgrind/dump.c @@ -36,8 +36,8 @@ /* Dump Part Counter */ static Int out_counter = 0; -static Char* out_file = 0; -static Char* out_directory = 0; +static HChar* out_file = 0; +static HChar* out_directory = 0; static Bool dumps_initialized = False; /* Command */ @@ -62,13 +62,13 @@ Int CLG_(get_dump_counter)(void) return out_counter; } -Char* CLG_(get_out_file)() +HChar* CLG_(get_out_file)() { CLG_(init_dumps)(); return out_file; } -Char* CLG_(get_out_directory)() +HChar* CLG_(get_out_directory)() { CLG_(init_dumps)(); return out_directory; @@ -440,8 +440,8 @@ void init_debug_cache(void) static /* __inline__ */ Bool get_debug_pos(BBCC* bbcc, Addr addr, AddrPos* p) { - Char file[FILENAME_LEN]; - Char dir[FILENAME_LEN]; + HChar file[FILENAME_LEN]; + HChar dir[FILENAME_LEN]; Bool found_file_line, found_dirname; int cachepos = addr % DEBUG_CACHE_SIZE; @@ -1715,12 +1715,12 @@ void CLG_(init_dumps)() i++; } i = lastSlash; - out_directory = (Char*) CLG_MALLOC("cl.dump.init_dumps.1", i+1); + out_directory = (HChar*) CLG_MALLOC("cl.dump.init_dumps.1", i+1); VG_(strncpy)(out_directory, out_file, i); out_directory[i] = 0; /* allocate space big enough for final filenames */ - filename = (Char*) CLG_MALLOC("cl.dump.init_dumps.2", + filename = (HChar*) CLG_MALLOC("cl.dump.init_dumps.2", VG_(strlen)(out_file)+32); CLG_ASSERT(filename != 0); diff --git a/callgrind/events.c b/callgrind/events.c index 566b5e8b0c..0193d2a450 100644 --- a/callgrind/events.c +++ b/callgrind/events.c @@ -46,7 +46,7 @@ void initialize_event_sets(void) eventGroup[i] = 0; for(i=0; i< MAX_EVENTSET_COUNT; i++) - eventSetTable[i] = 0; + eventSetTable[i] = 0; eventSets_initialized = 1; } @@ -62,7 +62,7 @@ EventGroup* new_event_group(int id, int n) CLG_ASSERT(eventGroup[id]==0); eg = (EventGroup*) CLG_MALLOC("cl.events.group.1", - sizeof(EventGroup) + n * sizeof(Char*)); + sizeof(EventGroup) + n * sizeof(HChar*)); eg->size = n; eventGroup[id] = eg; return eg; diff --git a/callgrind/fn.c b/callgrind/fn.c index 09546f3bb9..9975c42b59 100644 --- a/callgrind/fn.c +++ b/callgrind/fn.c @@ -39,7 +39,7 @@ static int runtime_resolve_length = 0; struct chunk_t { int start, len; }; struct pattern { - const char* name; + const HChar* name; int len; struct chunk_t chunk[]; }; @@ -49,7 +49,7 @@ struct pattern */ __attribute__((unused)) // Possibly; depends on the platform. static Bool check_code(obj_node* obj, - unsigned char code[], struct pattern* pat) + UChar code[], struct pattern* pat) { Bool found; Addr addr, end; @@ -122,7 +122,7 @@ static Bool check_code(obj_node* obj, static Bool search_runtime_resolve(obj_node* obj) { #if defined(VGP_x86_linux) - static unsigned char code[] = { + static UChar code[] = { /* 0*/ 0x50, 0x51, 0x52, 0x8b, 0x54, 0x24, 0x10, 0x8b, /* 8*/ 0x44, 0x24, 0x0c, 0xe8, 0x70, 0x01, 0x00, 0x00, /*16*/ 0x5a, 0x59, 0x87, 0x04, 0x24, 0xc2, 0x08, 0x00 }; @@ -131,7 +131,7 @@ static Bool search_runtime_resolve(obj_node* obj) "x86-def", 24, {{ 0,12 }, { 16,8 }, { 24,0}} }; /* Pattern for glibc-2.8 on OpenSuse11.0 */ - static unsigned char code_28[] = { + static UChar code_28[] = { /* 0*/ 0x50, 0x51, 0x52, 0x8b, 0x54, 0x24, 0x10, 0x8b, /* 8*/ 0x44, 0x24, 0x0c, 0xe8, 0x70, 0x01, 0x00, 0x00, /*16*/ 0x5a, 0x8b, 0x0c, 0x24, 0x89, 0x04, 0x24, 0x8b, @@ -146,7 +146,7 @@ static Bool search_runtime_resolve(obj_node* obj) #endif #if defined(VGP_ppc32_linux) - static unsigned char code[] = { + static UChar code[] = { /* 0*/ 0x94, 0x21, 0xff, 0xc0, 0x90, 0x01, 0x00, 0x0c, /* 8*/ 0x90, 0x61, 0x00, 0x10, 0x90, 0x81, 0x00, 0x14, /*16*/ 0x7d, 0x83, 0x63, 0x78, 0x90, 0xa1, 0x00, 0x18, @@ -172,7 +172,7 @@ static Bool search_runtime_resolve(obj_node* obj) #endif #if defined(VGP_amd64_linux) - static unsigned char code[] = { + static UChar code[] = { /* 0*/ 0x48, 0x83, 0xec, 0x38, 0x48, 0x89, 0x04, 0x24, /* 8*/ 0x48, 0x89, 0x4c, 0x24, 0x08, 0x48, 0x89, 0x54, 0x24, 0x10, /*18*/ 0x48, 0x89, 0x74, 0x24, 0x18, 0x48, 0x89, 0x7c, 0x24, 0x20, @@ -214,7 +214,7 @@ void CLG_(init_obj_table)() #define HASH_CONSTANT 256 -static UInt str_hash(const Char *s, UInt table_size) +static UInt str_hash(const HChar *s, UInt table_size) { int hash_value = 0; for ( ; *s; s++) @@ -232,7 +232,7 @@ obj_node* new_obj_node(DebugInfo* di, obj_node* next) obj_node* obj; obj = (obj_node*) CLG_MALLOC("cl.fn.non.1", sizeof(obj_node)); - obj->name = di ? (HChar *)VG_(strdup)( "cl.fn.non.2", + obj->name = di ? VG_(strdup)( "cl.fn.non.2", VG_(DebugInfo_get_filename)(di) ) : anonymous_obj; for (i = 0; i < N_FILE_ENTRIES; i++) { @@ -286,7 +286,7 @@ obj_node* CLG_(get_obj_node)(DebugInfo* di) static __inline__ -file_node* new_file_node(Char filename[FILENAME_LEN], +file_node* new_file_node(HChar filename[FILENAME_LEN], obj_node* obj, file_node* next) { Int i; @@ -305,7 +305,7 @@ file_node* new_file_node(Char filename[FILENAME_LEN], file_node* CLG_(get_file_node)(obj_node* curr_obj_node, - Char filename[FILENAME_LEN]) + HChar filename[FILENAME_LEN]) { file_node* curr_file_node; UInt filename_hash; @@ -330,7 +330,7 @@ file_node* CLG_(get_file_node)(obj_node* curr_obj_node, static void resize_fn_array(void); static __inline__ -fn_node* new_fn_node(Char fnname[FILENAME_LEN], +fn_node* new_fn_node(HChar fnname[FILENAME_LEN], file_node* file, fn_node* next) { fn_node* fn = (fn_node*) CLG_MALLOC("cl.fn.nfnnd.1", @@ -374,7 +374,7 @@ fn_node* new_fn_node(Char fnname[FILENAME_LEN], */ static fn_node* get_fn_node_infile(file_node* curr_file_node, - Char fnname[FN_NAME_LEN]) + HChar fnname[FN_NAME_LEN]) { fn_node* curr_fn_node; UInt fnname_hash; @@ -403,8 +403,8 @@ fn_node* get_fn_node_infile(file_node* curr_file_node, */ static __inline__ fn_node* get_fn_node_inseg(DebugInfo* di, - Char filename[FILENAME_LEN], - Char fnname[FN_NAME_LEN]) + HChar filename[FILENAME_LEN], + HChar fnname[FN_NAME_LEN]) { obj_node *obj = CLG_(get_obj_node)(di); file_node *file = CLG_(get_file_node)(obj, filename); @@ -415,12 +415,12 @@ fn_node* get_fn_node_inseg(DebugInfo* di, Bool CLG_(get_debug_info)(Addr instr_addr, - Char file[FILENAME_LEN], - Char fn_name[FN_NAME_LEN], UInt* line_num, + HChar file[FILENAME_LEN], + HChar fn_name[FN_NAME_LEN], UInt* line_num, DebugInfo** pDebugInfo) { Bool found_file_line, found_fn, found_dirname, result = True; - Char dir[FILENAME_LEN]; + HChar dir[FILENAME_LEN]; UInt line; CLG_DEBUG(6, " + get_debug_info(%#lx)\n", instr_addr); @@ -471,9 +471,9 @@ Bool CLG_(get_debug_info)(Addr instr_addr, CLG_DEBUG(6, " - get_debug_info(%#lx): seg '%s', fn %s\n", instr_addr, - !pDebugInfo ? (const UChar*)"-" : + !pDebugInfo ? "-" : (*pDebugInfo) ? VG_(DebugInfo_get_filename)(*pDebugInfo) : - (const UChar*)"(None)", + "(None)", fn_name); return result; diff --git a/callgrind/global.h b/callgrind/global.h index e51f2108ee..38ffa95b26 100644 --- a/callgrind/global.h +++ b/callgrind/global.h @@ -422,7 +422,7 @@ struct _BBCC { */ struct _fn_node { - Char* name; + HChar* name; UInt number; Context* last_cxt; /* LRU info */ Context* pure_cxt; /* the context with only the function itself */ @@ -456,7 +456,7 @@ struct _fn_node { #define N_BBCC2_ENTRIES 37 struct _file_node { - Char* name; + HChar* name; fn_node* fns[N_FN_ENTRIES]; UInt number; obj_node* obj; @@ -657,7 +657,7 @@ struct _FnPos { struct cachesim_if { void (*print_opts)(void); - Bool (*parse_opt)(Char* arg); + Bool (*parse_opt)(const HChar* arg); void (*post_clo_init)(void); void (*clear)(void); void (*getdesc)(HChar* buf); @@ -712,7 +712,7 @@ extern struct event_sets CLG_(sets); void CLG_(set_clo_defaults)(void); void CLG_(update_fn_config)(fn_node*); -Bool CLG_(process_cmd_line_option)(Char*); +Bool CLG_(process_cmd_line_option)(const HChar*); void CLG_(print_usage)(void); void CLG_(print_debug_usage)(void); @@ -721,8 +721,8 @@ extern struct cachesim_if CLG_(cachesim); void CLG_(init_eventsets)(void); /* from main.c */ -Bool CLG_(get_debug_info)(Addr, Char filename[FILENAME_LEN], - Char fn_name[FN_NAME_LEN], UInt*, DebugInfo**); +Bool CLG_(get_debug_info)(Addr, HChar filename[FILENAME_LEN], + HChar fn_name[FN_NAME_LEN], UInt*, DebugInfo**); void CLG_(collectBlockInfo)(IRSB* bbIn, UInt*, UInt*, Bool*); void CLG_(set_instrument_state)(const HChar*,Bool); void CLG_(dump_profile)(const HChar* trigger,Bool only_current_thread); @@ -751,7 +751,7 @@ UInt* CLG_(get_fn_entry)(Int n); void CLG_(init_obj_table)(void); obj_node* CLG_(get_obj_node)(DebugInfo* si); -file_node* CLG_(get_file_node)(obj_node*, Char* filename); +file_node* CLG_(get_file_node)(obj_node*, HChar* filename); fn_node* CLG_(get_fn_node)(BB* bb); /* from bbcc.c */ @@ -813,8 +813,8 @@ void CLG_(run_post_signal_on_call_stack_bottom)(void); /* from dump.c */ extern FullCost CLG_(total_cost); void CLG_(init_dumps)(void); -Char* CLG_(get_out_file)(void); -Char* CLG_(get_out_directory)(void); +HChar* CLG_(get_out_file)(void); +HChar* CLG_(get_out_directory)(void); /*------------------------------------------------------------*/ /*--- Exported global variables ---*/ @@ -882,8 +882,8 @@ void CLG_(print_stackentry)(int s, int sp); void CLG_(print_addr)(Addr addr); void CLG_(print_addr_ln)(Addr addr); -void* CLG_(malloc)(HChar* cc, UWord s, char* f); -void* CLG_(free)(void* p, char* f); +void* CLG_(malloc)(const HChar* cc, UWord s, const HChar* f); +void* CLG_(free)(void* p, const HChar* f); #if 0 #define CLG_MALLOC(_cc,x) CLG_(malloc)((_cc),x,__FUNCTION__) #define CLG_FREE(p) CLG_(free)(p,__FUNCTION__) diff --git a/callgrind/main.c b/callgrind/main.c index 2cae802364..41fcd9efb3 100644 --- a/callgrind/main.c +++ b/callgrind/main.c @@ -1501,11 +1501,11 @@ static void print_monitor_help ( void ) } /* return True if request recognised, False otherwise */ -static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) +static Bool handle_gdb_monitor_command (ThreadId tid, const HChar *req) { - Char* wcmd; - Char s[VG_(strlen(req))]; /* copy for strtok_r */ - Char *ssaveptr; + HChar* wcmd; + HChar s[VG_(strlen(req))]; /* copy for strtok_r */ + HChar *ssaveptr; VG_(strcpy) (s, req); @@ -1529,7 +1529,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) } case 3: { /* status */ - Char* arg = VG_(strtok_r) (0, " ", &ssaveptr); + HChar* arg = VG_(strtok_r) (0, " ", &ssaveptr); if (arg && (VG_(strcmp)(arg, "internal") == 0)) { /* internal interface to callgrind_control */ dump_state_togdb(); @@ -1550,7 +1550,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) } case 4: { /* instrumentation */ - Char* arg = VG_(strtok_r) (0, " ", &ssaveptr); + HChar* arg = VG_(strtok_r) (0, " ", &ssaveptr); if (!arg) { VG_(gdb_printf)("instrumentation: %s\n", CLG_(instrument_state) ? "on":"off"); @@ -1582,7 +1582,7 @@ Bool CLG_(handle_client_request)(ThreadId tid, UWord *args, UWord *ret) case VG_USERREQ__DUMP_STATS_AT: { HChar buf[512]; - VG_(sprintf)(buf,"Client Request: %s", (Char*)args[1]); + VG_(sprintf)(buf,"Client Request: %s", (HChar*)args[1]); CLG_(dump_profile)(buf, True); *ret = 0; /* meaningless */ } @@ -1611,7 +1611,7 @@ Bool CLG_(handle_client_request)(ThreadId tid, UWord *args, UWord *ret) break; case VG_USERREQ__GDB_MONITOR_COMMAND: { - Bool handled = handle_gdb_monitor_command (tid, (Char*)args[1]); + Bool handled = handle_gdb_monitor_command (tid, (HChar*)args[1]); if (handled) *ret = 1; else @@ -1739,7 +1739,7 @@ void branchsim_printstat(int l1, int l2, int l3) static void finish(void) { - Char buf[32+COSTS_LEN]; + HChar buf[32+COSTS_LEN]; HChar fmt[128]; Int l1, l2, l3; FullCost total; diff --git a/callgrind/sim.c b/callgrind/sim.c index 1bb9cbe3ad..3ce0890038 100644 --- a/callgrind/sim.c +++ b/callgrind/sim.c @@ -1457,7 +1457,7 @@ void cachesim_print_opts(void) * * Called from CLG_(process_cmd_line_option)() in clo.c */ -static Bool cachesim_parse_opt(Char* arg) +static Bool cachesim_parse_opt(const HChar* arg) { if VG_BOOL_CLO(arg, "--simulate-wb", clo_simulate_writeback) {} else if VG_BOOL_CLO(arg, "--simulate-hwpref", clo_simulate_hwpref) {} @@ -1535,7 +1535,7 @@ void cachesim_printstat(Int l1, Int l2, Int l3) FullCost total = CLG_(total_cost), D_total = 0; ULong LL_total_m, LL_total_mr, LL_total_mw, LL_total, LL_total_r, LL_total_w; - char buf1[RESULTS_BUF_LEN], + HChar buf1[RESULTS_BUF_LEN], buf2[RESULTS_BUF_LEN], buf3[RESULTS_BUF_LEN]; Int p; diff --git a/coregrind/launcher-linux.c b/coregrind/launcher-linux.c index 3b7eb66219..dbc198ce3f 100644 --- a/coregrind/launcher-linux.c +++ b/coregrind/launcher-linux.c @@ -113,7 +113,7 @@ static const char *find_client(const char *clientname) static const char *select_platform(const char *clientname) { int fd; - uint8_t header[4096]; + char header[4096]; ssize_t n_bytes; const char *platform = NULL; diff --git a/coregrind/m_cache.c b/coregrind/m_cache.c index 117c6db2f6..98965cd9be 100644 --- a/coregrind/m_cache.c +++ b/coregrind/m_cache.c @@ -485,7 +485,7 @@ get_caches_from_CPUID(VexCacheInfo *ci) { Int ret, i; UInt level; - Char vendor_id[13]; + HChar vendor_id[13]; vg_assert(VG_(has_cpuid)()); diff --git a/coregrind/m_debugger.c b/coregrind/m_debugger.c index ede0fbce0b..14ae9eff8c 100644 --- a/coregrind/m_debugger.c +++ b/coregrind/m_debugger.c @@ -383,7 +383,7 @@ void VG_(start_debugger) ( ThreadId tid ) HChar file[50]; HChar buf[N_BUF]; HChar *bufptr; - HChar *cmdptr; + const HChar *cmdptr; VG_(sprintf)(pidbuf, "%d", pid); VG_(sprintf)(file, "/proc/%d/fd/%d", pid, VG_(cl_exec_fd)); diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 2bf206beb9..a795547af5 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -1985,7 +1985,7 @@ 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 = VG_(clo_fullpath_after)[i]; + UChar* prefix = (UChar *)VG_(clo_fullpath_after)[i]; // FIXME UChar* str = VG_(strstr)(dirname, prefix); if (str) { dirname = str + VG_(strlen)(prefix); @@ -3842,8 +3842,8 @@ void VG_(DebugInfo_syms_getidx) ( const DebugInfo *si, /*OUT*/Addr* avma, /*OUT*/Addr* tocptr, /*OUT*/UInt* size, - /*OUT*/UChar** pri_name, - /*OUT*/UChar*** sec_names, + /*OUT*/HChar** pri_name, + /*OUT*/HChar*** sec_names, /*OUT*/Bool* isText, /*OUT*/Bool* isIFunc ) { @@ -3852,7 +3852,7 @@ void VG_(DebugInfo_syms_getidx) ( const DebugInfo *si, if (tocptr) *tocptr = si->symtab[idx].tocptr; if (size) *size = si->symtab[idx].size; if (pri_name) *pri_name = si->symtab[idx].pri_name; - if (sec_names) *sec_names = si->symtab[idx].sec_names; + if (sec_names) *sec_names = (HChar **)si->symtab[idx].sec_names; // FIXME if (isText) *isText = si->symtab[idx].isText; if (isIFunc) *isIFunc = si->symtab[idx].isIFunc; } diff --git a/coregrind/m_debuglog.c b/coregrind/m_debuglog.c index 4baffc7307..37eb7a5c6e 100644 --- a/coregrind/m_debuglog.c +++ b/coregrind/m_debuglog.c @@ -814,8 +814,8 @@ VG_(debugLog_vprintf) ( } // case 'y': { /* %y - print symbol */ -// Char buf[100]; -// Char *cp = buf; +// HChar buf[100]; +// HChar *cp = buf; // Addr a = va_arg(vargs, Addr); // // if (flags & VG_MSG_PAREN) diff --git a/coregrind/m_demangle/demangle.c b/coregrind/m_demangle/demangle.c index 6e2b1a2f46..8f9af4ab82 100644 --- a/coregrind/m_demangle/demangle.c +++ b/coregrind/m_demangle/demangle.c @@ -87,7 +87,7 @@ /* This is the main, standard demangler entry point. */ void VG_(demangle) ( Bool do_cxx_demangling, Bool do_z_demangling, - Char* orig, Char* result, Int result_size ) + HChar* orig, HChar* result, Int result_size ) { # define N_ZBUF 4096 HChar* demangled = NULL; diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c index a2520801bc..b4fec57e89 100644 --- a/coregrind/m_errormgr.c +++ b/coregrind/m_errormgr.c @@ -213,7 +213,7 @@ typedef SuppLocTy ty; Bool name_is_simple_str; /* True if name is a string without '?' and '*' wildcard characters. */ - Char* name; /* NULL for NoName and DotDotDot */ + HChar* name; /* NULL for NoName and DotDotDot */ } SuppLoc; @@ -224,7 +224,7 @@ typedef struct _Supp { struct _Supp* next; Int count; // The number of times this error has been suppressed. - Char* sname; // The name by which the suppression is referred to. + HChar* sname; // The name by which the suppression is referred to. // Length of 'callers' Int n_callers; @@ -234,7 +234,7 @@ struct _Supp { /* The tool-specific part */ SuppKind skind; // What kind of suppression. Must use the range (0..). - Char* string; // String -- use is optional. NULL by default. + HChar* string; // String -- use is optional. NULL by default. void* extra; // Anything else -- use is optional. NULL by default. }; @@ -243,7 +243,7 @@ SuppKind VG_(get_supp_kind) ( Supp* su ) return su->skind; } -Char* VG_(get_supp_string) ( Supp* su ) +HChar* VG_(get_supp_string) ( Supp* su ) { return su->string; } @@ -259,7 +259,7 @@ void VG_(set_supp_kind) ( Supp* su, SuppKind skind ) su->skind = skind; } -void VG_(set_supp_string) ( Supp* su, Char* string ) +void VG_(set_supp_string) ( Supp* su, HChar* string ) { su->string = string; } @@ -317,7 +317,7 @@ static Bool eq_Error ( VgRes res, Error* e1, Error* e2 ) static void printSuppForIp_XML(UInt n, Addr ip, void* uu_opaque) { - static UChar buf[ERRTXT_LEN]; + static HChar buf[ERRTXT_LEN]; if ( VG_(get_fnname_no_cxx_demangle) (ip, buf, ERRTXT_LEN) ) { VG_(printf_xml)(" %pS \n", buf); } else @@ -330,7 +330,7 @@ static void printSuppForIp_XML(UInt n, Addr ip, void* uu_opaque) static void printSuppForIp_nonXML(UInt n, Addr ip, void* textV) { - static UChar buf[ERRTXT_LEN]; + static HChar buf[ERRTXT_LEN]; XArray* /* of HChar */ text = (XArray*)textV; if ( VG_(get_fnname_no_cxx_demangle) (ip, buf, ERRTXT_LEN) ) { VG_(xaprintf)(text, " fun:%s\n", buf); @@ -447,7 +447,7 @@ static void gen_suppression(Error* err) */ Bool VG_(is_action_requested) ( const HChar* action, Bool* clo ) { - Char ch, ch2; + HChar ch, ch2; Int res; /* First off, we shouldn't be asking the user anything if @@ -1034,10 +1034,10 @@ void VG_(show_error_counts_as_XML) ( void ) /* Get the next char from fd into *out_buf. Returns 1 if success, 0 if eof or < 0 if error. */ -static Int get_char ( Int fd, Char* out_buf ) +static Int get_char ( Int fd, HChar* out_buf ) { Int r; - static Char buf[256]; + static HChar buf[256]; static Int buf_size = 0; static Int buf_used = 0; vg_assert(buf_size >= 0 && buf_size <= 256); @@ -1058,11 +1058,11 @@ static Int get_char ( Int fd, Char* out_buf ) return 1; } -Bool VG_(get_line) ( Int fd, Char** bufpp, SizeT* nBufp, Int* lineno ) +Bool VG_(get_line) ( Int fd, HChar** bufpp, SizeT* nBufp, Int* lineno ) { - Char* buf = *bufpp; + HChar* buf = *bufpp; SizeT nBuf = *nBufp; - Char ch; + HChar ch; Int n, i; while (True) { /* First, read until a non-blank char appears. */ @@ -1106,7 +1106,7 @@ Bool VG_(get_line) ( Int fd, Char** bufpp, SizeT* nBufp, Int* lineno ) /* True if s contains no wildcard (?, *) characters. */ -static Bool is_simple_str (Char *s) +static Bool is_simple_str (const HChar *s) { while (*s) { if (*s == '?' || *s == '*') @@ -1125,7 +1125,7 @@ static Bool is_simple_str (Char *s) after the descriptor (fun: or obj:) part. Returns False if failed. */ -static Bool setLocationTy ( SuppLoc* p, Char *buf ) +static Bool setLocationTy ( SuppLoc* p, HChar *buf ) { if (VG_(strncmp)(buf, "fun:", 4) == 0) { p->name = VG_(arena_strdup)(VG_AR_CORE, @@ -1154,10 +1154,10 @@ static Bool setLocationTy ( SuppLoc* p, Char *buf ) /* Look for "tool" in a string like "tool1,tool2,tool3" */ -static Bool tool_name_present(const HChar *name, Char *names) +static Bool tool_name_present(const HChar *name, HChar *names) { Bool found; - Char *s = NULL; /* Shut gcc up */ + HChar *s = NULL; /* Shut gcc up */ Int len = VG_(strlen)(name); found = (NULL != (s = VG_(strstr)(names, name)) && @@ -1172,15 +1172,15 @@ static Bool tool_name_present(const HChar *name, Char *names) and place them in the suppressions list. If there's any difficulty doing this, just give up -- there's no point in trying to recover. */ -static void load_one_suppressions_file ( Char* filename ) +static void load_one_suppressions_file ( const HChar* filename ) { SysRes sres; Int fd, i, j, lineno = 0; Bool eof; SizeT nBuf = 200; - Char* buf = VG_(malloc)("errormgr.losf.1", nBuf); - Char* tool_names; - Char* supp_name; + HChar* buf = VG_(malloc)("errormgr.losf.1", nBuf); + HChar* tool_names; + HChar* supp_name; const HChar* err_str = NULL; SuppLoc tmp_callers[VG_MAX_SUPP_CALLERS]; @@ -1424,9 +1424,9 @@ typedef // All function names and object names will be concatenated // in names. names is reallocated on demand. - Char *names; + HChar *names; Int names_szB; // size of names. - Int names_free; // offset first free Char in names. + Int names_free; // offset first free HChar in names. } IPtoFunOrObjCompleter; @@ -1445,8 +1445,8 @@ static void clearIPtoFunOrObjCompleter The function name or object name will be computed and added in names if not yet done. IP must be equal to focompl->ipc[ixIP]. */ -static Char* foComplete(IPtoFunOrObjCompleter* ip2fo, - Addr IP, Int ixIP, Bool needFun) +static HChar* foComplete(IPtoFunOrObjCompleter* ip2fo, + Addr IP, Int ixIP, Bool needFun) { vg_assert (ixIP < ip2fo->n_ips); vg_assert (IP == ip2fo->ips[ixIP]); @@ -1480,7 +1480,7 @@ static Char* foComplete(IPtoFunOrObjCompleter* ip2fo, ip2fo->names_szB + ERRTXT_LEN); ip2fo->names_szB += ERRTXT_LEN; } - Char* caller_name = ip2fo->names + ip2fo->names_free; + HChar* caller_name = ip2fo->names + ip2fo->names_free; (*offsets)[ixIP] = ip2fo->names_free; if (needFun) { /* Get the function name into 'caller_name', or "???" @@ -1511,7 +1511,7 @@ static Bool supp_pattEQinp ( void* supplocV, void* addrV, Addr ip = *(Addr*)addrV; /* INPUT */ IPtoFunOrObjCompleter* ip2fo = (IPtoFunOrObjCompleter*)inputCompleter; - Char* funobj_name; // Fun or Obj name. + HChar* funobj_name; // Fun or Obj name. /* So, does this IP address match this suppression-line? */ switch (supploc->ty) { diff --git a/coregrind/m_gdbserver/m_gdbserver.c b/coregrind/m_gdbserver/m_gdbserver.c index 212859e6f8..e20dc23031 100644 --- a/coregrind/m_gdbserver/m_gdbserver.c +++ b/coregrind/m_gdbserver/m_gdbserver.c @@ -1272,9 +1272,9 @@ UInt VG_(gdb_printf) ( const HChar *format, ... ) Int VG_(keyword_id) (Char* keywords, Char* input_word, kwd_report_error report) { const Int il = (input_word == NULL ? 0 : VG_(strlen) (input_word)); - Char iw[il+1]; - Char kwds[VG_(strlen)(keywords)+1]; - Char *kwdssaveptr; + HChar iw[il+1]; + HChar kwds[VG_(strlen)(keywords)+1]; + HChar *kwdssaveptr; Char* kw; /* current keyword, its length, its position */ Int kwl; @@ -1377,12 +1377,12 @@ static Bool is_zero_b (Char *s) void VG_(strtok_get_address_and_size) (Addr* address, SizeT* szB, - Char **ssaveptr) + HChar **ssaveptr) { - Char* wa; - Char* ws; - Char* endptr; - UChar *ppc; + HChar* wa; + HChar* ws; + HChar* endptr; + const HChar *ppc; wa = VG_(strtok_r) (NULL, " ", ssaveptr); ppc = wa; diff --git a/coregrind/m_gdbserver/regdef.h b/coregrind/m_gdbserver/regdef.h index 146079c1e1..e9744594ee 100644 --- a/coregrind/m_gdbserver/regdef.h +++ b/coregrind/m_gdbserver/regdef.h @@ -25,7 +25,7 @@ struct reg { /* The name of this register - NULL for pad entries. */ - const char *name; + char *name; /* At the moment, both of the following bit counts must be divisible by eight (to match the representation as two hex digits) and divisible diff --git a/coregrind/m_gdbserver/remote-utils.c b/coregrind/m_gdbserver/remote-utils.c index 009f3275bd..2e6efa6368 100644 --- a/coregrind/m_gdbserver/remote-utils.c +++ b/coregrind/m_gdbserver/remote-utils.c @@ -219,7 +219,7 @@ void safe_mknod (char *nod) will be created if not existing yet. They will be removed when the gdbserver connection is closed or the process exits */ -void remote_open (char *name) +void remote_open (const HChar *name) { const HChar *user, *host; int save_fcntl_flags, len; diff --git a/coregrind/m_gdbserver/server.c b/coregrind/m_gdbserver/server.c index 736bd914af..5dcb139d5e 100644 --- a/coregrind/m_gdbserver/server.c +++ b/coregrind/m_gdbserver/server.c @@ -126,7 +126,7 @@ int handle_gdb_valgrind_command (char* mon, OutputSink* sink_wanted_at_return) UWord ret = 0; char s[strlen(mon)+1]; /* copy for strtok_r */ char* wcmd; - Char* ssaveptr; + HChar* ssaveptr; char* endptr; int kwdid; int int_value; diff --git a/coregrind/m_gdbserver/server.h b/coregrind/m_gdbserver/server.h index 95939a729c..6686c19468 100644 --- a/coregrind/m_gdbserver/server.h +++ b/coregrind/m_gdbserver/server.h @@ -134,27 +134,27 @@ extern ThreadId vgdb_interrupted_tid; #define VKI_POLLNVAL 0x0020 /* a bunch of macros to avoid libc usage in valgrind-ified gdbserver */ -#define strcmp(s1,s2) VG_(strcmp) ((Char *)(s1),(Char *)(s2)) -#define strncmp(s1,s2,nmax) VG_(strncmp) ((Char *)(s1),(Char *)(s2),nmax) -#define strcat(s1,s2) VG_(strcat) ((Char *)(s1),(Char *)(s2)) -#define strcpy(s1,s2) VG_(strcpy) ((Char *)(s1),(Char *)(s2)) -#define strncpy(s1,s2,nmax) VG_(strncpy) ((Char *)(s1),(Char *)(s2),nmax) -#define strlen(s) VG_(strlen) ((Char *)(s)) -#define strtok(p,s) (char *) VG_(strtok) ((Char *)(p),(Char *)(s)) -#define strtok_r(p,s,ss) (char *) VG_(strtok_r) ((Char *)(p),(Char *)(s),(Char **)(ss)) -#define strchr(s,c) (char *) VG_(strchr) ((Char *)(s),c) +#define strcmp(s1,s2) VG_(strcmp) ((s1),(s2)) +#define strncmp(s1,s2,nmax) VG_(strncmp) ((s1),(s2),nmax) +#define strcat(s1,s2) VG_(strcat) ((s1),(s2)) +#define strcpy(s1,s2) VG_(strcpy) ((s1),(s2)) +#define strncpy(s1,s2,nmax) VG_(strncpy) ((s1),(s2),nmax) +#define strlen(s) VG_(strlen) ((s)) +#define strtok(p,s) VG_(strtok) ((p),(s)) +#define strtok_r(p,s,ss) VG_(strtok_r) ((p),(s),(ss)) +#define strchr(s,c) VG_(strchr) ((s),c) /* strtol and strtoul supports base 16 or else assumes it is base 10 */ #define strtol(s,r,b) ((b) == 16 ? \ - VG_(strtoll16) ((Char *)(s),(Char **)(r)) \ - : VG_(strtoll10) ((Char *)(s),(Char **)(r))) + VG_(strtoll16) ((s),(r)) \ + : VG_(strtoll10) ((s),(r))) #define strtoul(s,r,b) ((b) == 16 ? \ - VG_(strtoull16) ((Char *)(s),(Char **)(r)) \ - : VG_(strtoull10) ((Char *)(s),(Char **)(r))) + VG_(strtoull16) ((s),(r)) \ + : VG_(strtoull10) ((s),(r))) #define malloc(sz) VG_(arena_malloc) (VG_AR_CORE, "gdbsrv", sz) #define calloc(n,sz) VG_(arena_calloc) (VG_AR_CORE, "gdbsrv", n, sz) #define realloc(p,size) VG_(arena_realloc) (VG_AR_CORE, "gdbsrv", p, size) -#define strdup(s) (char *) VG_(arena_strdup) (VG_AR_CORE, "gdbsrv", (Char *)(s)) +#define strdup(s) VG_(arena_strdup) (VG_AR_CORE, "gdbsrv", (s)) #define free(b) VG_(arena_free) (VG_AR_CORE, b) #ifndef ATTR_NORETURN @@ -276,7 +276,7 @@ extern Bool noack_mode; int putpkt (char *buf); int putpkt_binary (char *buf, int len); int getpkt (char *buf); -void remote_open (char *name); +void remote_open (const HChar *name); void remote_close (void); void sync_gdb_connection (void); diff --git a/coregrind/m_initimg/initimg-darwin.c b/coregrind/m_initimg/initimg-darwin.c index 64671ab2d7..29d3fb7e72 100644 --- a/coregrind/m_initimg/initimg-darwin.c +++ b/coregrind/m_initimg/initimg-darwin.c @@ -459,7 +459,7 @@ Addr setup_client_stack( void* init_sp, *ptr++ = 0; /* --- envp --- */ - VG_(client_envp) = (Char **)ptr; + VG_(client_envp) = (HChar **)ptr; for (cpp = orig_envp; cpp && *cpp; ptr++, cpp++) *ptr = (Addr)copy_str(&strtab, *cpp); *ptr++ = 0; diff --git a/coregrind/m_initimg/initimg-linux.c b/coregrind/m_initimg/initimg-linux.c index a32ab57c23..1510f8c54b 100644 --- a/coregrind/m_initimg/initimg-linux.c +++ b/coregrind/m_initimg/initimg-linux.c @@ -603,7 +603,7 @@ Addr setup_client_stack( void* init_sp, *ptr++ = 0; /* --- envp --- */ - VG_(client_envp) = (Char **)ptr; + VG_(client_envp) = (HChar **)ptr; for (cpp = orig_envp; cpp && *cpp; ptr++, cpp++) *ptr = (Addr)copy_str(&strtab, *cpp); *ptr++ = 0; diff --git a/coregrind/m_libcbase.c b/coregrind/m_libcbase.c index a5adac585f..fc6df6caa2 100644 --- a/coregrind/m_libcbase.c +++ b/coregrind/m_libcbase.c @@ -32,16 +32,16 @@ #include "pub_core_libcbase.h" /* --------------------------------------------------------------------- - Char functions. + HChar functions. ------------------------------------------------------------------ */ -Bool VG_(isspace) ( Char c ) +Bool VG_(isspace) ( HChar c ) { return (c == ' ' || c == '\n' || c == '\t' || c == '\f' || c == '\v' || c == '\r'); } -Bool VG_(isdigit) ( Char c ) +Bool VG_(isdigit) ( HChar c ) { return (c >= '0' && c <= '9'); } @@ -50,13 +50,13 @@ Bool VG_(isdigit) ( Char c ) Converting strings to numbers ------------------------------------------------------------------ */ -static Bool is_dec_digit(Char c, Long* digit) +static Bool is_dec_digit(HChar c, Long* digit) { if (c >= '0' && c <= '9') { *digit = (Long)(c - '0'); return True; } return False; } -static Bool is_hex_digit(Char c, Long* digit) +static Bool is_hex_digit(HChar c, Long* digit) { if (c >= '0' && c <= '9') { *digit = (Long)(c - '0'); return True; } if (c >= 'A' && c <= 'F') { *digit = (Long)((c - 'A') + 10); return True; } @@ -64,11 +64,11 @@ static Bool is_hex_digit(Char c, Long* digit) return False; } -Long VG_(strtoll10) ( Char* str, Char** endptr ) +Long VG_(strtoll10) ( const HChar* str, HChar** endptr ) { Bool neg = False, converted = False; Long n = 0, digit = 0; - Char* str0 = str; + const HChar* str0 = str; // Skip leading whitespace. while (VG_(isspace)(*str)) str++; @@ -85,16 +85,16 @@ Long VG_(strtoll10) ( Char* str, Char** endptr ) if (!converted) str = str0; // If nothing converted, endptr points to if (neg) n = -n; // the start of the string. - if (endptr) *endptr = str; // Record first failing character. + if (endptr) *endptr = (HChar *)str; // Record first failing character. return n; } -ULong VG_(strtoull10) ( Char* str, Char** endptr ) +ULong VG_(strtoull10) ( const HChar* str, HChar** endptr ) { Bool converted = False; ULong n = 0; Long digit = 0; - Char* str0 = str; + const HChar* str0 = str; // Skip leading whitespace. while (VG_(isspace)(*str)) str++; @@ -110,15 +110,15 @@ ULong VG_(strtoull10) ( Char* str, Char** endptr ) if (!converted) str = str0; // If nothing converted, endptr points to // the start of the string. - if (endptr) *endptr = str; // Record first failing character. + if (endptr) *endptr = (HChar *)str; // Record first failing character. return n; } -Long VG_(strtoll16) ( Char* str, Char** endptr ) +Long VG_(strtoll16) ( const HChar* str, HChar** endptr ) { Bool neg = False, converted = False; Long n = 0, digit = 0; - Char* str0 = str; + const HChar* str0 = str; // Skip leading whitespace. while (VG_(isspace)(*str)) str++; @@ -143,16 +143,16 @@ Long VG_(strtoll16) ( Char* str, Char** endptr ) if (!converted) str = str0; // If nothing converted, endptr points to if (neg) n = -n; // the start of the string. - if (endptr) *endptr = str; // Record first failing character. + if (endptr) *endptr = (HChar *)str; // Record first failing character. return n; } -ULong VG_(strtoull16) ( Char* str, Char** endptr ) +ULong VG_(strtoull16) ( const HChar* str, HChar** endptr ) { Bool converted = False; ULong n = 0; Long digit = 0; - Char* str0 = str; + const HChar* str0 = str; // Skip leading whitespace. while (VG_(isspace)(*str)) str++; @@ -176,11 +176,11 @@ ULong VG_(strtoull16) ( Char* str, Char** endptr ) if (!converted) str = str0; // If nothing converted, endptr points to // the start of the string. - if (endptr) *endptr = str; // Record first failing character. + if (endptr) *endptr = (HChar *)str; // Record first failing character. return n; } -double VG_(strtod) ( Char* str, Char** endptr ) +double VG_(strtod) ( const HChar* str, HChar** endptr ) { Bool neg = False; Long digit; @@ -209,11 +209,11 @@ double VG_(strtod) ( Char* str, Char** endptr ) n += frac; if (neg) n = -n; - if (endptr) *endptr = str; // Record first failing character. + if (endptr) *endptr = (HChar *)str; // Record first failing character. return n; } -Char VG_(tolower) ( Char c ) +HChar VG_(tolower) ( HChar c ) { if ( c >= 'A' && c <= 'Z' ) { return c - 'A' + 'a'; @@ -226,47 +226,47 @@ Char VG_(tolower) ( Char c ) String functions ------------------------------------------------------------------ */ -SizeT VG_(strlen) ( const Char* str ) +SizeT VG_(strlen) ( const HChar* str ) { SizeT i = 0; while (str[i] != 0) i++; return i; } -Char* VG_(strcat) ( Char* dest, const Char* src ) +HChar* VG_(strcat) ( HChar* dest, const HChar* src ) { - Char* dest_orig = dest; + HChar* dest_orig = dest; while (*dest) dest++; while (*src) *dest++ = *src++; *dest = 0; return dest_orig; } -Char* VG_(strncat) ( Char* dest, const Char* src, SizeT n ) +HChar* VG_(strncat) ( HChar* dest, const HChar* src, SizeT n ) { - Char* dest_orig = dest; + HChar* dest_orig = dest; while (*dest) dest++; while (*src && n > 0) { *dest++ = *src++; n--; } *dest = 0; return dest_orig; } -Char* VG_(strpbrk) ( const Char* s, const Char* accpt ) +HChar* VG_(strpbrk) ( const HChar* s, const HChar* accpt ) { - const Char* a; + const HChar* a; while (*s) { a = accpt; while (*a) if (*a++ == *s) - return (Char *) s; + return (HChar *)s; s++; } return NULL; } -Char* VG_(strcpy) ( Char* dest, const Char* src ) +HChar* VG_(strcpy) ( HChar* dest, const HChar* src ) { - Char* dest_orig = dest; + HChar* dest_orig = dest; while (*src) *dest++ = *src++; *dest = 0; return dest_orig; @@ -274,7 +274,7 @@ Char* VG_(strcpy) ( Char* dest, const Char* src ) /* Copy bytes, not overrunning the end of dest and always ensuring zero termination. */ -void VG_(strncpy_safely) ( Char* dest, const Char* src, SizeT ndest ) +void VG_(strncpy_safely) ( HChar* dest, const HChar* src, SizeT ndest ) { SizeT i = 0; while (True) { @@ -286,7 +286,7 @@ void VG_(strncpy_safely) ( Char* dest, const Char* src, SizeT ndest ) } } -Char* VG_(strncpy) ( Char* dest, const Char* src, SizeT ndest ) +HChar* VG_(strncpy) ( HChar* dest, const HChar* src, SizeT ndest ) { SizeT i = 0; while (True) { @@ -300,7 +300,7 @@ Char* VG_(strncpy) ( Char* dest, const Char* src, SizeT ndest ) } } -Int VG_(strcmp) ( const Char* s1, const Char* s2 ) +Int VG_(strcmp) ( const HChar* s1, const HChar* s2 ) { while (True) { if (*(UChar*)s1 < *(UChar*)s2) return -1; @@ -313,7 +313,7 @@ Int VG_(strcmp) ( const Char* s1, const Char* s2 ) } } -Int VG_(strcasecmp) ( const Char* s1, const Char* s2 ) +Int VG_(strcasecmp) ( const HChar* s1, const HChar* s2 ) { while (True) { UChar c1 = (UChar)VG_(tolower)(*s1); @@ -328,7 +328,7 @@ Int VG_(strcasecmp) ( const Char* s1, const Char* s2 ) } } -Int VG_(strncmp) ( const Char* s1, const Char* s2, SizeT nmax ) +Int VG_(strncmp) ( const HChar* s1, const HChar* s2, SizeT nmax ) { SizeT n = 0; while (True) { @@ -343,7 +343,7 @@ Int VG_(strncmp) ( const Char* s1, const Char* s2, SizeT nmax ) } } -Int VG_(strncasecmp) ( const Char* s1, const Char* s2, SizeT nmax ) +Int VG_(strncasecmp) ( const HChar* s1, const HChar* s2, SizeT nmax ) { Int n = 0; while (True) { @@ -362,7 +362,7 @@ Int VG_(strncasecmp) ( const Char* s1, const Char* s2, SizeT nmax ) } } -Char* VG_(strstr) ( const Char* haystack, const Char* needle ) +HChar* VG_(strstr) ( const HChar* haystack, const HChar* needle ) { SizeT n; if (haystack == NULL) @@ -372,12 +372,12 @@ Char* VG_(strstr) ( const Char* haystack, const Char* needle ) if (haystack[0] == 0) return NULL; if (VG_(strncmp)(haystack, needle, n) == 0) - return (Char*)haystack; + return (HChar*)haystack; haystack++; } } -Char* VG_(strcasestr) ( const Char* haystack, const Char* needle ) +HChar* VG_(strcasestr) ( const HChar* haystack, const HChar* needle ) { Int n; if (haystack == NULL) @@ -387,41 +387,41 @@ Char* VG_(strcasestr) ( const Char* haystack, const Char* needle ) if (haystack[0] == 0) return NULL; if (VG_(strncasecmp)(haystack, needle, n) == 0) - return (Char*)haystack; + return (HChar*)haystack; haystack++; } } -Char* VG_(strchr) ( const Char* s, Char c ) +HChar* VG_(strchr) ( const HChar* s, HChar c ) { while (True) { - if (*s == c) return (Char*)s; + if (*s == c) return (HChar *)s; if (*s == 0) return NULL; s++; } } -Char* VG_(strrchr) ( const Char* s, Char c ) +HChar* VG_(strrchr) ( const HChar* s, HChar c ) { Int n = VG_(strlen)(s); while (--n > 0) { - if (s[n] == c) return (Char*)s + n; + if (s[n] == c) return (HChar *)s + n; } return NULL; } /* (code copied from glib then updated to valgrind types) */ -static Char *olds; -Char * -VG_(strtok) (Char *s, const Char *delim) +static HChar *olds; +HChar * +VG_(strtok) (HChar *s, const HChar *delim) { return VG_(strtok_r) (s, delim, &olds); } -Char * -VG_(strtok_r) (Char* s, const Char* delim, Char** saveptr) +HChar * +VG_(strtok_r) (HChar* s, const HChar* delim, HChar** saveptr) { - Char *token; + HChar *token; if (s == NULL) s = *saveptr; @@ -449,14 +449,14 @@ VG_(strtok_r) (Char* s, const Char* delim, Char** saveptr) return token; } -static Bool isHex ( UChar c ) +static Bool isHex ( HChar c ) { return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')); } -static UInt fromHex ( UChar c ) +static UInt fromHex ( HChar c ) { if (c >= '0' && c <= '9') return (UInt)c - (UInt)'0'; @@ -469,7 +469,7 @@ static UInt fromHex ( UChar c ) return 0; } -Bool VG_(parse_Addr) ( UChar** ppc, Addr* result ) +Bool VG_(parse_Addr) ( const HChar** ppc, Addr* result ) { Int used, limit = 2 * sizeof(Addr); if (**ppc != '0') @@ -492,9 +492,9 @@ Bool VG_(parse_Addr) ( UChar** ppc, Addr* result ) return True; } -SizeT VG_(strspn) ( const Char* s, const Char* accpt ) +SizeT VG_(strspn) ( const HChar* s, const HChar* accpt ) { - const Char *p, *a; + const HChar *p, *a; SizeT count = 0; for (p = s; *p != '\0'; ++p) { for (a = accpt; *a != '\0'; ++a) @@ -508,7 +508,7 @@ SizeT VG_(strspn) ( const Char* s, const Char* accpt ) return count; } -SizeT VG_(strcspn) ( const Char* s, const Char* reject ) +SizeT VG_(strcspn) ( const HChar* s, const HChar* reject ) { SizeT count = 0; while (*s != '\0') { @@ -583,7 +583,7 @@ void* VG_(memmove)(void *dest, const void *src, SizeT sz) void* VG_(memset) ( void *destV, Int c, SizeT sz ) { Int c4; - Char* d = (Char*)destV; + HChar* d = (HChar*)destV; while ((!VG_IS_4_ALIGNED(d)) && sz >= 1) { d[0] = c; d++; diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index 4f76c83ff8..a4f6d1be2d 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -104,7 +104,7 @@ Bool VG_(resolve_filename) ( Int fd, HChar* buf, Int n_buf ) # endif } -SysRes VG_(mknod) ( const Char* pathname, Int mode, UWord dev ) +SysRes VG_(mknod) ( const HChar* pathname, Int mode, UWord dev ) { # if defined(VGO_linux) || defined(VGO_darwin) SysRes res = VG_(do_syscall3)(__NR_mknod, @@ -115,7 +115,7 @@ SysRes VG_(mknod) ( const Char* pathname, Int mode, UWord dev ) return res; } -SysRes VG_(open) ( const Char* pathname, Int flags, Int mode ) +SysRes VG_(open) ( const HChar* pathname, Int flags, Int mode ) { # if defined(VGO_linux) SysRes res = VG_(do_syscall3)(__NR_open, @@ -129,7 +129,7 @@ SysRes VG_(open) ( const Char* pathname, Int flags, Int mode ) return res; } -Int VG_(fd_open) (const Char* pathname, Int flags, Int mode) +Int VG_(fd_open) (const HChar* pathname, Int flags, Int mode) { SysRes sr; sr = VG_(open) (pathname, flags, mode); @@ -270,7 +270,7 @@ Off64T VG_(lseek) ( Int fd, Off64T offset, Int whence ) (_p_vgstat)->ctime_nsec = (ULong)( (_p_vkistat)->st_ctime_nsec ); \ } while (0) -SysRes VG_(stat) ( const Char* file_name, struct vg_stat* vgbuf ) +SysRes VG_(stat) ( const HChar* file_name, struct vg_stat* vgbuf ) { SysRes res; VG_(memset)(vgbuf, 0, sizeof(*vgbuf)); @@ -377,13 +377,13 @@ Int VG_(fcntl) ( Int fd, Int cmd, Addr arg ) return sr_isError(res) ? -1 : sr_Res(res); } -Int VG_(rename) ( const Char* old_name, const Char* new_name ) +Int VG_(rename) ( const HChar* old_name, const HChar* new_name ) { SysRes res = VG_(do_syscall2)(__NR_rename, (UWord)old_name, (UWord)new_name); return sr_isError(res) ? (-1) : 0; } -Int VG_(unlink) ( const Char* file_name ) +Int VG_(unlink) ( const HChar* file_name ) { SysRes res = VG_(do_syscall1)(__NR_unlink, (UWord)file_name); return sr_isError(res) ? (-1) : 0; @@ -426,8 +426,8 @@ Bool VG_(record_startup_wd) ( void ) tell us the startup path. Note the env var is keyed to the parent's PID, not ours, since our parent is the launcher process. */ - { Char envvar[100]; - Char* wd = NULL; + { HChar envvar[100]; + HChar* wd = NULL; VG_(memset)(envvar, 0, sizeof(envvar)); VG_(sprintf)(envvar, "VALGRIND_STARTUP_PWD_%d_XYZZY", (Int)VG_(getppid)()); @@ -446,7 +446,7 @@ Bool VG_(record_startup_wd) ( void ) /* Copy the previously acquired startup_wd into buf[0 .. size-1], or return False if buf isn't big enough. */ -Bool VG_(get_startup_wd) ( Char* buf, SizeT size ) +Bool VG_(get_startup_wd) ( HChar* buf, SizeT size ) { vg_assert(startup_wd_acquired); vg_assert(startup_wd[ sizeof(startup_wd)-1 ] == 0); @@ -470,7 +470,7 @@ Int VG_(poll) (struct vki_pollfd *fds, Int nfds, Int timeout) } -Int VG_(readlink) (const Char* path, Char* buf, UInt bufsiz) +Int VG_(readlink) (const HChar* path, HChar* buf, UInt bufsiz) { SysRes res; /* res = readlink( path, buf, bufsiz ); */ @@ -705,7 +705,7 @@ Int VG_(mkstemp) ( HChar* part_of_name, /*OUT*/HChar* fullname ) ------------------------------------------------------------------ */ static -Int parse_inet_addr_and_port ( UChar* str, UInt* ip_addr, UShort* port ); +Int parse_inet_addr_and_port ( const HChar* str, UInt* ip_addr, UShort* port ); static Int my_connect ( Int sockfd, struct vki_sockaddr_in* serv_addr, Int addrlen ); @@ -763,7 +763,7 @@ UShort VG_(ntohs) ( UShort x ) the relevant file (socket) descriptor, otherwise. is used. */ -Int VG_(connect_via_socket)( UChar* str ) +Int VG_(connect_via_socket)( const HChar* str ) { # if defined(VGO_linux) || defined(VGO_darwin) Int sd, res; @@ -809,7 +809,7 @@ Int VG_(connect_via_socket)( UChar* str ) /* Let d = one or more digits. Accept either: d.d.d.d or d.d.d.d:d */ -static Int parse_inet_addr_and_port ( UChar* str, UInt* ip_addr, UShort* port ) +static Int parse_inet_addr_and_port ( const HChar* str, UInt* ip_addr, UShort* port ) { # define GET_CH ((*str) ? (*str++) : 0) UInt ipa, i, j, c, any; @@ -1054,11 +1054,11 @@ Int VG_(getsockopt) ( Int sd, Int level, Int optname, void *optval, } -Char *VG_(basename)(const Char *path) +HChar *VG_(basename)(const HChar *path) { - static Char buf[VKI_PATH_MAX]; + static HChar buf[VKI_PATH_MAX]; - const Char *p, *end; + const HChar *p, *end; if (path == NULL || 0 == VG_(strcmp)(path, "")) @@ -1090,11 +1090,11 @@ Char *VG_(basename)(const Char *path) } -Char *VG_(dirname)(const Char *path) +HChar *VG_(dirname)(const HChar *path) { - static Char buf[VKI_PATH_MAX]; + static HChar buf[VKI_PATH_MAX]; - const Char *p; + const HChar *p; if (path == NULL || 0 == VG_(strcmp)(path, "") || diff --git a/coregrind/m_libcproc.c b/coregrind/m_libcproc.c index 7b8ea56876..f6b04701cd 100644 --- a/coregrind/m_libcproc.c +++ b/coregrind/m_libcproc.c @@ -60,12 +60,12 @@ /* As deduced from sp_at_startup, the client's argc, argv[] and envp[] as extracted from the client's stack at startup-time. */ -Char** VG_(client_envp) = NULL; +HChar** VG_(client_envp) = NULL; /* Path to library directory */ -const Char *VG_(libdir) = VG_LIBDIR; +const HChar *VG_(libdir) = VG_LIBDIR; -const Char *VG_(LD_PRELOAD_var_name) = +const HChar *VG_(LD_PRELOAD_var_name) = #if defined(VGO_linux) "LD_PRELOAD"; #elif defined(VGO_darwin) @@ -76,13 +76,13 @@ const Char *VG_(LD_PRELOAD_var_name) = /* We do getenv without libc's help by snooping around in VG_(client_envp) as determined at startup time. */ -Char *VG_(getenv)(Char *varname) +HChar *VG_(getenv)(const HChar *varname) { Int i, n; vg_assert( VG_(client_envp) ); n = VG_(strlen)(varname); for (i = 0; VG_(client_envp)[i] != NULL; i++) { - Char* s = VG_(client_envp)[i]; + HChar* s = VG_(client_envp)[i]; if (VG_(strncmp)(varname, s, n) == 0 && s[n] == '=') { return & s[n+1]; } @@ -90,9 +90,9 @@ Char *VG_(getenv)(Char *varname) return NULL; } -void VG_(env_unsetenv) ( Char **env, const Char *varname ) +void VG_(env_unsetenv) ( HChar **env, const HChar *varname ) { - Char **from, **to; + HChar **from, **to; vg_assert(env); vg_assert(varname); to = NULL; @@ -108,14 +108,15 @@ void VG_(env_unsetenv) ( Char **env, const Char *varname ) } /* set the environment; returns the old env if a new one was allocated */ -Char **VG_(env_setenv) ( Char ***envp, const Char* varname, const Char *val ) +HChar **VG_(env_setenv) ( HChar ***envp, const HChar* varname, + const HChar *val ) { - Char **env = (*envp); - Char **cpp; + HChar **env = (*envp); + HChar **cpp; Int len = VG_(strlen)(varname); - Char *valstr = VG_(arena_malloc)(VG_AR_CORE, "libcproc.es.1", - len + VG_(strlen)(val) + 2); - Char **oldenv = NULL; + HChar *valstr = VG_(arena_malloc)(VG_AR_CORE, "libcproc.es.1", + len + VG_(strlen)(val) + 2); + HChar **oldenv = NULL; VG_(sprintf)(valstr, "%s=%s", varname, val); @@ -127,7 +128,7 @@ Char **VG_(env_setenv) ( Char ***envp, const Char* varname, const Char *val ) } if (env == NULL) { - env = VG_(arena_malloc)(VG_AR_CORE, "libcproc.es.2", sizeof(Char **) * 2); + env = VG_(arena_malloc)(VG_AR_CORE, "libcproc.es.2", sizeof(HChar *) * 2); env[0] = valstr; env[1] = NULL; @@ -135,8 +136,8 @@ Char **VG_(env_setenv) ( Char ***envp, const Char* varname, const Char *val ) } else { Int envlen = (cpp-env) + 2; - Char **newenv = VG_(arena_malloc)(VG_AR_CORE, "libcproc.es.3", - envlen * sizeof(Char **)); + HChar **newenv = VG_(arena_malloc)(VG_AR_CORE, "libcproc.es.3", + envlen * sizeof(HChar *)); for (cpp = newenv; *env; ) *cpp++ = *env++; @@ -162,18 +163,18 @@ Char **VG_(env_setenv) ( Char ***envp, const Char* varname, const Char *val ) This is also careful to mop up any excess ':'s, since empty strings delimited by ':' are considered to be '.' in a path. */ -static void mash_colon_env(Char *varp, const Char *remove_pattern) +static void mash_colon_env(HChar *varp, const HChar *remove_pattern) { - Char *const start = varp; - Char *entry_start = varp; - Char *output = varp; + HChar *const start = varp; + HChar *entry_start = varp; + HChar *output = varp; if (varp == NULL) return; while(*varp) { if (*varp == ':') { - Char prev; + HChar prev; Bool match; /* This is a bit subtle: we want to match against the entry @@ -219,7 +220,7 @@ static void mash_colon_env(Char *varp, const Char *remove_pattern) // Removes all the Valgrind-added stuff from the passed environment. Used // when starting child processes, so they don't see that added stuff. -void VG_(env_remove_valgrind_env_stuff)(Char** envp) +void VG_(env_remove_valgrind_env_stuff)(HChar** envp) { #if defined(VGO_darwin) @@ -230,10 +231,10 @@ void VG_(env_remove_valgrind_env_stuff)(Char** envp) #endif Int i; - Char* ld_preload_str = NULL; - Char* ld_library_path_str = NULL; - Char* dyld_insert_libraries_str = NULL; - Char* buf; + HChar* ld_preload_str = NULL; + HChar* ld_library_path_str = NULL; + HChar* dyld_insert_libraries_str = NULL; + HChar* buf; // Find LD_* variables // DDD: should probably conditionally compiled some of this: @@ -296,11 +297,11 @@ Int VG_(waitpid)(Int pid, Int *status, Int options) } /* clone the environment */ -Char **VG_(env_clone) ( Char **oldenv ) +HChar **VG_(env_clone) ( HChar **oldenv ) { - Char **oldenvp; - Char **newenvp; - Char **newenv; + HChar **oldenvp; + HChar **newenvp; + HChar **newenv; Int envlen; vg_assert(oldenv); @@ -309,7 +310,7 @@ Char **VG_(env_clone) ( Char **oldenv ) envlen = oldenvp - oldenv + 1; newenv = VG_(arena_malloc)(VG_AR_CORE, "libcproc.ec.1", - envlen * sizeof(Char **)); + envlen * sizeof(HChar *)); oldenvp = oldenv; newenvp = newenv; @@ -323,9 +324,9 @@ Char **VG_(env_clone) ( Char **oldenv ) return newenv; } -void VG_(execv) ( Char* filename, Char** argv ) +void VG_(execv) ( const HChar* filename, HChar** argv ) { - Char** envp; + HChar** envp; SysRes res; /* restore the DATA rlimit for the child */ @@ -342,7 +343,7 @@ void VG_(execv) ( Char* filename, Char** argv ) /* Return -1 if error, else 0. NOTE does not indicate return code of child! */ -Int VG_(system) ( Char* cmd ) +Int VG_(system) ( const HChar* cmd ) { Int pid; if (cmd == NULL) @@ -352,7 +353,7 @@ Int VG_(system) ( Char* cmd ) return -1; if (pid == 0) { /* child */ - Char* argv[4] = { "/bin/sh", "-c", cmd, 0 }; + const HChar* argv[4] = { "/bin/sh", "-c", cmd, 0 }; VG_(execv)(argv[0], argv); /* If we're still alive here, execve failed. */ @@ -442,7 +443,7 @@ Int VG_(gettid)(void) SysRes res = VG_(do_syscall0)(__NR_gettid); if (sr_isError(res) && sr_Res(res) == VKI_ENOSYS) { - Char pid[16]; + HChar pid[16]; /* * The gettid system call does not exist. The obvious assumption * to make at this point would be that we are running on an older @@ -460,7 +461,7 @@ Int VG_(gettid)(void) res = VG_(do_syscall3)(__NR_readlink, (UWord)"/proc/self", (UWord)pid, sizeof(pid)); if (!sr_isError(res) && sr_Res(res) > 0) { - Char* s; + HChar* s; pid[sr_Res(res)] = '\0'; res = VG_(mk_SysRes_Success)( VG_(strtoll10)(pid, &s) ); if (*s != '\0') { diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c index 9b4dabc1ae..de5561b6b4 100644 --- a/coregrind/m_machine.c +++ b/coregrind/m_machine.c @@ -756,7 +756,7 @@ Bool VG_(machine_get_hwcaps)( void ) { Bool have_sse3, have_cx8, have_cx16; Bool have_lzcnt, have_avx /*, have_fma*/; UInt eax, ebx, ecx, edx, max_extended; - UChar vstr[13]; + HChar vstr[13]; vstr[0] = 0; if (!VG_(has_cpuid)()) diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 6658a70556..31e0457073 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -269,8 +269,8 @@ static void usage_NORETURN ( Bool debug_help ) "\n"; const HChar* gdb_path = GDB_PATH; - Char default_alignment[30]; - Char default_redzone_size[30]; + HChar default_alignment[30]; + HChar default_redzone_size[30]; // Ensure the message goes to stdout VG_(log_output_sink).fd = 1; @@ -333,7 +333,7 @@ static void usage_NORETURN ( Bool debug_help ) have handled here. */ static void early_process_cmd_line_options ( /*OUT*/Int* need_help, - /*OUT*/HChar** tool ) + /*OUT*/const HChar** tool ) { UInt i; HChar* str; @@ -400,7 +400,7 @@ static void early_process_cmd_line_options ( /*OUT*/Int* need_help, */ static void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd, - /*OUT*/Char** xml_fname_unexpanded, + /*OUT*/HChar** xml_fname_unexpanded, const HChar* toolname ) { // VG_(clo_log_fd) is used by all the messaging. It starts as 2 (stderr) @@ -409,7 +409,7 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd, SysRes sres; Int i, tmp_log_fd, tmp_xml_fd; Int toolname_len = VG_(strlen)(toolname); - Char* tmp_str; // Used in a couple of places. + const HChar* tmp_str; // Used in a couple of places. enum { VgLogTo_Fd, VgLogTo_File, @@ -420,8 +420,8 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd, /* Temporarily holds the string STR specified with --{log,xml}-{name,socket}=STR. 'fs' stands for file-or-socket. */ - Char* log_fsname_unexpanded = NULL; - Char* xml_fsname_unexpanded = NULL; + const HChar* log_fsname_unexpanded = NULL; + const HChar* xml_fsname_unexpanded = NULL; /* Log to stderr by default, but usage message goes to stdout. XML output is initially disabled. */ @@ -690,7 +690,7 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd, and the fnpatt just by looking for the second occurrence of C, without hardwiring any assumption about what C is. */ - Char patt[7]; + HChar patt[7]; Bool ok = True; ok = tmp_str && VG_(strlen)(tmp_str) > 0; if (ok) { @@ -898,7 +898,7 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd, break; case VgLogTo_File: { - Char* logfilename; + HChar* logfilename; vg_assert(log_fsname_unexpanded != NULL); vg_assert(VG_(strlen)(log_fsname_unexpanded) <= 900); /* paranoia */ @@ -957,7 +957,7 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd, break; case VgLogTo_File: { - Char* xmlfilename; + HChar* xmlfilename; vg_assert(xml_fsname_unexpanded != NULL); vg_assert(VG_(strlen)(xml_fsname_unexpanded) <= 900); /* paranoia */ @@ -1075,7 +1075,7 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd, the default one. */ static const HChar default_supp[] = "default.supp"; Int len = VG_(strlen)(VG_(libdir)) + 1 + sizeof(default_supp); - Char *buf = VG_(arena_malloc)(VG_AR_CORE, "main.mpclo.3", len); + HChar *buf = VG_(arena_malloc)(VG_AR_CORE, "main.mpclo.3", len); VG_(sprintf)(buf, "%s/%s", VG_(libdir), default_supp); VG_(clo_suppressions)[VG_(clo_n_suppressions)] = buf; VG_(clo_n_suppressions)++; @@ -1085,7 +1085,7 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd, } // Write the name and value of log file qualifiers to the xml file. -static void print_file_vars(Char* format) +static void print_file_vars(HChar* format) { Int i = 0; @@ -1097,8 +1097,8 @@ static void print_file_vars(Char* format) i++; if ('{' == format[i]) { // Get the env var name, print its contents. - Char* qualname; - Char* qual; + HChar* qualname; + HChar* qual; i++; qualname = &format[i]; while (True) { @@ -1133,7 +1133,7 @@ static void print_file_vars(Char* format) /*====================================================================*/ // Print the argument, escaping any chars that require it. -static void umsg_arg(const Char* arg) +static void umsg_arg(const HChar* arg) { SizeT len = VG_(strlen)(arg); const HChar* special = " \\<>"; @@ -1147,7 +1147,7 @@ static void umsg_arg(const Char* arg) } // Send output to the XML-stream and escape any XML meta-characters. -static void xml_arg(const Char* arg) +static void xml_arg(const HChar* arg) { VG_(printf_xml)("%pS", arg); } @@ -1157,7 +1157,7 @@ static void xml_arg(const Char* arg) command line args, to help people trying to interpret the results of a run which encompasses multiple processes. */ static void print_preamble ( Bool logging_to_fd, - Char* xml_fname_unexpanded, + HChar* xml_fname_unexpanded, const HChar* toolname ) { Int i; @@ -1166,7 +1166,7 @@ static void print_preamble ( Bool logging_to_fd, UInt (*umsg_or_xml)( const HChar*, ... ) = VG_(clo_xml) ? VG_(printf_xml) : VG_(umsg); - void (*umsg_or_xml_arg)( const Char* ) + void (*umsg_or_xml_arg)( const HChar* ) = VG_(clo_xml) ? xml_arg : umsg_arg; vg_assert( VG_(args_for_client) ); @@ -1319,7 +1319,7 @@ static void print_preamble ( Bool logging_to_fd, VG_(message)(Vg_DebugMsg, " can't open /proc/version\n"); } else { # define BUF_LEN 256 - Char version_buf[BUF_LEN]; + HChar version_buf[BUF_LEN]; Int n = VG_(read) ( sr_Res(fd), version_buf, BUF_LEN ); vg_assert(n <= BUF_LEN); if (n > 0) { @@ -1416,7 +1416,7 @@ void show_BB_profile ( BBProfEntry tops[], UInt n_tops, ULong score_total ) { ULong score_cumul, score_here; HChar buf_cumul[10], buf_here[10]; - Char name[64]; + HChar name[64]; Int r; VG_(printf)("\n"); @@ -1541,11 +1541,11 @@ void shutdown_actions_NORETURN( ThreadId tid, static Int valgrind_main ( Int argc, HChar **argv, HChar **envp ) { - HChar* toolname = "memcheck"; // default to Memcheck + const HChar* toolname = "memcheck"; // default to Memcheck Int need_help = 0; // 0 = no, 1 = --help, 2 = --help-debug ThreadId tid_main = VG_INVALID_THREADID; Bool logging_to_fd = False; - Char* xml_fname_unexpanded = NULL; + HChar* xml_fname_unexpanded = NULL; Int loglevel, i; struct vki_rlimit zero = { 0, 0 }; XArray* addr2dihandle = NULL; @@ -1575,7 +1575,7 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp ) //============================================================ /* This is needed to make VG_(getenv) usable early. */ - VG_(client_envp) = (Char**)envp; + VG_(client_envp) = (HChar**)envp; //-------------------------------------------------------------- // Start up Mach kernel interface, if any @@ -1769,7 +1769,7 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp ) VG_(err_config_error)( "Can't establish current working " "directory at startup\n"); } - { Char buf[VKI_PATH_MAX+1]; + { HChar buf[VKI_PATH_MAX+1]; Bool ok = VG_(get_startup_wd)( buf, sizeof(buf) ); vg_assert(ok); buf[VKI_PATH_MAX] = 0; diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c index 3ecb46355d..2ed53b6b0e 100644 --- a/coregrind/m_mallocfree.c +++ b/coregrind/m_mallocfree.c @@ -2212,12 +2212,12 @@ void* VG_(arena_realloc) ( ArenaId aid, const HChar* cc, /* Inline just for the wrapper VG_(strdup) below */ -__inline__ Char* VG_(arena_strdup) ( ArenaId aid, const HChar* cc, - const Char* s ) +__inline__ HChar* VG_(arena_strdup) ( ArenaId aid, const HChar* cc, + const HChar* s ) { Int i; Int len; - Char* res; + HChar* res; if (s == NULL) return NULL; @@ -2257,7 +2257,7 @@ void* VG_(realloc) ( const HChar* cc, void* ptr, SizeT size ) return VG_(arena_realloc) ( VG_AR_TOOL, cc, ptr, size ); } -Char* VG_(strdup) ( const HChar* cc, const Char* s ) +HChar* VG_(strdup) ( const HChar* cc, const HChar* s ) { return VG_(arena_strdup) ( VG_AR_TOOL, cc, s ); } diff --git a/coregrind/m_options.c b/coregrind/m_options.c index 2a3ea3ded2..5d419d12c1 100644 --- a/coregrind/m_options.c +++ b/coregrind/m_options.c @@ -54,31 +54,31 @@ VgVgdb VG_(clo_vgdb) = Vg_VgdbYes; #endif Int VG_(clo_vgdb_poll) = 5000; Int VG_(clo_vgdb_error) = 999999999; -HChar* VG_(clo_vgdb_prefix) = NULL; +const HChar* VG_(clo_vgdb_prefix) = NULL; Bool VG_(clo_vgdb_shadow_registers) = False; Bool VG_(clo_db_attach) = False; -Char* VG_(clo_db_command) = GDB_PATH " -nw %f %p"; +const HChar* VG_(clo_db_command) = GDB_PATH " -nw %f %p"; Int VG_(clo_gen_suppressions) = 0; Int VG_(clo_sanity_level) = 1; Int VG_(clo_verbosity) = 1; Bool VG_(clo_stats) = False; Bool VG_(clo_xml) = False; -HChar* VG_(clo_xml_user_comment) = NULL; +const HChar* VG_(clo_xml_user_comment) = NULL; Bool VG_(clo_demangle) = True; -HChar* VG_(clo_soname_synonyms) = NULL; +const HChar* VG_(clo_soname_synonyms) = NULL; Bool VG_(clo_trace_children) = False; -HChar* VG_(clo_trace_children_skip) = NULL; -HChar* VG_(clo_trace_children_skip_by_arg) = NULL; +const HChar* VG_(clo_trace_children_skip) = NULL; +const HChar* VG_(clo_trace_children_skip_by_arg) = NULL; Bool VG_(clo_child_silent_after_fork) = False; -Char* VG_(clo_log_fname_expanded) = NULL; -Char* VG_(clo_xml_fname_expanded) = NULL; +HChar* VG_(clo_log_fname_expanded) = NULL; +HChar* VG_(clo_xml_fname_expanded) = NULL; Bool VG_(clo_time_stamp) = False; Int VG_(clo_input_fd) = 0; /* stdin */ Int VG_(clo_n_suppressions) = 0; -Char* VG_(clo_suppressions)[VG_CLO_MAX_SFILES]; +const HChar* VG_(clo_suppressions)[VG_CLO_MAX_SFILES]; Int VG_(clo_n_fullpath_after) = 0; -Char* VG_(clo_fullpath_after)[VG_CLO_MAX_FULLPATH_AFTER]; +const HChar* VG_(clo_fullpath_after)[VG_CLO_MAX_FULLPATH_AFTER]; UChar VG_(clo_trace_flags) = 0; // 00000000b UChar VG_(clo_profile_flags) = 0; // 00000000b Int VG_(clo_trace_notbelow) = -1; // unspecified @@ -86,7 +86,7 @@ Int VG_(clo_trace_notabove) = -1; // unspecified Bool VG_(clo_trace_syscalls) = False; Bool VG_(clo_trace_signals) = False; Bool VG_(clo_trace_symtab) = False; -HChar* VG_(clo_trace_symtab_patt) = "*"; +const HChar* VG_(clo_trace_symtab_patt) = "*"; Bool VG_(clo_trace_cfi) = False; Bool VG_(clo_debug_dump_syms) = False; Bool VG_(clo_debug_dump_line) = False; @@ -102,11 +102,11 @@ Int VG_(clo_core_redzone_size) = CORE_REDZONE_DEFAULT_SZB; Int VG_(clo_redzone_size) = -1; Int VG_(clo_dump_error) = 0; Int VG_(clo_backtrace_size) = 12; -Char* VG_(clo_sim_hints) = NULL; +const HChar* VG_(clo_sim_hints) = NULL; Bool VG_(clo_sym_offsets) = False; Bool VG_(clo_read_var_info) = False; Int VG_(clo_n_req_tsyms) = 0; -HChar* VG_(clo_req_tsyms)[VG_CLO_MAX_REQ_TSYMS]; +const HChar* VG_(clo_req_tsyms)[VG_CLO_MAX_REQ_TSYMS]; HChar* VG_(clo_require_text_symbol) = NULL; Bool VG_(clo_run_libc_freeres) = True; Bool VG_(clo_track_fds) = False; @@ -116,7 +116,7 @@ Word VG_(clo_max_stackframe) = 2000000; Word VG_(clo_main_stacksize) = 0; /* use client's rlimit.stack */ Bool VG_(clo_wait_for_gdb) = False; VgSmc VG_(clo_smc_check) = Vg_SmcStack; -HChar* VG_(clo_kernel_variant) = NULL; +const HChar* VG_(clo_kernel_variant) = NULL; Bool VG_(clo_dsymutil) = False; @@ -126,11 +126,11 @@ Bool VG_(clo_dsymutil) = False; // Copies the string, prepending it with the startup working directory, and // expanding %p and %q entries. Returns a new, malloc'd string. -Char* VG_(expand_file_name)(Char* option_name, Char* format) +HChar* VG_(expand_file_name)(const HChar* option_name, const HChar* format) { - static Char base_dir[VKI_PATH_MAX]; + static HChar base_dir[VKI_PATH_MAX]; Int len, i = 0, j = 0; - Char* out; + HChar* out; Bool ok = VG_(get_startup_wd)(base_dir, VKI_PATH_MAX); tl_assert(ok); @@ -200,8 +200,8 @@ Char* VG_(expand_file_name)(Char* option_name, Char* format) i++; if ('{' == format[i]) { // Get the env var name, print its contents. - Char* qualname; - Char* qual; + const HChar* qualname; + HChar* qual; i++; qualname = &format[i]; while (True) { @@ -213,15 +213,19 @@ Char* VG_(expand_file_name)(Char* option_name, Char* format) // name. // FIXME: this is not safe as FORMAT is sometimes a // string literal which may reside in read-only memory - format[i] = 0; + ((HChar *)format)[i] = 0; qual = VG_(getenv)(qualname); if (NULL == qual) { VG_(fmsg)("%s: environment variable %s is not set\n", option_name, qualname); - format[i] = '}'; // Put the '}' back. + // FIXME: this is not safe as FORMAT is sometimes a + // string literal which may reside in read-only memory + ((HChar *)format)[i] = '}'; // Put the '}' back. goto bad; } - format[i] = '}'; // Put the '}' back. + // FIXME: this is not safe as FORMAT is sometimes a + // string literal which may reside in read-only memory + ((HChar *)format)[i] = '}'; // Put the '}' back. i++; break; } @@ -248,7 +252,7 @@ Char* VG_(expand_file_name)(Char* option_name, Char* format) return out; bad: { - Char* opt = // 2: 1 for the '=', 1 for the NUL. + HChar* opt = // 2: 1 for the '=', 1 for the NUL. VG_(malloc)( "options.efn.3", VG_(strlen)(option_name) + VG_(strlen)(format) + 2 ); VG_(strcpy)(opt, option_name); @@ -300,7 +304,7 @@ Bool VG_(should_we_trace_this_child) ( HChar* child_exe_name, // by --trace-children-skip=. if (VG_(clo_trace_children_skip)) { HChar const* last = VG_(clo_trace_children_skip); - HChar const* name = (HChar const*)child_exe_name; + HChar const* name = child_exe_name; while (*last) { Bool matches; HChar* patt; diff --git a/coregrind/m_oset.c b/coregrind/m_oset.c index 8e45700de4..458a143ac3 100644 --- a/coregrind/m_oset.c +++ b/coregrind/m_oset.c @@ -935,7 +935,7 @@ Word VG_(OSetWord_Size)(AvlTree* t) } static void OSet_Print2( AvlTree* t, AvlNode* n, - Char*(*strElem)(void *), Int p ) + HChar*(*strElem)(void *), Int p ) { // This is a recursive in-order traversal. Int q = p; @@ -947,7 +947,8 @@ static void OSet_Print2( AvlTree* t, AvlNode* n, } __attribute__((unused)) -static void OSet_Print( AvlTree* t, const HChar *where, Char*(*strElem)(void *) ) +static void OSet_Print( AvlTree* t, const HChar *where, + HChar*(*strElem)(void *) ) { VG_(printf)("-- start %s ----------------\n", where); OSet_Print2(t, t->root, strElem, 0); diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c index 1df8d96272..dde527c1ff 100644 --- a/coregrind/m_redir.c +++ b/coregrind/m_redir.c @@ -310,7 +310,7 @@ static Bool is_plausible_guest_addr(Addr); static void show_redir_state ( const HChar* who ); static void show_active ( const HChar* left, Active* act ); -static void handle_maybe_load_notifier( const UChar* soname, +static void handle_maybe_load_notifier( const HChar* soname, HChar* symbol, Addr addr ); static void handle_require_text_symbols ( DebugInfo* ); @@ -334,8 +334,8 @@ void generate_and_add_actives ( NULL terminated array, for easy iteration. Caller must pass also the address of a 2-entry array which can be used in the common case to avoid dynamic allocation. */ -static UChar** alloc_symname_array ( UChar* pri_name, UChar** sec_names, - UChar** twoslots ) +static HChar** alloc_symname_array ( HChar* pri_name, HChar** sec_names, + HChar** twoslots ) { /* Special-case the common case: only one name. We expect the caller to supply a stack-allocated 2-entry array for this. */ @@ -346,10 +346,10 @@ static UChar** alloc_symname_array ( UChar* pri_name, UChar** sec_names, } /* Else must use dynamic allocation. Figure out size .. */ Word n_req = 1; - UChar** pp = sec_names; + HChar** pp = sec_names; while (*pp) { n_req++; pp++; } /* .. allocate and copy in. */ - UChar** arr = dinfo_zalloc( "redir.asa.1", (n_req+1) * sizeof(UChar*) ); + HChar** arr = dinfo_zalloc( "redir.asa.1", (n_req+1) * sizeof(HChar*) ); Word i = 0; arr[i++] = pri_name; pp = sec_names; @@ -361,7 +361,7 @@ static UChar** alloc_symname_array ( UChar* pri_name, UChar** sec_names, /* Free the array allocated by alloc_symname_array, if any. */ -static void free_symname_array ( UChar** names, UChar** twoslots ) +static void free_symname_array ( HChar** names, HChar** twoslots ) { if (names != twoslots) dinfo_free(names); @@ -395,14 +395,14 @@ void VG_(redir_notify_new_DebugInfo)( DebugInfo* newdi ) Spec* spec; TopSpec* ts; TopSpec* newts; - UChar* sym_name_pri; - UChar** sym_names_sec; + HChar* sym_name_pri; + HChar** sym_names_sec; Addr sym_addr, sym_toc; HChar demangled_sopatt[N_DEMANGLED]; HChar demangled_fnpatt[N_DEMANGLED]; Bool check_ppcTOCs = False; Bool isText; - const UChar* newdi_soname; + const HChar* newdi_soname; # if defined(VG_PLAT_USES_PPCTOC) check_ppcTOCs = True; @@ -437,8 +437,8 @@ void VG_(redir_notify_new_DebugInfo)( DebugInfo* newdi ) is a kludge. An alternate solution would be to change the _vgr prefix according to outer/inner/client. */ - const UChar* newdi_filename = VG_(DebugInfo_get_filename)(newdi); - const UChar* newdi_basename = VG_(basename) (newdi_filename); + const HChar* newdi_filename = VG_(DebugInfo_get_filename)(newdi); + const HChar* newdi_basename = VG_(basename) (newdi_filename); if (VG_(strncmp) (newdi_basename, "vgpreload_", 10) == 0) { /* This looks like a vgpreload file => check if this file is from the inner VALGRIND_LIB. @@ -503,10 +503,10 @@ void VG_(redir_notify_new_DebugInfo)( DebugInfo* newdi ) NULL, &sym_name_pri, &sym_names_sec, &isText, NULL ); /* Set up to conveniently iterate over all names for this symbol. */ - UChar* twoslots[2]; - UChar** names_init = alloc_symname_array(sym_name_pri, sym_names_sec, + HChar* twoslots[2]; + HChar** names_init = alloc_symname_array(sym_name_pri, sym_names_sec, &twoslots[0]); - UChar** names; + HChar** names; for (names = names_init; *names; names++) { ok = VG_(maybe_Z_demangle)( *names, demangled_sopatt, N_DEMANGLED, @@ -595,10 +595,10 @@ void VG_(redir_notify_new_DebugInfo)( DebugInfo* newdi ) VG_(DebugInfo_syms_getidx)( newdi, i, &sym_addr, &sym_toc, NULL, &sym_name_pri, &sym_names_sec, &isText, NULL ); - UChar* twoslots[2]; - UChar** names_init = alloc_symname_array(sym_name_pri, sym_names_sec, + HChar* twoslots[2]; + HChar** names_init = alloc_symname_array(sym_name_pri, sym_names_sec, &twoslots[0]); - UChar** names; + HChar** names; for (names = names_init; *names; names++) { ok = isText && VG_(maybe_Z_demangle)( @@ -733,8 +733,8 @@ void generate_and_add_actives ( Active act; Int nsyms, i; Addr sym_addr; - UChar* sym_name_pri; - UChar** sym_names_sec; + HChar* sym_name_pri; + HChar** sym_names_sec; /* First figure out which of the specs match the seginfo's soname. Also clear the 'done' bits, so that after the main loop below @@ -758,10 +758,10 @@ void generate_and_add_actives ( VG_(DebugInfo_syms_getidx)( di, i, &sym_addr, NULL, NULL, &sym_name_pri, &sym_names_sec, &isText, &isIFunc ); - UChar* twoslots[2]; - UChar** names_init = alloc_symname_array(sym_name_pri, sym_names_sec, + HChar* twoslots[2]; + HChar** names_init = alloc_symname_array(sym_name_pri, sym_names_sec, &twoslots[0]); - UChar** names; + HChar** names; for (names = names_init; *names; names++) { /* ignore data symbols */ @@ -1417,7 +1417,7 @@ static Bool is_plausible_guest_addr(Addr a) /*------------------------------------------------------------*/ static -void handle_maybe_load_notifier( const UChar* soname, +void handle_maybe_load_notifier( const HChar* soname, HChar* symbol, Addr addr ) { # if defined(VGP_x86_linux) @@ -1478,10 +1478,10 @@ static void handle_require_text_symbols ( DebugInfo* di ) vg_assert(VG_(clo_n_req_tsyms) >= 0); vg_assert(VG_(clo_n_req_tsyms) <= VG_CLO_MAX_REQ_TSYMS); for (i = 0; i < VG_(clo_n_req_tsyms); i++) { - HChar* spec = VG_(clo_req_tsyms)[i]; - vg_assert(spec && VG_(strlen)(spec) >= 4); + const HChar* clo_spec = VG_(clo_req_tsyms)[i]; + vg_assert(clo_spec && VG_(strlen)(clo_spec) >= 4); // clone the spec, so we can stick a zero at the end of the sopatt - spec = VG_(strdup)("m_redir.hrts.1", spec); + HChar *spec = VG_(strdup)("m_redir.hrts.1", clo_spec); HChar sep = spec[0]; HChar* sopatt = &spec[1]; HChar* fnpatt = VG_(strchr)(sopatt, sep); @@ -1518,15 +1518,15 @@ static void handle_require_text_symbols ( DebugInfo* di ) Int nsyms = VG_(DebugInfo_syms_howmany)(di); for (j = 0; j < nsyms; j++) { Bool isText = False; - UChar* sym_name_pri = NULL; - UChar** sym_names_sec = NULL; + HChar* sym_name_pri = NULL; + HChar** sym_names_sec = NULL; VG_(DebugInfo_syms_getidx)( di, j, NULL, NULL, NULL, &sym_name_pri, &sym_names_sec, &isText, NULL ); - UChar* twoslots[2]; - UChar** names_init = alloc_symname_array(sym_name_pri, sym_names_sec, + HChar* twoslots[2]; + HChar** names_init = alloc_symname_array(sym_name_pri, sym_names_sec, &twoslots[0]); - UChar** names; + HChar** names; for (names = names_init; *names; names++) { /* ignore data symbols */ if (0) VG_(printf)("QQQ %s\n", *names); diff --git a/coregrind/m_replacemalloc/replacemalloc_core.c b/coregrind/m_replacemalloc/replacemalloc_core.c index 98de3e53d6..773caef6d0 100644 --- a/coregrind/m_replacemalloc/replacemalloc_core.c +++ b/coregrind/m_replacemalloc/replacemalloc_core.c @@ -51,7 +51,7 @@ Bool VG_(clo_trace_malloc) = False; UInt VG_(clo_alignment) = VG_MIN_MALLOC_SZB; -Bool VG_(replacement_malloc_process_cmd_line_option)(Char* arg) +Bool VG_(replacement_malloc_process_cmd_line_option)(const HChar* arg) { if VG_INT_CLO(arg, "--alignment", VG_(clo_alignment)) { if (VG_(clo_alignment) < VG_MIN_MALLOC_SZB || diff --git a/coregrind/m_seqmatch.c b/coregrind/m_seqmatch.c index 35f0f62db6..d9afe4b45f 100644 --- a/coregrind/m_seqmatch.c +++ b/coregrind/m_seqmatch.c @@ -78,8 +78,8 @@ Bool VG_(generic_match) ( /* No specific need to set NULL when !have{Patt,Input}, but guards against inadvertantly dereferencing an out of range pointer to the pattern or input arrays. */ - currPatt = havePatt ? ((Char*)patt) + szbPatt * ixPatt : NULL; - currInput = haveInput ? ((Char*)input) + szbInput * ixInput : NULL; + currPatt = havePatt ? ((HChar*)patt) + szbPatt * ixPatt : NULL; + currInput = haveInput ? ((HChar*)input) + szbInput * ixInput : NULL; // Deal with the complex case first: wildcards. Do frugal // matching. When encountering a '*', first skip no characters @@ -163,21 +163,21 @@ Bool VG_(generic_match) ( /* And a parameterization of the above, to make it do string matching. */ -static Bool charIsStar ( void* pV ) { return *(Char*)pV == '*'; } -static Bool charIsQuery ( void* pV ) { return *(Char*)pV == '?'; } +static Bool charIsStar ( void* pV ) { return *(HChar*)pV == '*'; } +static Bool charIsQuery ( void* pV ) { return *(HChar*)pV == '?'; } static Bool char_p_EQ_i ( void* pV, void* cV, void* null_completer, UWord ixcV ) { - Char p = *(Char*)pV; - Char c = *(Char*)cV; + HChar p = *(HChar*)pV; + HChar c = *(HChar*)cV; vg_assert(p != '*' && p != '?'); return p == c; } -Bool VG_(string_match) ( const Char* patt, const Char* input ) +Bool VG_(string_match) ( const HChar* patt, const HChar* input ) { return VG_(generic_match)( True/* match-all */, - (void*)patt, sizeof(UChar), VG_(strlen)(patt), 0, - (void*)input, sizeof(UChar), VG_(strlen)(input), 0, + (void*)patt, sizeof(HChar), VG_(strlen)(patt), 0, + (void*)input, sizeof(HChar), VG_(strlen)(input), 0, charIsStar, charIsQuery, char_p_EQ_i, NULL ); diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c index 15a360afbe..c64cb1abea 100644 --- a/coregrind/m_stacktrace.c +++ b/coregrind/m_stacktrace.c @@ -1096,7 +1096,7 @@ static void printIpDesc(UInt n, Addr ip, void* uu_opaque) { #define BUF_LEN 4096 - static UChar buf[BUF_LEN]; + static HChar buf[BUF_LEN]; VG_(describe_IP)(ip, buf, BUF_LEN); diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 7bc9f89ebd..196ee3f745 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -510,7 +510,7 @@ SysRes do_mremap( Addr old_addr, SizeT old_len, typedef struct OpenFd { Int fd; /* The file descriptor */ - Char *pathname; /* NULL if not a regular file or unknown */ + HChar *pathname; /* NULL if not a regular file or unknown */ ExeContext *where; /* NULL if inherited from parent */ struct OpenFd *next, *prev; } OpenFd; @@ -774,7 +774,7 @@ void VG_(init_preopened_fds)(void) goto out; if (VG_(strcmp)(d.d_name, ".") && VG_(strcmp)(d.d_name, "..")) { - Char* s; + HChar* s; Int fno = VG_(strtoll10)(d.d_name, &s); if (*s == '\0') { if (fno != sr_Res(f)) @@ -2522,11 +2522,11 @@ void VG_(reap_threads)(ThreadId self) // but it seems to work nonetheless... PRE(sys_execve) { - Char* path = NULL; /* path to executable */ - Char** envp = NULL; - Char** argv = NULL; - Char** arg2copy; - Char* launcher_basename = NULL; + HChar* path = NULL; /* path to executable */ + HChar** envp = NULL; + HChar** argv = NULL; + HChar** arg2copy; + HChar* launcher_basename = NULL; ThreadState* tst; Int i, j, tot_args; SysRes res; @@ -2603,7 +2603,7 @@ PRE(sys_execve) } /* After this point, we can't recover if the execve fails. */ - VG_(debugLog)(1, "syswrap", "Exec of %s\n", (Char*)ARG1); + VG_(debugLog)(1, "syswrap", "Exec of %s\n", (HChar*)ARG1); // Terminate gdbserver if it is active. @@ -2639,7 +2639,7 @@ PRE(sys_execve) } } else { - path = (Char*)ARG1; + path = (HChar*)ARG1; } // Set up the child's environment. @@ -2656,7 +2656,7 @@ PRE(sys_execve) if (ARG3 == 0) { envp = NULL; } else { - envp = VG_(env_clone)( (Char**)ARG3 ); + envp = VG_(env_clone)( (HChar**)ARG3 ); if (envp == NULL) goto hosed; VG_(env_remove_valgrind_env_stuff)( envp ); } @@ -2675,7 +2675,7 @@ PRE(sys_execve) // are omitted. // if (!trace_this_child) { - argv = (Char**)ARG2; + argv = (HChar**)ARG2; } else { vg_assert( VG_(args_for_valgrind) ); vg_assert( VG_(args_for_valgrind_noexecpass) >= 0 ); @@ -2690,7 +2690,7 @@ PRE(sys_execve) // name of client exe tot_args++; // args for client exe, skipping [0] - arg2copy = (Char**)ARG2; + arg2copy = (HChar**)ARG2; if (arg2copy && arg2copy[0]) { for (i = 1; arg2copy[i]; i++) tot_args++; @@ -2707,7 +2707,7 @@ PRE(sys_execve) continue; argv[j++] = * (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i ); } - argv[j++] = (Char*)ARG1; + argv[j++] = (HChar*)ARG1; if (arg2copy && arg2copy[0]) for (i = 1; arg2copy[i]; i++) argv[j++] = arg2copy[i]; @@ -2765,7 +2765,7 @@ PRE(sys_execve) } if (0) { - Char **cpp; + HChar **cpp; VG_(printf)("exec: %s\n", path); for (cpp = argv; cpp && *cpp; cpp++) VG_(printf)("argv: %s\n", *cpp); @@ -3619,7 +3619,7 @@ PRE(sys_open) cloned fd back to the start. */ { HChar name[30]; - Char* arg1s = (Char*) ARG1; + HChar* arg1s = (HChar*) ARG1; SysRes sres; VG_(sprintf)(name, "/proc/%d/cmdline", VG_(getpid)()); @@ -3644,7 +3644,7 @@ PRE(sys_open) cloned fd back to the start. */ { HChar name[30]; - Char* arg1s = (Char*) ARG1; + HChar* arg1s = (HChar*) ARG1; SysRes sres; VG_(sprintf)(name, "/proc/%d/auxv", VG_(getpid)()); @@ -3676,7 +3676,7 @@ POST(sys_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); } } @@ -3734,7 +3734,7 @@ POST(sys_creat) 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); } } @@ -3792,7 +3792,7 @@ PRE(sys_readlink) * /proc//exe. */ HChar name[25]; - Char* arg1s = (Char*) ARG1; + HChar* arg1s = (HChar*) ARG1; VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)()); if (ML_(safe_to_deref)(arg1s, 1) && (VG_STREQ(arg1s, name) || VG_STREQ(arg1s, "/proc/self/exe")) diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c index b9229ca087..ac2af36676 100644 --- a/coregrind/m_tooliface.c +++ b/coregrind/m_tooliface.c @@ -230,8 +230,8 @@ void VG_(needs_tool_errors)( void (*pp) (Error*), Bool show_TIDs, UInt (*update) (Error*), - Bool (*recog) (Char*, Supp*), - Bool (*read_extra) (Int, Char**, SizeT*, Supp*), + Bool (*recog) (const HChar*, Supp*), + Bool (*read_extra) (Int, HChar**, SizeT*, Supp*), Bool (*matches) (Error*, Supp*), const HChar* (*name) (Error*), Bool (*get_xtra_si)(Error*,/*OUT*/HChar*,Int) @@ -251,7 +251,7 @@ void VG_(needs_tool_errors)( } void VG_(needs_command_line_options)( - Bool (*process)(Char*), + Bool (*process)(const HChar*), void (*usage)(void), void (*debug_usage)(void) ) diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c index db53b46293..762762fbee 100644 --- a/coregrind/m_translate.c +++ b/coregrind/m_translate.c @@ -165,7 +165,7 @@ static void add_SP_alias(IRTemp temp, Long delta) if (N_ALIASES == next_SP_alias_slot) next_SP_alias_slot = 0; } -static Bool get_SP_delta(IRTemp temp, ULong* delta) +static Bool get_SP_delta(IRTemp temp, Long* delta) { Int i; // i must be signed! vg_assert(IRTemp_INVALID != temp); @@ -1349,8 +1349,8 @@ Bool VG_(translate) ( ThreadId tid, if ((kind == T_Redir_Wrap || kind == T_Redir_Replace) && (VG_(clo_verbosity) >= 2 || VG_(clo_trace_redir))) { Bool ok; - Char name1[512] = ""; - Char name2[512] = ""; + HChar name1[512] = ""; + HChar name2[512] = ""; name1[0] = name2[0] = 0; ok = VG_(get_fnname_w_offset)(nraddr, name1, 512); if (!ok) VG_(strcpy)(name1, "???"); @@ -1368,9 +1368,9 @@ Bool VG_(translate) ( ThreadId tid, /* If doing any code printing, print a basic block start marker */ if (VG_(clo_trace_flags) || debugging_translation) { - Char fnname[512] = "UNKNOWN_FUNCTION"; + HChar fnname[512] = "UNKNOWN_FUNCTION"; VG_(get_fnname_w_offset)(addr, fnname, 512); - const UChar* objname = "UNKNOWN_OBJECT"; + const HChar* objname = "UNKNOWN_OBJECT"; OffT objoff = 0; DebugInfo* di = VG_(find_DebugInfo)( addr ); if (di) { diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c index 87cf7ec4b9..7173a06d00 100644 --- a/coregrind/m_transtab.c +++ b/coregrind/m_transtab.c @@ -805,7 +805,7 @@ static void unchain_one ( VexArch vex_arch, TTEntry* tte = index_tte(ie->from_sNo, ie->from_tteNo); UChar* place_to_patch - = ((HChar*)tte->tcptr) + ie->from_offs; + = ((UChar*)tte->tcptr) + ie->from_offs; UChar* disp_cp_chain_me = VG_(fnptr_to_fnentry)( ie->to_fastEP ? &VG_(disp_cp_chain_me_to_fastEP) diff --git a/coregrind/pub_core_demangle.h b/coregrind/pub_core_demangle.h index 79346d359a..749ede18b7 100644 --- a/coregrind/pub_core_demangle.h +++ b/coregrind/pub_core_demangle.h @@ -41,7 +41,7 @@ * (2) undoes C++ demangling, if 'do_cxx_demangle' is True. */ extern void VG_(demangle) ( Bool do_cxx_demangling, Bool do_z_demangling, - Char* orig, Char* result, Int result_size ); + HChar* orig, HChar* result, Int result_size ); /* Demangle a Z-encoded name as described in pub_tool_redir.h. Z-encoded names are used by Valgrind for doing function diff --git a/coregrind/pub_core_initimg.h b/coregrind/pub_core_initimg.h index d82e36c6d8..574d07d8d8 100644 --- a/coregrind/pub_core_initimg.h +++ b/coregrind/pub_core_initimg.h @@ -69,7 +69,7 @@ void VG_(ii_finalise_image)( IIFinaliseImageInfo ); struct _IICreateImageInfo { /* ------ Mandatory fields ------ */ - HChar* toolname; + const HChar* toolname; Addr sp_at_startup; Addr clstack_top; /* ------ Per-OS fields ------ */ diff --git a/coregrind/pub_core_libcfile.h b/coregrind/pub_core_libcfile.h index 8e7c20b359..1528a5ec14 100644 --- a/coregrind/pub_core_libcfile.h +++ b/coregrind/pub_core_libcfile.h @@ -56,7 +56,7 @@ extern Bool VG_(is_dir) ( const HChar* f ); none specified. */ #define VG_CLO_DEFAULT_LOGPORT 1500 -extern Int VG_(connect_via_socket)( UChar* str ); +extern Int VG_(connect_via_socket)( const HChar* str ); extern UInt VG_(htonl) ( UInt x ); extern UInt VG_(ntohl) ( UInt x ); diff --git a/coregrind/pub_core_libcproc.h b/coregrind/pub_core_libcproc.h index c200c92d00..88cbc476b1 100644 --- a/coregrind/pub_core_libcproc.h +++ b/coregrind/pub_core_libcproc.h @@ -69,11 +69,11 @@ // Environment manipulations -extern Char **VG_(env_setenv) ( Char ***envp, const Char* varname, - const Char *val ); -extern void VG_(env_unsetenv) ( Char **env, const Char *varname ); -extern void VG_(env_remove_valgrind_env_stuff) ( Char** env ); -extern Char **VG_(env_clone) ( Char **env_clone ); +extern HChar **VG_(env_setenv) ( HChar ***envp, const HChar* varname, + const HChar *val ); +extern void VG_(env_unsetenv) ( HChar **env, const HChar *varname ); +extern void VG_(env_remove_valgrind_env_stuff) ( HChar** env ); +extern HChar **VG_(env_clone) ( HChar **env_clone ); // misc extern Int VG_(getgroups)( Int size, UInt* list ); diff --git a/coregrind/pub_core_mallocfree.h b/coregrind/pub_core_mallocfree.h index f6270c8a30..907acef4f0 100644 --- a/coregrind/pub_core_mallocfree.h +++ b/coregrind/pub_core_mallocfree.h @@ -111,8 +111,8 @@ extern void* VG_(arena_realloc) ( ArenaId arena, const HChar* cc, void* ptr, SizeT size ); extern void* VG_(arena_memalign)( ArenaId aid, const HChar* cc, SizeT req_alignB, SizeT req_pszB ); -extern Char* VG_(arena_strdup) ( ArenaId aid, const HChar* cc, - const Char* s); +extern HChar* VG_(arena_strdup) ( ArenaId aid, const HChar* cc, + const HChar* s); extern SizeT VG_(arena_malloc_usable_size) ( ArenaId aid, void* payload ); diff --git a/coregrind/pub_core_options.h b/coregrind/pub_core_options.h index c22580a15b..1a3ef1f1bd 100644 --- a/coregrind/pub_core_options.h +++ b/coregrind/pub_core_options.h @@ -69,7 +69,7 @@ extern VgVgdb VG_(clo_vgdb); /* if > 0, checks every VG_(clo_vgdb_poll) BBS if vgdb wants to be served. */ extern Int VG_(clo_vgdb_poll); /* prefix for the named pipes (FIFOs) used by vgdb/gdb to communicate with valgrind */ -extern HChar* VG_(clo_vgdb_prefix); +extern const HChar* VG_(clo_vgdb_prefix); /* if True, gdbserver in valgrind will expose a target description containing shadow registers */ extern Bool VG_(clo_vgdb_shadow_registers); @@ -77,7 +77,7 @@ extern Bool VG_(clo_vgdb_shadow_registers); /* Enquire about whether to attach to a debugger at errors? default: NO */ extern Bool VG_(clo_db_attach); /* The debugger command? default: whatever gdb ./configure found */ -extern Char* VG_(clo_db_command); +extern const HChar* VG_(clo_db_command); /* Generating a suppression for each error? default: 0 (NO) Other values: 1 (yes, but ask user), 2 (yes, don't ask user) */ extern Int VG_(clo_gen_suppressions); @@ -89,15 +89,15 @@ extern Bool VG_(clo_demangle); /* Soname synonyms : a string containing a list of pairs xxxxx=yyyyy separated by commas. E.g. --soname-synonyms=somalloc=libtcmalloc*.so*,solibtruc=NONE */ -extern HChar* VG_(clo_soname_synonyms); +extern const HChar* VG_(clo_soname_synonyms); extern Bool VG_(clo_trace_children); /* String containing comma-separated patterns for executable names that should not be traced into even when --trace-children=yes */ -extern HChar* VG_(clo_trace_children_skip); +extern const HChar* VG_(clo_trace_children_skip); /* The same as VG_(clo_trace_children), except that these patterns are tested against the arguments for child processes, rather than the executable name. */ -extern HChar* VG_(clo_trace_children_skip_by_arg); +extern const HChar* VG_(clo_trace_children_skip_by_arg); /* After a fork, the child's output can become confusingly intermingled with the parent's output. This is especially problematic when VG_(clo_xml) is True. Setting @@ -108,8 +108,8 @@ extern Bool VG_(clo_child_silent_after_fork); /* If the user specified --log-file=STR and/or --xml-file=STR, these hold STR after expansion of the %p and %q templates. */ -extern Char* VG_(clo_log_fname_expanded); -extern Char* VG_(clo_xml_fname_expanded); +extern HChar* VG_(clo_log_fname_expanded); +extern HChar* VG_(clo_xml_fname_expanded); /* Add timestamps to log messages? default: NO */ extern Bool VG_(clo_time_stamp); @@ -120,11 +120,11 @@ extern Int VG_(clo_input_fd); /* The number of suppression files specified. */ extern Int VG_(clo_n_suppressions); /* The names of the suppression files. */ -extern Char* VG_(clo_suppressions)[VG_CLO_MAX_SFILES]; +extern const HChar* VG_(clo_suppressions)[VG_CLO_MAX_SFILES]; /* An array of strings harvested from --fullpath-after= flags. */ extern Int VG_(clo_n_fullpath_after); -extern Char* VG_(clo_fullpath_after)[VG_CLO_MAX_FULLPATH_AFTER]; +extern const HChar* VG_(clo_fullpath_after)[VG_CLO_MAX_FULLPATH_AFTER]; /* DEBUG: print generated code? default: 00000000 ( == NO ) */ extern UChar VG_(clo_trace_flags); @@ -141,7 +141,7 @@ extern Bool VG_(clo_trace_signals); /* DEBUG: print symtab details? default: NO */ extern Bool VG_(clo_trace_symtab); /* DEBUG: restrict symtab etc details to object name pattern. Default: "*" */ -extern HChar* VG_(clo_trace_symtab_patt); +extern const HChar* VG_(clo_trace_symtab_patt); /* DEBUG: print call-frame-info details? default: NO */ extern Bool VG_(clo_trace_cfi); /* DEBUG: mimic /usr/bin/readelf --syms? default: NO */ @@ -175,13 +175,13 @@ extern Int VG_(clo_redzone_size); default: Infinity. */ extern Int VG_(clo_dump_error); /* Engage miscellaneous weird hacks needed for some progs. */ -extern Char* VG_(clo_sim_hints); +extern const HChar* VG_(clo_sim_hints); /* Show symbols in the form 'name+offset' ? Default: NO */ extern Bool VG_(clo_sym_offsets); /* Read DWARF3 variable info even if tool doesn't ask for it? */ extern Bool VG_(clo_read_var_info); /* Which prefix to strip from full source file paths, if any. */ -extern Char* VG_(clo_prefix_to_strip); +extern const HChar* VG_(clo_prefix_to_strip); /* An array of strings harvested from --require-text-symbol= flags. @@ -214,7 +214,7 @@ extern Char* VG_(clo_prefix_to_strip); the entire flag in quotes to stop shells messing up the * and ? wildcards. */ extern Int VG_(clo_n_req_tsyms); -extern HChar* VG_(clo_req_tsyms)[VG_CLO_MAX_REQ_TSYMS]; +extern const HChar* VG_(clo_req_tsyms)[VG_CLO_MAX_REQ_TSYMS]; /* Track open file descriptors? */ extern Bool VG_(clo_track_fds); @@ -260,7 +260,7 @@ extern VgSmc VG_(clo_smc_check); /* String containing comma-separated names of minor kernel variants, so they can be properly handled by m_syswrap. */ -extern HChar* VG_(clo_kernel_variant); +extern const HChar* VG_(clo_kernel_variant); /* Darwin-specific: automatically run /usr/bin/dsymutil to update .dSYM directories as necessary? */ diff --git a/coregrind/pub_core_redir.h b/coregrind/pub_core_redir.h index 67fe802d5a..1d78112974 100644 --- a/coregrind/pub_core_redir.h +++ b/coregrind/pub_core_redir.h @@ -128,7 +128,7 @@ extern Addr VG_(redir_do_lookup) ( Addr orig, Bool* isWrap ); //extern Bool VG_(is_wrapper_return)(Addr eip); /* Primary interface for adding wrappers for client-side functions. */ -//extern CodeRedirect *VG_(add_wrapper)(const Char *from_lib, const Char *from_sym, +//extern CodeRedirect *VG_(add_wrapper)(const HChar *from_lib, const HChar *from_sym, // const FuncWrapper *wrapper); // //extern Bool VG_(is_resolved)(const CodeRedirect *redir); diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h index 10a6a75b5a..056d173535 100644 --- a/coregrind/pub_core_tooliface.h +++ b/coregrind/pub_core_tooliface.h @@ -121,8 +121,8 @@ typedef struct { void (*tool_pp_Error) (Error*); Bool tool_show_ThreadIDs_for_errors; UInt (*tool_update_extra) (Error*); - Bool (*tool_recognised_suppression) (Char*, Supp*); - Bool (*tool_read_extra_suppression_info) (Int, Char**, SizeT*, Supp*); + Bool (*tool_recognised_suppression) (const HChar*, Supp*); + Bool (*tool_read_extra_suppression_info) (Int, HChar**, SizeT*, Supp*); Bool (*tool_error_matches_suppression) (Error*, Supp*); const HChar* (*tool_get_error_name) (Error*); Bool (*tool_get_extra_suppression_info) (Error*,/*OUT*/HChar*,Int); @@ -131,7 +131,7 @@ typedef struct { void (*tool_discard_superblock_info)(Addr64, VexGuestExtents); // VG_(needs).command_line_options - Bool (*tool_process_cmd_line_option)(Char*); + Bool (*tool_process_cmd_line_option)(const HChar*); void (*tool_print_usage) (void); void (*tool_print_debug_usage) (void); diff --git a/coregrind/vg_preloaded.c b/coregrind/vg_preloaded.c index aec165606e..7b19cd7dcd 100644 --- a/coregrind/vg_preloaded.c +++ b/coregrind/vg_preloaded.c @@ -116,10 +116,10 @@ __private_extern__ char *__crashreporter_info__ = "Instrumented by Valgrind " VE #include // GrP fixme copied from m_libcproc -static void env_unsetenv ( Char **env, const Char *varname ) +static void env_unsetenv ( HChar **env, const HChar *varname ) { - Char **from; - Char **to = NULL; + HChar **from; + HChar **to = NULL; Int len = strlen(varname); for (from = to = env; from && *from; from++) { @@ -137,7 +137,7 @@ static void env_unsetenv ( Char **env, const Char *varname ) static void vg_cleanup_env(void) __attribute__((constructor)); static void vg_cleanup_env(void) { - Char **envp = (Char**)*_NSGetEnviron(); + HChar **envp = (HChar**)*_NSGetEnviron(); env_unsetenv(envp, "VALGRIND_LAUNCHER"); env_unsetenv(envp, "DYLD_SHARED_REGION"); // GrP fixme should be more like mash_colon_env() diff --git a/drd/drd.h b/drd/drd.h index c3537d2937..9226ed1dd7 100644 --- a/drd/drd.h +++ b/drd/drd.h @@ -440,7 +440,7 @@ enum { /* Tell DRD that a DRD annotation has not yet been implemented. */ VG_USERREQ__DRD_ANNOTATION_UNIMP, - /* args: Char*. */ + /* args: char*. */ /* Tell DRD that a user-defined reader-writer synchronization object * has been created. */ @@ -466,7 +466,7 @@ enum { /* Tell DRD that a Helgrind annotation has not yet been implemented. */ VG_USERREQ__HELGRIND_ANNOTATION_UNIMP = VG_USERREQ_TOOL_BASE('H','G') + 256 + 32, - /* args: Char*. */ + /* args: char*. */ /* Tell DRD to insert a happens-before annotation. */ VG_USERREQ__DRD_ANNOTATE_HAPPENS_BEFORE diff --git a/drd/drd_barrier.c b/drd/drd_barrier.c index 06da0ecdea..f7c6d5c09e 100644 --- a/drd/drd_barrier.c +++ b/drd/drd_barrier.c @@ -55,8 +55,8 @@ struct barrier_thread_info static void barrier_cleanup(struct barrier_info* p); static void barrier_delete_thread(struct barrier_info* const p, const DrdThreadId tid); -static const char* barrier_get_typename(struct barrier_info* const p); -static const char* barrier_type_name(const BarrierT bt); +static const HChar* barrier_get_typename(struct barrier_info* const p); +static const HChar* barrier_type_name(const BarrierT bt); static void barrier_report_wait_delete_race(const struct barrier_info* const p, const struct barrier_thread_info* const q); @@ -540,14 +540,14 @@ void barrier_report_wait_delete_race(const struct barrier_info* const p, } } -static const char* barrier_get_typename(struct barrier_info* const p) +static const HChar* barrier_get_typename(struct barrier_info* const p) { tl_assert(p); return barrier_type_name(p->barrier_type); } -static const char* barrier_type_name(const BarrierT bt) +static const HChar* barrier_type_name(const BarrierT bt) { switch (bt) { diff --git a/drd/drd_clientobj.c b/drd/drd_clientobj.c index 1e9876b5bf..a7996f5440 100644 --- a/drd/drd_clientobj.c +++ b/drd/drd_clientobj.c @@ -243,7 +243,7 @@ void DRD_(clientobj_delete_thread)(const DrdThreadId tid) } } -const char* DRD_(clientobj_type_name)(const ObjType t) +const HChar* DRD_(clientobj_type_name)(const ObjType t) { switch (t) { diff --git a/drd/drd_clientobj.h b/drd/drd_clientobj.h index f177d85c65..fc4ae504b3 100644 --- a/drd/drd_clientobj.h +++ b/drd/drd_clientobj.h @@ -165,7 +165,7 @@ DrdClientobj* DRD_(clientobj_add)(const Addr a1, const ObjType t); Bool DRD_(clientobj_remove)(const Addr addr, const ObjType t); void DRD_(clientobj_stop_using_mem)(const Addr a1, const Addr a2); void DRD_(clientobj_delete_thread)(const DrdThreadId tid); -const char* DRD_(clientobj_type_name)(const ObjType t); +const HChar* DRD_(clientobj_type_name)(const ObjType t); #endif /* __DRD_CLIENTOBJ_H */ diff --git a/drd/drd_clientreq.c b/drd/drd_clientreq.c index 49e1f11055..8712764150 100644 --- a/drd/drd_clientreq.c +++ b/drd/drd_clientreq.c @@ -142,7 +142,7 @@ static Bool handle_client_request(ThreadId vg_tid, UWord* arg, UWord* ret) break; case VG_USERREQ__DRD_SET_THREAD_NAME: - DRD_(thread_set_name)(drd_tid, (const char*)arg[1]); + DRD_(thread_set_name)(drd_tid, (const HChar*)arg[1]); break; case VG_USERREQ__DRD_START_SUPPRESSION: @@ -440,7 +440,7 @@ static Bool handle_client_request(ThreadId vg_tid, UWord* arg, UWord* ret) case VG_USERREQ__POST_SEM_OPEN: if (DRD_(thread_leave_synchr)(drd_tid) == 0) - DRD_(semaphore_open)(arg[1], (Char*)arg[2], arg[3], arg[4], arg[5]); + DRD_(semaphore_open)(arg[1], (HChar*)arg[2], arg[3], arg[4], arg[5]); break; case VG_USERREQ__PRE_SEM_CLOSE: @@ -548,7 +548,7 @@ static Bool handle_client_request(ThreadId vg_tid, UWord* arg, UWord* ret) * freed, e.g. because it points to static data. */ UnimpClReqInfo UICR = - { DRD_(thread_get_running_tid)(), (Char*)arg[1] }; + { DRD_(thread_get_running_tid)(), (HChar*)arg[1] }; VG_(maybe_record_error)(vg_tid, UnimpHgClReq, VG_(get_IP)(vg_tid), @@ -563,7 +563,7 @@ static Bool handle_client_request(ThreadId vg_tid, UWord* arg, UWord* ret) * freed, e.g. because it points to static data. */ UnimpClReqInfo UICR = - { DRD_(thread_get_running_tid)(), (Char*)arg[1] }; + { DRD_(thread_get_running_tid)(), (HChar*)arg[1] }; VG_(maybe_record_error)(vg_tid, UnimpDrdClReq, VG_(get_IP)(vg_tid), diff --git a/drd/drd_error.c b/drd/drd_error.c index feb1494025..cf1944dc5f 100644 --- a/drd/drd_error.c +++ b/drd/drd_error.c @@ -56,7 +56,7 @@ void DRD_(set_show_conflicting_segments)(const Bool scs) s_show_conflicting_segments = scs; } -void DRD_(trace_msg)(const char* format, ...) +void DRD_(trace_msg)(const HChar* format, ...) { va_list vargs; va_start(vargs, format); @@ -71,7 +71,7 @@ void DRD_(trace_msg)(const char* format, ...) va_end(vargs); } -void DRD_(trace_msg_w_bt)(const char* format, ...) +void DRD_(trace_msg_w_bt)(const HChar* format, ...) { va_list vargs; va_start(vargs, format); @@ -92,8 +92,8 @@ void DRD_(trace_msg_w_bt)(const char* format, ...) /** * Emit error message detail in the format requested by the user. */ -static void print_err_detail(const char* format, ...) PRINTF_CHECK(1, 2); -static void print_err_detail(const char* format, ...) +static void print_err_detail(const HChar* format, ...) PRINTF_CHECK(1, 2); +static void print_err_detail(const HChar* format, ...) { va_list vargs; va_start(vargs, format); @@ -154,11 +154,11 @@ static void drd_report_data_race(Error* const err, const DataRaceErrInfo* const dri) { const Bool xml = VG_(clo_xml); - const char* const what_prefix = xml ? " " : ""; - const char* const what_suffix = xml ? "" : ""; - const char* const auxwhat_prefix = xml ? " " : ""; - const char* const auxwhat_suffix = xml ? "" : ""; - const char* const indent = xml ? " " : ""; + const HChar* const what_prefix = xml ? " " : ""; + const HChar* const what_suffix = xml ? "" : ""; + const HChar* const auxwhat_prefix = xml ? " " : ""; + const HChar* const auxwhat_suffix = xml ? "" : ""; + const HChar* const indent = xml ? " " : ""; AddrInfo ai; XArray* /* of HChar */ descr1 @@ -222,7 +222,7 @@ void drd_report_data_race(Error* const err, const DataRaceErrInfo* const dri) if (xml) print_err_detail(" \n"); } else { - char sect_name[64]; + HChar sect_name[64]; VgSectKind sect_kind; sect_kind = VG_(DebugInfo_sect_kind)(sect_name, sizeof(sect_name), @@ -301,8 +301,8 @@ static void drd_tool_error_before_pp(Error* const e) static void drd_tool_error_pp(Error* const e) { const Bool xml = VG_(clo_xml); - const char* const what_prefix = xml ? " " : ""; - const char* const what_suffix = xml ? "" : ""; + const HChar* const what_prefix = xml ? " " : ""; + const HChar* const what_suffix = xml ? "" : ""; if (xml) VG_(printf_xml)( " %pS\n", drd_get_error_name(e)); @@ -507,7 +507,8 @@ static UInt drd_tool_error_update_extra(Error* e) * types supported by DRD. So try to match the suppression name against the * names of DRD error types. */ -static Bool drd_is_recognized_suppression(Char* const name, Supp* const supp) +static Bool drd_is_recognized_suppression(const HChar* const name, + Supp* const supp) { DrdErrorKind skind = 0; @@ -554,7 +555,7 @@ static Bool drd_is_recognized_suppression(Char* const name, Supp* const supp) * that reading the 'extra' lines succeeded. */ static -Bool drd_read_extra_suppression_info(Int fd, Char** bufpp, +Bool drd_read_extra_suppression_info(Int fd, HChar** bufpp, SizeT* nBufp, Supp* supp) { return True; diff --git a/drd/drd_error.h b/drd/drd_error.h index e6ed6401e8..0829d11408 100644 --- a/drd/drd_error.h +++ b/drd/drd_error.h @@ -90,8 +90,8 @@ struct { // Used by: ExeContext* lastchange; // Mallocd DrdThreadId stack_tid; // Stack DebugInfo* debuginfo; // Segment - Char name[256]; // Segment - Char descr[256]; // Segment + HChar name[256]; // Segment + HChar descr[256]; // Segment } AddrInfo; /* @@ -174,13 +174,13 @@ typedef struct { typedef struct { DrdThreadId tid; - Char* descr; + HChar* descr; } UnimpClReqInfo; void DRD_(set_show_conflicting_segments)(const Bool scs); void DRD_(register_error_handlers)(void); -void DRD_(trace_msg)(const char* format, ...) PRINTF_CHECK(1, 2); -void DRD_(trace_msg_w_bt)(const char* format, ...) PRINTF_CHECK(1, 2); +void DRD_(trace_msg)(const HChar* format, ...) PRINTF_CHECK(1, 2); +void DRD_(trace_msg_w_bt)(const HChar* format, ...) PRINTF_CHECK(1, 2); #endif /* __DRD_ERROR_H */ diff --git a/drd/drd_load_store.c b/drd/drd_load_store.c index d5d46ce467..6791555a2a 100644 --- a/drd/drd_load_store.c +++ b/drd/drd_load_store.c @@ -93,7 +93,7 @@ void DRD_(trace_mem_access)(const Addr addr, const SizeT size, { if (DRD_(is_any_traced)(addr, addr + size)) { - char* vc; + HChar* vc; vc = DRD_(vc_aprint)(DRD_(thread_get_vc)(DRD_(thread_get_running_tid)())); if (access_type == eStore && size <= sizeof(HWord)) { diff --git a/drd/drd_main.c b/drd/drd_main.c index 624c5f7229..114779554c 100644 --- a/drd/drd_main.c +++ b/drd/drd_main.c @@ -65,7 +65,7 @@ static Bool s_trace_alloc; /** * Implement the needs_command_line_options for drd. */ -static Bool DRD_(process_cmd_line_option)(Char* arg) +static Bool DRD_(process_cmd_line_option)(const HChar* arg) { int check_stack_accesses = -1; int join_list_vol = -1; @@ -89,8 +89,8 @@ static Bool DRD_(process_cmd_line_option)(Char* arg) int trace_segment = -1; int trace_semaphore = -1; int trace_suppression = -1; - Char* trace_address = 0; - Char* ptrace_address = 0; + const HChar* trace_address = 0; + const HChar* ptrace_address= 0; if VG_BOOL_CLO(arg, "--check-stack-var", check_stack_accesses) {} else if VG_INT_CLO (arg, "--join-list-vol", join_list_vol) {} @@ -277,7 +277,7 @@ static void drd_pre_mem_read_asciiz(const CorePart part, const HChar* const s, const Addr a) { - const char* p = (void*)a; + const HChar* p = (void*)a; SizeT size = 0; // Don't segfault if the string starts in an obviously stupid @@ -862,7 +862,7 @@ void drd_pre_clo_init(void) DRD_(thread_init)(); { - Char* const smi = VG_(getenv)("DRD_SEGMENT_MERGING_INTERVAL"); + HChar* const smi = VG_(getenv)("DRD_SEGMENT_MERGING_INTERVAL"); if (smi) DRD_(thread_set_segment_merge_interval)(VG_(strtoll10)(smi, NULL)); } diff --git a/drd/drd_mutex.c b/drd/drd_mutex.c index a3347e99c6..a073f56b2c 100644 --- a/drd/drd_mutex.c +++ b/drd/drd_mutex.c @@ -445,14 +445,14 @@ void DRD_(spinlock_init_or_unlock)(const Addr spinlock) } } -const char* DRD_(mutex_get_typename)(struct mutex_info* const p) +const HChar* DRD_(mutex_get_typename)(struct mutex_info* const p) { tl_assert(p); return DRD_(mutex_type_name)(p->mutex_type); } -const char* DRD_(mutex_type_name)(const MutexT mt) +const HChar* DRD_(mutex_type_name)(const MutexT mt) { switch (mt) { diff --git a/drd/drd_mutex.h b/drd/drd_mutex.h index 41bd87f3af..205d43dcf3 100644 --- a/drd/drd_mutex.h +++ b/drd/drd_mutex.h @@ -46,8 +46,8 @@ void DRD_(mutex_post_lock)(const Addr mutex, const Bool took_lock, const Bool post_cond_wait); void DRD_(mutex_unlock)(const Addr mutex, const MutexT mutex_type); void DRD_(spinlock_init_or_unlock)(const Addr spinlock); -const char* DRD_(mutex_get_typename)(struct mutex_info* const p); -const char* DRD_(mutex_type_name)(const MutexT mt); +const HChar* DRD_(mutex_get_typename)(struct mutex_info* const p); +const HChar* DRD_(mutex_type_name)(const MutexT mt); Bool DRD_(mutex_is_locked_by)(const Addr mutex, const DrdThreadId tid); int DRD_(mutex_get_recursion_count)(const Addr mutex); ULong DRD_(get_mutex_lock_count)(void); diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c index f883f7c3da..9eaae07513 100644 --- a/drd/drd_pthread_intercepts.c +++ b/drd/drd_pthread_intercepts.c @@ -367,7 +367,7 @@ static int DRD_(detected_linuxthreads)(void) #if defined(linux) #if defined(_CS_GNU_LIBPTHREAD_VERSION) /* Linux with a recent glibc. */ - char buffer[256]; + HChar buffer[256]; unsigned len; len = confstr(_CS_GNU_LIBPTHREAD_VERSION, buffer, sizeof(buffer)); assert(len <= sizeof(buffer)); diff --git a/drd/drd_segment.c b/drd/drd_segment.c index 775bcd77cd..7d5d5d9a09 100644 --- a/drd/drd_segment.c +++ b/drd/drd_segment.c @@ -94,7 +94,7 @@ static void sg_init(Segment* const sg, if (s_trace_segment) { - char* vc; + HChar* vc; vc = DRD_(vc_aprint)(&sg->vc); VG_(message)(Vg_DebugMsg, "New segment for thread %d with vc %s\n", @@ -138,7 +138,7 @@ static void DRD_(sg_delete)(Segment* const sg) { if (DRD_(sg_get_trace)()) { - char* vc; + HChar* vc; vc = DRD_(vc_aprint)(&sg->vc); VG_(message)(Vg_DebugMsg, "Discarding the segment with vector clock %s\n", @@ -179,7 +179,7 @@ void DRD_(sg_put)(Segment* const sg) if (s_trace_segment) { - char* vc; + HChar* vc; vc = DRD_(vc_aprint)(&sg->vc); VG_(message)(Vg_DebugMsg, @@ -206,7 +206,7 @@ void DRD_(sg_merge)(Segment* const sg1, Segment* const sg2) if (s_trace_segment) { - char *vc1, *vc2; + HChar *vc1, *vc2; vc1 = DRD_(vc_aprint)(&sg1->vc); vc2 = DRD_(vc_aprint)(&sg2->vc); diff --git a/drd/drd_semaphore.c b/drd/drd_semaphore.c index 226c5ea80f..3a8b207649 100644 --- a/drd/drd_semaphore.c +++ b/drd/drd_semaphore.c @@ -245,7 +245,7 @@ void DRD_(semaphore_destroy)(const Addr semaphore) /** Called after sem_open(). */ struct semaphore_info* DRD_(semaphore_open)(const Addr semaphore, - const Char* name, const Word oflag, + const HChar* name, const Word oflag, const Word mode, const UInt value) { struct semaphore_info* p; diff --git a/drd/drd_semaphore.h b/drd/drd_semaphore.h index 2ebc130947..62042a5feb 100644 --- a/drd/drd_semaphore.h +++ b/drd/drd_semaphore.h @@ -42,7 +42,7 @@ struct semaphore_info* DRD_(semaphore_init)(const Addr semaphore, const UInt value); void DRD_(semaphore_destroy)(const Addr semaphore); struct semaphore_info* DRD_(semaphore_open)(const Addr semaphore, - const Char* name, const Word oflag, + const HChar* name, const Word oflag, const Word mode, const UInt value); void DRD_(semaphore_close)(const Addr semaphore); void DRD_(semaphore_pre_wait)(const Addr semaphore); diff --git a/drd/drd_suppression.c b/drd/drd_suppression.c index 282ce7a712..65768cb710 100644 --- a/drd/drd_suppression.c +++ b/drd/drd_suppression.c @@ -60,7 +60,7 @@ void DRD_(suppression_init)(void) } void DRD_(start_suppression)(const Addr a1, const Addr a2, - const char* const reason) + const HChar* const reason) { if (s_trace_suppression) VG_(message)(Vg_DebugMsg, "start suppression of 0x%lx sz %ld (%s)\n", diff --git a/drd/drd_suppression.h b/drd/drd_suppression.h index 0fe8bdf082..908877a319 100644 --- a/drd/drd_suppression.h +++ b/drd/drd_suppression.h @@ -12,7 +12,7 @@ extern Bool DRD_(g_any_address_traced); void DRD_(suppression_set_trace)(const Bool trace_suppression); void DRD_(suppression_init)(void); void DRD_(start_suppression)(const Addr a1, const Addr a2, - const char* const reason); + const HChar* const reason); void DRD_(finish_suppression)(const Addr a1, const Addr a2); Bool DRD_(is_suppressed)(const Addr a1, const Addr a2); Bool DRD_(is_any_suppressed)(const Addr a1, const Addr a2); diff --git a/drd/drd_thread.c b/drd/drd_thread.c index adc6f62280..160ce07cf1 100644 --- a/drd/drd_thread.c +++ b/drd/drd_thread.c @@ -377,7 +377,7 @@ void DRD_(thread_post_join)(DrdThreadId drd_joiner, DrdThreadId drd_joinee) { const ThreadId joiner = DRD_(DrdThreadIdToVgThreadId)(drd_joiner); const unsigned msg_size = 256; - char* msg; + HChar* msg; msg = VG_(malloc)("drd.main.dptj.1", msg_size); tl_assert(msg); @@ -386,7 +386,7 @@ void DRD_(thread_post_join)(DrdThreadId drd_joiner, DrdThreadId drd_joinee) drd_joiner, drd_joinee); if (joiner) { - char* vc; + HChar* vc; vc = DRD_(vc_aprint)(DRD_(thread_get_vc)(drd_joiner)); VG_(snprintf)(msg + VG_(strlen)(msg), msg_size - VG_(strlen)(msg), @@ -636,7 +636,7 @@ void DRD_(thread_left_pthread_create)(const DrdThreadId tid) } /** Obtain the thread number and the user-assigned thread name. */ -const char* DRD_(thread_get_name)(const DrdThreadId tid) +const HChar* DRD_(thread_get_name)(const DrdThreadId tid) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); @@ -645,7 +645,7 @@ const char* DRD_(thread_get_name)(const DrdThreadId tid) } /** Set the name of the specified thread. */ -void DRD_(thread_set_name)(const DrdThreadId tid, const char* const name) +void DRD_(thread_set_name)(const DrdThreadId tid, const HChar* const name) { tl_assert(0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID); @@ -893,7 +893,7 @@ static void thread_discard_ordered_segments(void) DRD_(thread_compute_minimum_vc)(&thread_vc_min); if (DRD_(sg_get_trace)()) { - char *vc_min, *vc_max; + HChar *vc_min, *vc_max; VectorClock thread_vc_max; DRD_(vc_init)(&thread_vc_max, 0, 0); @@ -1087,7 +1087,7 @@ void DRD_(thread_combine_vc_join)(DrdThreadId joiner, DrdThreadId joinee) if (DRD_(sg_get_trace)()) { - char *str1, *str2; + HChar *str1, *str2; str1 = DRD_(vc_aprint)(DRD_(thread_get_vc)(joiner)); str2 = DRD_(vc_aprint)(DRD_(thread_get_vc)(joinee)); VG_(message)(Vg_DebugMsg, "Before join: joiner %s, joinee %s\n", @@ -1112,7 +1112,7 @@ void DRD_(thread_combine_vc_join)(DrdThreadId joiner, DrdThreadId joinee) thread_discard_ordered_segments(); if (DRD_(sg_get_trace)()) { - char* str; + HChar* str; str = DRD_(vc_aprint)(DRD_(thread_get_vc)(joiner)); VG_(message)(Vg_DebugMsg, "After join: %s\n", str); @@ -1141,7 +1141,7 @@ static void thread_combine_vc_sync(DrdThreadId tid, const Segment* sg) DRD_(vc_copy)(&old_vc, DRD_(thread_get_vc)(tid)); DRD_(vc_combine)(DRD_(thread_get_vc)(tid), vc); if (DRD_(sg_get_trace)()) { - char *str1, *str2; + HChar *str1, *str2; str1 = DRD_(vc_aprint)(&old_vc); str2 = DRD_(vc_aprint)(DRD_(thread_get_vc)(tid)); VG_(message)(Vg_DebugMsg, "thread %d: vc %s -> %s\n", tid, str1, str2); @@ -1400,7 +1400,7 @@ static void thread_compute_conflict_set(struct bitmap** conflict_set, } if (s_trace_conflict_set) { - char* str; + HChar* str; str = DRD_(vc_aprint)(DRD_(thread_get_vc)(tid)); VG_(message)(Vg_DebugMsg, @@ -1414,7 +1414,7 @@ static void thread_compute_conflict_set(struct bitmap** conflict_set, unsigned j; if (s_trace_conflict_set) { - char* vc; + HChar* vc; vc = DRD_(vc_aprint)(&p->vc); VG_(message)(Vg_DebugMsg, "conflict set: thread [%d] at vc %s\n", @@ -1430,7 +1430,7 @@ static void thread_compute_conflict_set(struct bitmap** conflict_set, if (!DRD_(vc_lte)(&q->vc, &p->vc) && !DRD_(vc_lte)(&p->vc, &q->vc)) { if (s_trace_conflict_set) { - char* str; + HChar* str; str = DRD_(vc_aprint)(&q->vc); VG_(message)(Vg_DebugMsg, @@ -1441,7 +1441,7 @@ static void thread_compute_conflict_set(struct bitmap** conflict_set, DRD_(bm_merge2)(*conflict_set, DRD_(sg_bm)(q)); } else { if (s_trace_conflict_set) { - char* str; + HChar* str; str = DRD_(vc_aprint)(&q->vc); VG_(message)(Vg_DebugMsg, @@ -1486,7 +1486,7 @@ void DRD_(thread_update_conflict_set)(const DrdThreadId tid, tl_assert(DRD_(g_conflict_set)); if (s_trace_conflict_set) { - char* str; + HChar* str; str = DRD_(vc_aprint)(DRD_(thread_get_vc)(tid)); VG_(message)(Vg_DebugMsg, @@ -1516,7 +1516,7 @@ void DRD_(thread_update_conflict_set)(const DrdThreadId tid, = !DRD_(vc_lte)(new_vc, &q->vc); if (UNLIKELY(s_trace_conflict_set)) { - char* str; + HChar* str; str = DRD_(vc_aprint)(&q->vc); VG_(message)(Vg_DebugMsg, @@ -1538,7 +1538,7 @@ void DRD_(thread_update_conflict_set)(const DrdThreadId tid, && !DRD_(vc_lte)(new_vc, &q->vc); if (UNLIKELY(s_trace_conflict_set)) { - char* str; + HChar* str; str = DRD_(vc_aprint)(&q->vc); VG_(message)(Vg_DebugMsg, diff --git a/drd/drd_thread.h b/drd/drd_thread.h index 68e29179d5..1f2b0d4cd2 100644 --- a/drd/drd_thread.h +++ b/drd/drd_thread.h @@ -75,7 +75,7 @@ typedef struct Addr stack_startup; /**1) { /* FLDCW detection */ /* opcode is 0xd9/5, ie 1101 1001 oo10 1mmm */ @@ -531,7 +531,7 @@ static void bbv_post_clo_init(void) } /* Parse the command line options */ -static Bool bbv_process_cmd_line_option(Char* arg) +static Bool bbv_process_cmd_line_option(const HChar* arg) { if VG_INT_CLO (arg, "--interval-size", interval_size) {} else if VG_STR_CLO (arg, "--bb-out-file", clo_bb_out_file) {} diff --git a/exp-dhat/dh_main.c b/exp-dhat/dh_main.c index 139f80786d..ef45cea3ed 100644 --- a/exp-dhat/dh_main.c +++ b/exp-dhat/dh_main.c @@ -801,7 +801,7 @@ void addMemEvent(IRSB* sbOut, Bool isWrite, Int szB, IRExpr* addr, Int goff_sp) { IRType tyAddr = Ity_INVALID; - HChar* hName = NULL; + const HChar* hName= NULL; void* hAddr = NULL; IRExpr** argv = NULL; IRDirty* di = NULL; @@ -1031,12 +1031,12 @@ IRSB* dh_instrument ( VgCallbackClosure* closure, // FORWARDS static Bool identify_metric ( /*OUT*/ULong(**get_metricP)(APInfo*), /*OUT*/Bool* increasingP, - HChar* metric_name ); + const HChar* metric_name ); static Int clo_show_top_n = 10; -static HChar* clo_sort_by = "max-bytes-live"; +static const HChar *clo_sort_by = "max-bytes-live"; -static Bool dh_process_cmd_line_option(Char* arg) +static Bool dh_process_cmd_line_option(const HChar* arg) { if VG_BINT_CLO(arg, "--show-top-n", clo_show_top_n, 1, 100000) {} @@ -1184,7 +1184,7 @@ static ULong get_metric__max_blocks_live ( APInfo* api ) { string could not be identified.*/ static Bool identify_metric ( /*OUT*/ULong(**get_metricP)(APInfo*), /*OUT*/Bool* increasingP, - HChar* metric_name ) + const HChar* metric_name ) { if (0 == VG_(strcmp)(metric_name, "max-bytes-live")) { *get_metricP = get_metric__max_bytes_live; @@ -1212,7 +1212,7 @@ static void show_top_n_apinfos ( void ) ULong (*get_metric)(APInfo*); Bool increasing; - HChar* metric_name = clo_sort_by; + const HChar* metric_name = clo_sort_by; tl_assert(metric_name); // ensured by clo processing Bool ok = identify_metric( &get_metric, &increasing, metric_name ); diff --git a/exp-sgcheck/pc_common.c b/exp-sgcheck/pc_common.c index dc608a89d7..d4c5bc94d2 100644 --- a/exp-sgcheck/pc_common.c +++ b/exp-sgcheck/pc_common.c @@ -63,7 +63,7 @@ Bool h_clo_partial_loads_ok = True; /* user visible */ /* Bool h_clo_lossage_check = False; */ /* dev flag only */ Bool sg_clo_enable_sg_checks = True; /* user visible */ -Bool pc_process_cmd_line_options(Char* arg) +Bool pc_process_cmd_line_options(const HChar* arg) { if VG_BOOL_CLO(arg, "--partial-loads-ok", h_clo_partial_loads_ok) {} /* else if VG_BOOL_CLO(arg, "--lossage-check", h_clo_lossage_check) {} */ @@ -134,7 +134,7 @@ typedef Seg* vseg; XArray* descr1; /* XArray* of HChar */ XArray* descr2; /* XArray* of HChar */ - Char datasym[96]; + HChar datasym[96]; PtrdiffT datasymoff; } Heap; struct { @@ -200,7 +200,7 @@ void h_record_arith_error( Seg* seg1, Seg* seg2, HChar* opname ) /*a*/0, /*str*/NULL, /*extra*/(void*)&xe); } -void h_record_sysparam_error( ThreadId tid, CorePart part, Char* s, +void h_record_sysparam_error( ThreadId tid, CorePart part, const HChar* s, Addr lo, Addr hi, Seg* seglo, Seg* seghi ) { XError xe; @@ -720,7 +720,7 @@ UInt pc_update_Error_extra ( Error* err ) return sizeof(XError); } -Bool pc_is_recognised_suppression ( Char* name, Supp *su ) +Bool pc_is_recognised_suppression ( const HChar* name, Supp *su ) { SuppKind skind; @@ -735,7 +735,7 @@ Bool pc_is_recognised_suppression ( Char* name, Supp *su ) return True; } -Bool pc_read_extra_suppression_info ( Int fd, Char** bufpp, +Bool pc_read_extra_suppression_info ( Int fd, HChar** bufpp, SizeT* nBufp, Supp* su ) { Bool eof; diff --git a/exp-sgcheck/pc_common.h b/exp-sgcheck/pc_common.h index 20d5bbeabf..c547a235fb 100644 --- a/exp-sgcheck/pc_common.h +++ b/exp-sgcheck/pc_common.h @@ -44,15 +44,15 @@ void h_record_heap_error( Addr a, SizeT size, Seg* vseg, Bool is_write ); void h_record_arith_error( Seg* seg1, Seg* seg2, HChar* opname ); -void h_record_sysparam_error( ThreadId tid, CorePart part, Char* s, +void h_record_sysparam_error( ThreadId tid, CorePart part, const HChar* s, Addr lo, Addr hi, Seg* seglo, Seg* seghi ); Bool pc_eq_Error ( VgRes res, Error* e1, Error* e2 ); void pc_before_pp_Error ( Error* err ); void pc_pp_Error ( Error* err ); UInt pc_update_Error_extra ( Error* err ); -Bool pc_is_recognised_suppression ( Char* name, Supp *su ); -Bool pc_read_extra_suppression_info ( Int fd, Char** bufpp, +Bool pc_is_recognised_suppression ( const HChar* name, Supp *su ); +Bool pc_read_extra_suppression_info ( Int fd, HChar** bufpp, SizeT* nBufp, Supp* su ); Bool pc_error_matches_suppression (Error* err, Supp* su); const HChar* pc_get_error_name ( Error* err ); @@ -63,7 +63,7 @@ extern Bool h_clo_partial_loads_ok; /* extern Bool h_clo_lossage_check; */ extern Bool sg_clo_enable_sg_checks; -Bool pc_process_cmd_line_options(Char* arg); +Bool pc_process_cmd_line_options(const HChar* arg); void pc_print_usage(void); void pc_print_debug_usage(void); diff --git a/helgrind/hg_basics.c b/helgrind/hg_basics.c index 00f4a8b136..9da1cd438a 100644 --- a/helgrind/hg_basics.c +++ b/helgrind/hg_basics.c @@ -58,7 +58,7 @@ void HG_(free) ( void* p ) VG_(free)(p); } -Char* HG_(strdup) ( const HChar* cc, const Char* s ) +HChar* HG_(strdup) ( const HChar* cc, const HChar* s ) { return VG_(strdup)( cc, s ); } diff --git a/helgrind/hg_basics.h b/helgrind/hg_basics.h index 6d9d5f45bb..93f015486a 100644 --- a/helgrind/hg_basics.h +++ b/helgrind/hg_basics.h @@ -39,9 +39,9 @@ #define HG_(str) VGAPPEND(vgHelgrind_,str) -void* HG_(zalloc) ( const HChar* cc, SizeT n ); -void HG_(free) ( void* p ); -Char* HG_(strdup) ( const HChar* cc, const Char* s ); +void* HG_(zalloc) ( const HChar* cc, SizeT n ); +void HG_(free) ( void* p ); +HChar* HG_(strdup) ( const HChar* cc, const HChar* s ); static inline Bool HG_(is_sane_ThreadId) ( ThreadId coretid ) { return coretid >= 0 && coretid < VG_N_THREADS; diff --git a/helgrind/hg_errors.c b/helgrind/hg_errors.c index 9a51ad1fd2..8a6c1d4ae5 100644 --- a/helgrind/hg_errors.c +++ b/helgrind/hg_errors.c @@ -66,7 +66,7 @@ static Word string_table_cmp ( UWord s1, UWord s2 ) { return (Word)VG_(strcmp)( (HChar*)s1, (HChar*)s2 ); } -static HChar* string_table_strdup ( HChar* str ) { +static HChar* string_table_strdup ( const HChar* str ) { HChar* copy = NULL; HG_(stats__string_table_queries)++; if (!str) @@ -84,7 +84,7 @@ static HChar* string_table_strdup ( HChar* str ) { } else { copy = HG_(strdup)("hg.sts.2", str); tl_assert(copy); - VG_(addToFM)( string_table, (Word)copy, (Word)copy ); + VG_(addToFM)( string_table, (UWord)copy, (UWord)copy ); return copy; } } @@ -1347,7 +1347,7 @@ const HChar* HG_(get_error_name) ( Error* err ) } } -Bool HG_(recognised_suppression) ( Char* name, Supp *su ) +Bool HG_(recognised_suppression) ( const HChar* name, Supp *su ) { # define TRY(_name,_xskind) \ if (0 == VG_(strcmp)(name, (_name))) { \ @@ -1366,7 +1366,7 @@ Bool HG_(recognised_suppression) ( Char* name, Supp *su ) # undef TRY } -Bool HG_(read_extra_suppression_info) ( Int fd, Char** bufpp, SizeT* nBufp, +Bool HG_(read_extra_suppression_info) ( Int fd, HChar** bufpp, SizeT* nBufp, Supp* su ) { /* do nothing -- no extra suppression info present. Return True to diff --git a/helgrind/hg_errors.h b/helgrind/hg_errors.h index 919ff52845..eb2285906b 100644 --- a/helgrind/hg_errors.h +++ b/helgrind/hg_errors.h @@ -39,8 +39,8 @@ Bool HG_(eq_Error) ( VgRes not_used, Error* e1, Error* e2 ); void HG_(before_pp_Error) ( Error* err ); void HG_(pp_Error) ( Error* err ); UInt HG_(update_extra) ( Error* err ); -Bool HG_(recognised_suppression) ( Char* name, Supp *su ); -Bool HG_(read_extra_suppression_info) ( Int fd, Char** bufpp, SizeT* nBufp, +Bool HG_(recognised_suppression) ( const HChar* name, Supp *su ); +Bool HG_(read_extra_suppression_info) ( Int fd, HChar** bufpp, SizeT* nBufp, Supp* su ); Bool HG_(error_matches_suppression) ( Error* err, Supp* su ); const HChar* HG_(get_error_name) ( Error* err ); diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index b4ea174f95..c5bea8c89d 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -1725,7 +1725,7 @@ void evh__pre_mem_read_asciiz ( CorePart part, ThreadId tid, // checking the first byte is better than nothing. See #255009. if (!VG_(am_is_valid_for_client) (a, 1, VKI_PROT_READ)) return; - len = VG_(strlen)( (Char*) a ); + len = VG_(strlen)( (HChar*) a ); shadow_mem_cread_range( map_threads_lookup(tid), a, len+1 ); if (len >= SCE_BIGRANGE_T && (HG_(clo_sanity_flags) & SCE_BIGRANGE)) all__sanity_check("evh__pre_mem_read_asciiz-post"); @@ -4295,7 +4295,7 @@ static void instrument_mem_access ( IRSB* sbOut, static Bool is_in_dynamic_linker_shared_object( Addr64 ga ) { DebugInfo* dinfo; - const UChar* soname; + const HChar* soname; if (0) return False; dinfo = VG_(find_DebugInfo)( (Addr)ga ); @@ -4838,7 +4838,7 @@ Bool hg_handle_client_request ( ThreadId tid, UWord* args, UWord* ret) break; case _VG_USERREQ__HG_CLIENTREQ_UNIMP: { - /* char* who */ + /* HChar* who */ HChar* who = (HChar*)args[1]; HChar buf[50 + 50]; Thread* thr = map_threads_maybe_lookup( tid ); @@ -4880,9 +4880,9 @@ Bool hg_handle_client_request ( ThreadId tid, UWord* args, UWord* ret) /*--- Setup ---*/ /*----------------------------------------------------------------*/ -static Bool hg_process_cmd_line_option ( Char* arg ) +static Bool hg_process_cmd_line_option ( const HChar* arg ) { - Char* tmp_str; + const HChar* tmp_str; if VG_BOOL_CLO(arg, "--track-lockorders", HG_(clo_track_lockorders)) {} diff --git a/include/pub_tool_debuginfo.h b/include/pub_tool_debuginfo.h index 133784a705..e35af22a9a 100644 --- a/include/pub_tool_debuginfo.h +++ b/include/pub_tool_debuginfo.h @@ -216,8 +216,8 @@ void VG_(DebugInfo_syms_getidx) ( const DebugInfo *di, /*OUT*/Addr* avma, /*OUT*/Addr* tocptr, /*OUT*/UInt* size, - /*OUT*/UChar** pri_name, - /*OUT*/UChar*** sec_names, + /*OUT*/HChar** pri_name, + /*OUT*/HChar*** sec_names, /*OUT*/Bool* isText, /*OUT*/Bool* isIFunc ); diff --git a/include/pub_tool_errormgr.h b/include/pub_tool_errormgr.h index 4d6af065b1..039115ddd5 100644 --- a/include/pub_tool_errormgr.h +++ b/include/pub_tool_errormgr.h @@ -94,7 +94,7 @@ extern Bool VG_(unique_error) ( ThreadId tid, ErrorKind ekind, the process). (It will bomb out if the size gets ridiculous). Skips leading spaces on the line. Increments lineno with the number of lines read if lineno is non-NULL. Returns True if EOF was hit. */ -extern Bool VG_(get_line) ( Int fd, Char** bufpp, SizeT* nBufp, Int* lineno ); +extern Bool VG_(get_line) ( Int fd, HChar** bufpp, SizeT* nBufp, Int* lineno ); /* ------------------------------------------------------------------ */ @@ -119,13 +119,13 @@ typedef /* Useful in VG_(tdict).tool_error_matches_suppression() */ SuppKind VG_(get_supp_kind) ( Supp* su ); -Char* VG_(get_supp_string) ( Supp* su ); +HChar* VG_(get_supp_string) ( Supp* su ); void* VG_(get_supp_extra) ( Supp* su ); /* Must be used in VG_(recognised_suppression)() */ void VG_(set_supp_kind) ( Supp* su, SuppKind suppkind ); /* May be used in VG_(read_extra_suppression_info)() */ -void VG_(set_supp_string) ( Supp* su, Char* string ); +void VG_(set_supp_string) ( Supp* su, HChar* string ); void VG_(set_supp_extra) ( Supp* su, void* extra ); diff --git a/include/pub_tool_gdbserver.h b/include/pub_tool_gdbserver.h index 8ceba7b8bc..03a43b4f73 100644 --- a/include/pub_tool_gdbserver.h +++ b/include/pub_tool_gdbserver.h @@ -170,7 +170,7 @@ extern Int VG_(keyword_id) (Char* keywords, Char* input_word, user problems via VG_(gdb_printf). */ extern void VG_(strtok_get_address_and_size) (Addr* address, SizeT* szB, - Char **ssaveptr); + HChar **ssaveptr); #endif // __PUB_TOOL_GDBSERVER_H diff --git a/include/pub_tool_libcbase.h b/include/pub_tool_libcbase.h index 304aa0c819..f1b47f57f1 100644 --- a/include/pub_tool_libcbase.h +++ b/include/pub_tool_libcbase.h @@ -35,9 +35,9 @@ Char functions. ------------------------------------------------------------------ */ -extern Bool VG_(isspace) ( Char c ); -extern Bool VG_(isdigit) ( Char c ); -extern Char VG_(tolower) ( Char c ); +extern Bool VG_(isspace) ( HChar c ); +extern Bool VG_(isdigit) ( HChar c ); +extern HChar VG_(tolower) ( HChar c ); /* --------------------------------------------------------------------- Converting strings to numbers @@ -61,16 +61,16 @@ extern Char VG_(tolower) ( Char c ); // useless because they don't do any error checking and so accept malformed // numbers and non-numbers -- eg. "123xyz" gives 123, and "foo" gives 0! // If you really want that behaviour, you can use "VG_(strtoll10)(str, NULL)". -extern Long VG_(strtoll10) ( Char* str, Char** endptr ); -extern Long VG_(strtoll16) ( Char* str, Char** endptr ); -extern ULong VG_(strtoull10) ( Char* str, Char** endptr ); -extern ULong VG_(strtoull16) ( Char* str, Char** endptr ); +extern Long VG_(strtoll10) ( const HChar* str, HChar** endptr ); +extern Long VG_(strtoll16) ( const HChar* str, HChar** endptr ); +extern ULong VG_(strtoull10) ( const HChar* str, HChar** endptr ); +extern ULong VG_(strtoull16) ( const HChar* str, HChar** endptr ); // Convert a string to a double. After leading whitespace is ignored, a // '+' or '-' is allowed, and then it accepts a non-empty sequence of // decimal digits possibly containing a '.'. Hexadecimal floats are not // accepted, nor are "fancy" floats (eg. "3.4e-5", "NAN"). -extern double VG_(strtod) ( Char* str, Char** endptr ); +extern double VG_(strtod) ( const HChar* str, HChar** endptr ); /* --------------------------------------------------------------------- String functions and macros @@ -82,36 +82,36 @@ extern double VG_(strtod) ( Char* str, Char** endptr ); #define VG_STREQN(n,s1,s2) ( (s1 != NULL && s2 != NULL \ && VG_(strncmp)((s1),(s2),(n))==0) ? True : False ) -extern SizeT VG_(strlen) ( const Char* str ); -extern Char* VG_(strcat) ( Char* dest, const Char* src ); -extern Char* VG_(strncat) ( Char* dest, const Char* src, SizeT n ); -extern Char* VG_(strpbrk) ( const Char* s, const Char* accpt ); -extern Char* VG_(strcpy) ( Char* dest, const Char* src ); -extern Char* VG_(strncpy) ( Char* dest, const Char* src, SizeT ndest ); -extern Int VG_(strcmp) ( const Char* s1, const Char* s2 ); -extern Int VG_(strcasecmp) ( const Char* s1, const Char* s2 ); -extern Int VG_(strncmp) ( const Char* s1, const Char* s2, SizeT nmax ); -extern Int VG_(strncasecmp) ( const Char* s1, const Char* s2, SizeT nmax ); -extern Char* VG_(strstr) ( const Char* haystack, const Char* needle ); -extern Char* VG_(strcasestr) ( const Char* haystack, const Char* needle ); -extern Char* VG_(strchr) ( const Char* s, Char c ); -extern Char* VG_(strrchr) ( const Char* s, Char c ); -extern SizeT VG_(strspn) ( const Char* s, const Char* accpt ); -extern SizeT VG_(strcspn) ( const Char* s, const Char* reject ); +extern SizeT VG_(strlen) ( const HChar* str ); +extern HChar* VG_(strcat) ( HChar* dest, const HChar* src ); +extern HChar* VG_(strncat) ( HChar* dest, const HChar* src, SizeT n ); +extern HChar* VG_(strpbrk) ( const HChar* s, const HChar* accpt ); +extern HChar* VG_(strcpy) ( HChar* dest, const HChar* src ); +extern HChar* VG_(strncpy) ( HChar* dest, const HChar* src, SizeT ndest ); +extern Int VG_(strcmp) ( const HChar* s1, const HChar* s2 ); +extern Int VG_(strcasecmp) ( const HChar* s1, const HChar* s2 ); +extern Int VG_(strncmp) ( const HChar* s1, const HChar* s2, SizeT nmax ); +extern Int VG_(strncasecmp) ( const HChar* s1, const HChar* s2, SizeT nmax ); +extern HChar* VG_(strstr) ( const HChar* haystack, const HChar* needle ); +extern HChar* VG_(strcasestr) ( const HChar* haystack, const HChar* needle ); +extern HChar* VG_(strchr) ( const HChar* s, HChar c ); +extern HChar* VG_(strrchr) ( const HChar* s, HChar c ); +extern SizeT VG_(strspn) ( const HChar* s, const HChar* accpt ); +extern SizeT VG_(strcspn) ( const HChar* s, const HChar* reject ); /* strtok* functions and some parsing utilities. */ -extern Char* VG_(strtok_r) (Char* s, const Char* delim, Char** saveptr); -extern Char* VG_(strtok) (Char* s, const Char* delim); +extern HChar* VG_(strtok_r) (HChar* s, const HChar* delim, HChar** saveptr); +extern HChar* VG_(strtok) (HChar* s, const HChar* delim); /* Parse a 32- or 64-bit hex number, including leading 0x, from string starting at *ppc, putting result in *result, and return True. Or fail, in which case *ppc and *result are undefined, and return False. */ -extern Bool VG_(parse_Addr) ( UChar** ppc, Addr* result ); +extern Bool VG_(parse_Addr) ( const HChar** ppc, Addr* result ); /* Like strncpy(), but if 'src' is longer than 'ndest' inserts a '\0' as the last character. */ -extern void VG_(strncpy_safely) ( Char* dest, const Char* src, SizeT ndest ); +extern void VG_(strncpy_safely) ( HChar* dest, const HChar* src, SizeT ndest ); /* --------------------------------------------------------------------- mem* functions diff --git a/include/pub_tool_libcfile.h b/include/pub_tool_libcfile.h index 9777a3dd16..b9acc1c69c 100644 --- a/include/pub_tool_libcfile.h +++ b/include/pub_tool_libcfile.h @@ -68,38 +68,38 @@ struct vg_stat { ULong ctime_nsec; }; -extern SysRes VG_(mknod) ( const Char* pathname, Int mode, UWord dev ); -extern SysRes VG_(open) ( const Char* pathname, Int flags, Int mode ); +extern SysRes VG_(mknod) ( const HChar* pathname, Int mode, UWord dev ); +extern SysRes VG_(open) ( const HChar* pathname, Int flags, Int mode ); /* fd_open words like the open(2) system call: returns fd if success, -1 otherwise */ -extern Int VG_(fd_open) (const Char* pathname, Int flags, Int mode); +extern Int VG_(fd_open) (const HChar* pathname, Int flags, Int mode); extern void VG_(close) ( Int fd ); extern Int VG_(read) ( Int fd, void* buf, Int count); extern Int VG_(write) ( Int fd, const void* buf, Int count); extern Int VG_(pipe) ( Int fd[2] ); extern Off64T VG_(lseek) ( Int fd, Off64T offset, Int whence ); -extern SysRes VG_(stat) ( const Char* file_name, struct vg_stat* buf ); +extern SysRes VG_(stat) ( const HChar* file_name, struct vg_stat* buf ); extern Int VG_(fstat) ( Int fd, struct vg_stat* buf ); extern SysRes VG_(dup) ( Int oldfd ); extern SysRes VG_(dup2) ( Int oldfd, Int newfd ); -extern Int VG_(rename) ( const Char* old_name, const Char* new_name ); -extern Int VG_(unlink) ( const Char* file_name ); +extern Int VG_(rename) ( const HChar* old_name, const HChar* new_name ); +extern Int VG_(unlink) ( const HChar* file_name ); extern Int VG_(poll) (struct vki_pollfd *fds, Int nfds, Int timeout); -extern Int VG_(readlink)( const Char* path, Char* buf, UInt bufsize ); +extern Int VG_(readlink)( const HChar* path, HChar* buf, UInt bufsize ); extern Int VG_(getdents)( Int fd, struct vki_dirent *dirp, UInt count ); -extern Char* VG_(basename)( const Char* path ); -extern Char* VG_(dirname) ( const Char* path ); +extern HChar* VG_(basename)( const HChar* path ); +extern HChar* VG_(dirname) ( const HChar* path ); /* Return the name of a directory for temporary files. */ extern const HChar* VG_(tmpdir)(void); /* Copy the working directory at startup into buf[0 .. size-1], or return False if buf is too small. */ -extern Bool VG_(get_startup_wd) ( Char* buf, SizeT size ); +extern Bool VG_(get_startup_wd) ( HChar* buf, SizeT size ); #endif // __PUB_TOOL_LIBCFILE_H diff --git a/include/pub_tool_libcproc.h b/include/pub_tool_libcproc.h index c580f512d9..7432b82ae4 100644 --- a/include/pub_tool_libcproc.h +++ b/include/pub_tool_libcproc.h @@ -36,26 +36,26 @@ ------------------------------------------------------------------ */ /* Client environment. */ -extern Char** VG_(client_envp); +extern HChar** VG_(client_envp); /* Looks up VG_(client_envp) */ -extern Char* VG_(getenv) ( Char* name ); +extern HChar* VG_(getenv) ( const HChar* name ); /* Path to all our library/aux files */ -extern const Char *VG_(libdir); +extern const HChar *VG_(libdir); // The name of the LD_PRELOAD-equivalent variable. It varies across // platforms. -extern const Char* VG_(LD_PRELOAD_var_name); +extern const HChar* VG_(LD_PRELOAD_var_name); /* --------------------------------------------------------------------- Important syscalls ------------------------------------------------------------------ */ extern Int VG_(waitpid)( Int pid, Int *status, Int options ); -extern Int VG_(system) ( Char* cmd ); +extern Int VG_(system) ( const HChar* cmd ); extern Int VG_(fork) ( void); -extern void VG_(execv) ( Char* filename, Char** argv ); +extern void VG_(execv) ( const HChar* filename, HChar** argv ); /* --------------------------------------------------------------------- Resource limits and capabilities diff --git a/include/pub_tool_mallocfree.h b/include/pub_tool_mallocfree.h index 76167edaa3..ac5de77406 100644 --- a/include/pub_tool_mallocfree.h +++ b/include/pub_tool_mallocfree.h @@ -40,8 +40,8 @@ extern void* VG_(malloc) ( const HChar* cc, SizeT nbytes ); extern void VG_(free) ( void* p ); extern void* VG_(calloc) ( const HChar* cc, SizeT n, SizeT bytes_per_elem ); -extern void* VG_(realloc) ( const HChar* cc, void* p, SizeT size ); -extern Char* VG_(strdup) ( const HChar* cc, const Char* s ); +extern void* VG_(realloc) ( const HChar* cc, void* p, SizeT size ); +extern HChar* VG_(strdup) ( const HChar* cc, const HChar* s ); // Returns the usable size of a heap-block. It's the asked-for size plus // possibly some more due to rounding up. diff --git a/include/pub_tool_options.h b/include/pub_tool_options.h index fd90f44330..ef13712656 100644 --- a/include/pub_tool_options.h +++ b/include/pub_tool_options.h @@ -51,7 +51,7 @@ #define VG_BOOL_CLO(qq_arg, qq_option, qq_var) \ (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \ ({ \ - Char* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ + const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ if VG_STREQ(val, "yes") (qq_var) = True; \ else if VG_STREQ(val, "no") (qq_var) = False; \ else VG_(fmsg_bad_option)(qq_arg, "Invalid boolean value '%s'" \ @@ -64,7 +64,7 @@ #define VG_STR_CLO(qq_arg, qq_option, qq_var) \ (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \ ({ \ - Char* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ + const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ (qq_var) = val; \ True; \ }) \ @@ -74,8 +74,8 @@ #define VG_INT_CLO(qq_arg, qq_option, qq_var) \ (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \ ({ \ - Char* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ - Char* s; \ + const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ + HChar* s; \ Long n = VG_(strtoll10)( val, &s ); \ (qq_var) = n; \ /* Check for non-numeralness, or overflow. */ \ @@ -89,8 +89,8 @@ #define VG_BINTN_CLO(qq_base, qq_arg, qq_option, qq_var, qq_lo, qq_hi) \ (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \ ({ \ - Char* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ - Char* s; \ + const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ + HChar* s; \ Long n = VG_(strtoll##qq_base)( val, &s ); \ (qq_var) = n; \ /* MMM: separate the two cases, and explain the problem; likewise */ \ @@ -122,8 +122,8 @@ #define VG_DBL_CLO(qq_arg, qq_option, qq_var) \ (VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=") && \ ({ \ - Char* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ - Char* s; \ + const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \ + HChar* s; \ double n = VG_(strtod)( val, &s ); \ (qq_var) = n; \ /* Check for non-numeralness */ \ @@ -161,7 +161,7 @@ extern Bool VG_(clo_xml); /* An arbitrary user-supplied string which is copied into the XML output, in between tags. */ -extern HChar* VG_(clo_xml_user_comment); +extern const HChar* VG_(clo_xml_user_comment); /* Vex iropt control. Tool-visible so tools can make Vex optimise less aggressively if that is needed (callgrind needs this). */ @@ -192,7 +192,8 @@ extern Bool VG_(clo_show_below_main); merely used in printing error messages, if an error message needs to be printed due to malformedness of the "format" argument. */ -extern Char* VG_(expand_file_name)(Char* option_name, Char* format); +extern HChar* VG_(expand_file_name)(const HChar* option_name, + const HChar* format); #endif // __PUB_TOOL_OPTIONS_H diff --git a/include/pub_tool_replacemalloc.h b/include/pub_tool_replacemalloc.h index 3b6b9270f2..97a9667186 100644 --- a/include/pub_tool_replacemalloc.h +++ b/include/pub_tool_replacemalloc.h @@ -63,7 +63,7 @@ extern Bool VG_(clo_trace_malloc); default: VG_MIN_MALLOC_SZB */ extern UInt VG_(clo_alignment); -extern Bool VG_(replacement_malloc_process_cmd_line_option) ( Char* arg ); +extern Bool VG_(replacement_malloc_process_cmd_line_option) ( const HChar* arg ); #endif // __PUB_TOOL_REPLACEMALLOC_H diff --git a/include/pub_tool_seqmatch.h b/include/pub_tool_seqmatch.h index c095599583..a62a18ff59 100644 --- a/include/pub_tool_seqmatch.h +++ b/include/pub_tool_seqmatch.h @@ -89,7 +89,7 @@ Bool VG_(generic_match) ( /* Mini-regexp function. Searches for 'pat' in 'str'. Supports meta-symbols '*' and '?'. There is no way to escape meta-symbols in the pattern. */ -Bool VG_(string_match) ( const Char* pat, const Char* str ); +Bool VG_(string_match) ( const HChar* pat, const HChar* str ); #endif // __PUB_TOOL_SEQMATCH_H diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h index cdd70a4bcf..2dd38f3849 100644 --- a/include/pub_tool_tooliface.h +++ b/include/pub_tool_tooliface.h @@ -313,14 +313,14 @@ extern void VG_(needs_tool_errors) ( // Return value indicates recognition. If recognised, must set skind using // VG_(set_supp_kind)(). - Bool (*recognised_suppression)(Char* name, Supp* su), + Bool (*recognised_suppression)(const HChar* name, Supp* su), // Read any extra info for this suppression kind. Most likely for filling // in the `extra' and `string' parts (with VG_(set_supp_{extra, string})()) // of a suppression if necessary. Should return False if a syntax error // occurred, True otherwise. bufpp and nBufp are the same as for // VG_(get_line). - Bool (*read_extra_suppression_info)(Int fd, Char** bufpp, SizeT* nBufp, + Bool (*read_extra_suppression_info)(Int fd, HChar** bufpp, SizeT* nBufp, Supp* su), // This should just check the kinds match and maybe some stuff in the @@ -386,7 +386,7 @@ extern void VG_(needs_command_line_options) ( // if possible rather than in post_clo_init(), and if they are bad then // VG_(fmsg_bad_option)() should be called. This ensures that the // messaging is consistent with command line option errors from the core. - Bool (*process_cmd_line_option)(Char* argv), + Bool (*process_cmd_line_option)(const HChar* argv), // Print out command line usage for options for normal tool operation. void (*print_usage)(void), diff --git a/lackey/lk_main.c b/lackey/lk_main.c index 98f824e3b9..42a0552b16 100644 --- a/lackey/lk_main.c +++ b/lackey/lk_main.c @@ -192,9 +192,9 @@ static Bool clo_trace_sbs = False; /* The name of the function of which the number of calls (under * --basic-counts=yes) is to be counted, with default. Override with command * line option --fnname. */ -static HChar* clo_fnname = "main"; +static const HChar* clo_fnname = "main"; -static Bool lk_process_cmd_line_option(Char* arg) +static Bool lk_process_cmd_line_option(const HChar* arg) { if VG_STR_CLO(arg, "--fnname", clo_fnname) {} else if VG_BOOL_CLO(arg, "--basic-counts", clo_basic_counts) {} @@ -321,7 +321,7 @@ static Int type2index ( IRType ty ) } } -static HChar* nameOfTypeIndex ( Int i ) +static const HChar* nameOfTypeIndex ( Int i ) { switch (i) { case 0: return "I1"; break; @@ -467,7 +467,7 @@ static VG_REGPARM(2) void trace_modify(Addr addr, SizeT size) static void flushEvents(IRSB* sb) { Int i; - HChar* helperName; + const HChar* helperName; void* helperAddr; IRExpr** argv; IRDirty* di; @@ -611,7 +611,7 @@ IRSB* lk_instrument ( VgCallbackClosure* closure, IRDirty* di; Int i; IRSB* sbOut; - Char fnname[100]; + HChar fnname[100]; IRType type; IRTypeEnv* tyenv = sbIn->tyenv; Addr iaddr = 0, dst; @@ -911,7 +911,7 @@ IRSB* lk_instrument ( VgCallbackClosure* closure, static void lk_fini(Int exitcode) { - char percentify_buf[5]; /* Two digits, '%' and 0. */ + HChar percentify_buf[5]; /* Two digits, '%' and 0. */ const int percentify_size = sizeof(percentify_buf) - 1; const int percentify_decs = 0; diff --git a/massif/ms_main.c b/massif/ms_main.c index 3b7d0247d9..32421b100f 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -310,7 +310,7 @@ static void init_alloc_fns(void) { // Create the list, and add the default elements. alloc_fns = VG_(newXA)(VG_(malloc), "ms.main.iaf.1", - VG_(free), sizeof(Char*)); + VG_(free), sizeof(HChar*)); #define DO(x) { HChar* s = x; VG_(addToXA)(alloc_fns, &s); } // Ordered roughly according to (presumed) frequency. @@ -357,13 +357,13 @@ static void init_ignore_fns(void) { // Create the (empty) list. ignore_fns = VG_(newXA)(VG_(malloc), "ms.main.iif.1", - VG_(free), sizeof(Char*)); + VG_(free), sizeof(HChar*)); } // Determines if the named function is a member of the XArray. -static Bool is_member_fn(XArray* fns, Char* fnname) +static Bool is_member_fn(XArray* fns, HChar* fnname) { - Char** fn_ptr; + HChar** fn_ptr; Int i; // Nb: It's a linear search through the list, because we're comparing @@ -411,13 +411,13 @@ static double clo_peak_inaccuracy = 1.0; // percentage static Int clo_time_unit = TimeI; static Int clo_detailed_freq = 10; static Int clo_max_snapshots = 100; -static HChar* clo_massif_out_file = "massif.out.%p"; +static const HChar* clo_massif_out_file = "massif.out.%p"; static XArray* args_for_massif; -static Bool ms_process_cmd_line_option(Char* arg) +static Bool ms_process_cmd_line_option(const HChar* arg) { - Char* tmp_str; + const HChar* tmp_str; // Remember the arg for later use. VG_(addToXA)(args_for_massif, &arg); @@ -845,7 +845,7 @@ static void sanity_check_SXTree(SXPt* sxpt) // Determine if the given IP belongs to a function that should be ignored. static Bool fn_should_be_ignored(Addr ip) { - static Char buf[BUF_LEN]; + static HChar buf[BUF_LEN]; return ( VG_(get_fnname)(ip, buf, BUF_LEN) && is_member_fn(ignore_fns, buf) ? True : False ); @@ -860,7 +860,7 @@ static Bool fn_should_be_ignored(Addr ip) static Int get_IPs( ThreadId tid, Bool exclude_first_entry, Addr ips[]) { - static Char buf[BUF_LEN]; + static HChar buf[BUF_LEN]; Int n_ips, i, n_alloc_fns_removed; Int overestimate; Bool redo; @@ -2001,7 +2001,7 @@ static void print_monitor_help ( void ) /* Forward declaration. return True if request recognised, False otherwise */ -static Bool handle_gdb_monitor_command (ThreadId tid, Char *req); +static Bool handle_gdb_monitor_command (ThreadId tid, HChar *req); static Bool ms_handle_client_request ( ThreadId tid, UWord* argv, UWord* ret ) { switch (argv[0]) { @@ -2029,7 +2029,7 @@ static Bool ms_handle_client_request ( ThreadId tid, UWord* argv, UWord* ret ) return True; } case VG_USERREQ__GDB_MONITOR_COMMAND: { - Bool handled = handle_gdb_monitor_command (tid, (Char*)argv[1]); + Bool handled = handle_gdb_monitor_command (tid, (HChar*)argv[1]); if (handled) *ret = 1; else @@ -2150,7 +2150,7 @@ HChar FP_buf[BUF_LEN]; }) // Nb: uses a static buffer, each call trashes the last string returned. -static HChar* make_perc(double x) +static const HChar* make_perc(double x) { static HChar mbuf[32]; @@ -2161,7 +2161,7 @@ static HChar* make_perc(double x) return mbuf; } -static void pp_snapshot_SXPt(Int fd, SXPt* sxpt, Int depth, Char* depth_str, +static void pp_snapshot_SXPt(Int fd, SXPt* sxpt, Int depth, HChar* depth_str, Int depth_str_len, SizeT snapshot_heap_szB, SizeT snapshot_total_szB) { @@ -2304,8 +2304,8 @@ static void pp_snapshot(Int fd, Snapshot* snapshot, Int snapshot_n) if (is_detailed_snapshot(snapshot)) { // Detailed snapshot -- print heap tree. Int depth_str_len = clo_depth + 3; - Char* depth_str = VG_(malloc)("ms.main.pps.1", - sizeof(Char) * depth_str_len); + HChar* depth_str = VG_(malloc)("ms.main.pps.1", + sizeof(HChar) * depth_str_len); SizeT snapshot_total_szB = snapshot->heap_szB + snapshot->heap_extra_szB + snapshot->stacks_szB; depth_str[0] = '\0'; // Initialise depth_str to "". @@ -2322,7 +2322,7 @@ static void pp_snapshot(Int fd, Snapshot* snapshot, Int snapshot_n) } } -static void write_snapshots_to_file(Char* massif_out_file, +static void write_snapshots_to_file(const HChar* massif_out_file, Snapshot snapshots_array[], Int nr_elements) { @@ -2347,7 +2347,7 @@ static void write_snapshots_to_file(Char* massif_out_file, // implied genericity of "desc:" is bogus. FP("desc:"); for (i = 0; i < VG_(sizeXA)(args_for_massif); i++) { - Char* arg = *(Char**)VG_(indexXA)(args_for_massif, i); + HChar* arg = *(HChar**)VG_(indexXA)(args_for_massif, i); FP(" %s", arg); } if (0 == i) FP(" (none)"); @@ -2383,13 +2383,14 @@ static void write_snapshots_array_to_file(void) // output file format string contains a %p (pid) specifier, both the // parent and child will incorrectly write to the same file; this // happened in 3.3.0. - Char* massif_out_file = + HChar* massif_out_file = VG_(expand_file_name)("--massif-out-file", clo_massif_out_file); write_snapshots_to_file (massif_out_file, snapshots, next_snapshot_i); VG_(free)(massif_out_file); } -static void handle_snapshot_monitor_command (Char *filename, Bool detailed) +static void handle_snapshot_monitor_command (const HChar *filename, + Bool detailed) { Snapshot snapshot; @@ -2403,17 +2404,17 @@ static void handle_snapshot_monitor_command (Char *filename, Bool detailed) clear_snapshot(&snapshot, /* do_sanity_check */ False); take_snapshot(&snapshot, Normal, get_time(), detailed); write_snapshots_to_file ((filename == NULL) ? - (Char*) "massif.vgdb.out" : filename, + "massif.vgdb.out" : filename, &snapshot, 1); delete_snapshot(&snapshot); } -static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) +static Bool handle_gdb_monitor_command (ThreadId tid, HChar *req) { - Char* wcmd; - Char s[VG_(strlen(req))]; /* copy for strtok_r */ - Char *ssaveptr; + HChar* wcmd; + HChar s[VG_(strlen(req))]; /* copy for strtok_r */ + HChar *ssaveptr; VG_(strcpy) (s, req); @@ -2428,13 +2429,13 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) print_monitor_help(); return True; case 1: { /* snapshot */ - Char* filename; + HChar* filename; filename = VG_(strtok_r) (NULL, " ", &ssaveptr); handle_snapshot_monitor_command (filename, False /* detailed */); return True; } case 2: { /* detailed_snapshot */ - Char* filename; + HChar* filename; filename = VG_(strtok_r) (NULL, " ", &ssaveptr); handle_snapshot_monitor_command (filename, True /* detailed */); return True; @@ -2488,9 +2489,9 @@ static void ms_fini(Int exit_status) static void ms_post_clo_init(void) { Int i; - Char* LD_PRELOAD_val; - Char* s; - Char* s2; + HChar* LD_PRELOAD_val; + HChar* s; + HChar* s2; // Check options. if (clo_pages_as_heap) { @@ -2512,7 +2513,7 @@ static void ms_post_clo_init(void) if (clo_pages_as_heap) { clo_heap_admin = 0; // No heap admin on pages. - LD_PRELOAD_val = VG_(getenv)( (Char*)VG_(LD_PRELOAD_var_name) ); + LD_PRELOAD_val = VG_(getenv)( VG_(LD_PRELOAD_var_name) ); tl_assert(LD_PRELOAD_val); // Make sure the vgpreload_core-$PLATFORM entry is there, for sanity. @@ -2540,7 +2541,7 @@ static void ms_post_clo_init(void) if (VG_(clo_verbosity) > 1) { VERB(1, "alloc-fns:\n"); for (i = 0; i < VG_(sizeXA)(alloc_fns); i++) { - Char** fn_ptr = VG_(indexXA)(alloc_fns, i); + HChar** fn_ptr = VG_(indexXA)(alloc_fns, i); VERB(1, " %s\n", *fn_ptr); } @@ -2549,7 +2550,7 @@ static void ms_post_clo_init(void) VERB(1, " \n"); } for (i = 0; i < VG_(sizeXA)(ignore_fns); i++) { - Char** fn_ptr = VG_(indexXA)(ignore_fns, i); + HChar** fn_ptr = VG_(indexXA)(ignore_fns, i); VERB(1, " %d: %s\n", i, *fn_ptr); } } diff --git a/memcheck/mc_errors.c b/memcheck/mc_errors.c index bbbc56b99f..b140b16aa1 100644 --- a/memcheck/mc_errors.c +++ b/memcheck/mc_errors.c @@ -108,7 +108,7 @@ struct _AddrInfo { // In a global .data symbol. This holds the first 127 chars of // the variable's name (zero terminated), plus a (memory) offset. struct { - Char name[128]; + HChar name[128]; PtrdiffT offset; } DataSym; @@ -121,7 +121,7 @@ struct _AddrInfo { // Could only narrow it down to be the PLT/GOT/etc of a given // object. Better than nothing, perhaps. struct { - Char objname[128]; + HChar objname[128]; VgSectKind kind; } SectKind; @@ -1411,7 +1411,7 @@ typedef } MC_SuppKind; -Bool MC_(is_recognised_suppression) ( Char* name, Supp* su ) +Bool MC_(is_recognised_suppression) ( const HChar* name, Supp* su ) { SuppKind skind; @@ -1442,7 +1442,7 @@ Bool MC_(is_recognised_suppression) ( Char* name, Supp* su ) return True; } -Bool MC_(read_extra_suppression_info) ( Int fd, Char** bufpp, +Bool MC_(read_extra_suppression_info) ( Int fd, HChar** bufpp, SizeT* nBufp, Supp *su ) { Bool eof; diff --git a/memcheck/mc_include.h b/memcheck/mc_include.h index 52ae577021..797dce2965 100644 --- a/memcheck/mc_include.h +++ b/memcheck/mc_include.h @@ -372,9 +372,9 @@ void MC_(before_pp_Error) ( Error* err ); void MC_(pp_Error) ( Error* err ); UInt MC_(update_Error_extra) ( Error* err ); -Bool MC_(is_recognised_suppression) ( Char* name, Supp* su ); +Bool MC_(is_recognised_suppression) ( const HChar* name, Supp* su ); -Bool MC_(read_extra_suppression_info) ( Int fd, Char** buf, +Bool MC_(read_extra_suppression_info) ( Int fd, HChar** buf, SizeT* nBuf, Supp *su ); Bool MC_(error_matches_suppression) ( Error* err, Supp* su ); diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c index 1e3a3767a3..e8482918d3 100644 --- a/memcheck/mc_leakcheck.c +++ b/memcheck/mc_leakcheck.c @@ -1116,8 +1116,8 @@ static void print_results(ThreadId tid, LeakCheckParams* lcp) } if (VG_(clo_verbosity) > 0 && !VG_(clo_xml)) { - char d_bytes[20]; - char d_blocks[20]; + HChar d_bytes[20]; + HChar d_blocks[20]; VG_(umsg)("LEAK SUMMARY:\n"); VG_(umsg)(" definitely lost: %'lu%s bytes in %'lu%s blocks\n", diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c index 8d3455e2fa..812c613fb7 100644 --- a/memcheck/mc_main.c +++ b/memcheck/mc_main.c @@ -410,7 +410,7 @@ static void init_auxmap_L1_L2 ( void ) non-distinguished secondary maps referred to from the auxiliary primary maps. */ -static HChar* check_auxmap_L1_L2_sanity ( Word* n_secmaps_found ) +static const HChar* check_auxmap_L1_L2_sanity ( Word* n_secmaps_found ) { Word i, j; /* On a 32-bit platform, the L2 and L1 tables should @@ -1082,7 +1082,7 @@ INLINE Bool MC_(in_ignored_range) ( Addr a ) /* Parse two Addr separated by a dash, or fail. */ -static Bool parse_range ( UChar** ppc, Addr* result1, Addr* result2 ) +static Bool parse_range ( const HChar** ppc, Addr* result1, Addr* result2 ) { Bool ok = VG_(parse_Addr) (ppc, result1); if (!ok) @@ -1099,12 +1099,12 @@ static Bool parse_range ( UChar** ppc, Addr* result1, Addr* result2 ) /* Parse a set of ranges separated by commas into 'ignoreRanges', or fail. */ -static Bool parse_ignore_ranges ( UChar* str0 ) +static Bool parse_ignore_ranges ( const HChar* str0 ) { Addr start, end; Bool ok; - UChar* str = str0; - UChar** ppc = &str; + const HChar* str = str0; + const HChar** ppc = &str; ignoreRanges.used = 0; while (1) { ok = parse_range(ppc, &start, &end); @@ -4733,7 +4733,7 @@ static Bool mc_expensive_sanity_check ( void ) Int i; Word n_secmaps_found; SecMap* sm; - HChar* errmsg; + const HChar* errmsg; Bool bad = False; if (0) VG_(printf)("expensive sanity check\n"); @@ -4837,9 +4837,9 @@ Int MC_(clo_malloc_fill) = -1; Int MC_(clo_free_fill) = -1; Int MC_(clo_mc_level) = 2; -static Bool mc_process_cmd_line_options(Char* arg) +static Bool mc_process_cmd_line_options(const HChar* arg) { - Char* tmp_str; + const HChar* tmp_str; tl_assert( MC_(clo_mc_level) >= 1 && MC_(clo_mc_level) <= 3 ); @@ -5098,11 +5098,11 @@ static void print_monitor_help ( void ) } /* return True if request recognised, False otherwise */ -static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) +static Bool handle_gdb_monitor_command (ThreadId tid, HChar *req) { - Char* wcmd; - Char s[VG_(strlen(req))]; /* copy for strtok_r */ - Char *ssaveptr; + HChar* wcmd; + HChar s[VG_(strlen(req))]; /* copy for strtok_r */ + HChar *ssaveptr; VG_(strcpy) (s, req); @@ -5160,7 +5160,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) case 2: { /* leak_check */ Int err = 0; LeakCheckParams lcp; - Char* kw; + HChar* kw; lcp.mode = LC_Full; lcp.show_reachable = False; @@ -5202,15 +5202,15 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) case 8: /* unlimited */ lcp.max_loss_records_output = 999999999; break; case 9: { /* limited */ - int int_value; - char* endptr; + Int int_value; + HChar* endptr; wcmd = VG_(strtok_r) (NULL, " ", &ssaveptr); if (wcmd == NULL) { int_value = 0; endptr = "empty"; /* to report an error below */ } else { - int_value = VG_(strtoll10) (wcmd, (Char **)&endptr); + int_value = VG_(strtoll10) (wcmd, &endptr); } if (*endptr != '\0') VG_(gdb_printf) ("missing or malformed integer value\n"); @@ -5233,7 +5233,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) case 3: { /* make_memory */ Addr address; SizeT szB = 1; - int kwdid = VG_(keyword_id) + Int kwdid = VG_(keyword_id) ("noaccess undefined defined Definedifaddressable", VG_(strtok_r) (NULL, " ", &ssaveptr), kwd_report_all); VG_(strtok_get_address_and_size) (&address, &szB, &ssaveptr); @@ -5256,13 +5256,13 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) SizeT szB = 1; Addr bad_addr; UInt okind; - char* src; + HChar* src; UInt otag; UInt ecu; ExeContext* origin_ec; MC_ReadResult res; - int kwdid = VG_(keyword_id) + Int kwdid = VG_(keyword_id) ("addressable defined", VG_(strtok_r) (NULL, " ", &ssaveptr), kwd_report_all); VG_(strtok_get_address_and_size) (&address, &szB, &ssaveptr); @@ -5319,8 +5319,8 @@ static Bool handle_gdb_monitor_command (ThreadId tid, Char *req) } case 5: { /* block_list */ - Char* wl; - Char *endptr; + HChar* wl; + HChar *endptr; UInt lr_nr = 0; wl = VG_(strtok_r) (NULL, " ", &ssaveptr); lr_nr = VG_(strtoull10) (wl, &endptr); @@ -5481,7 +5481,7 @@ static Bool mc_handle_client_request ( ThreadId tid, UWord* arg, UWord* ret ) /* VG_(printf)("allocated %d %p\n", i, cgbs); */ cgbs[i].start = arg[1]; cgbs[i].size = arg[2]; - cgbs[i].desc = (HChar *)VG_(strdup)("mc.mhcr.1", (Char *)arg[3]); + cgbs[i].desc = VG_(strdup)("mc.mhcr.1", (HChar *)arg[3]); cgbs[i].where = VG_(record_ExeContext) ( tid, 0/*first_ip_delta*/ ); *ret = i; } else @@ -5578,7 +5578,7 @@ static Bool mc_handle_client_request ( ThreadId tid, UWord* arg, UWord* ret ) } case _VG_USERREQ__MEMCHECK_RECORD_OVERLAP_ERROR: { - Char* s = (Char*)arg[1]; + HChar* s = (HChar*)arg[1]; Addr dst = (Addr) arg[2]; Addr src = (Addr) arg[3]; SizeT len = (SizeT)arg[4]; @@ -5654,7 +5654,7 @@ static Bool mc_handle_client_request ( ThreadId tid, UWord* arg, UWord* ret ) } case VG_USERREQ__GDB_MONITOR_COMMAND: { - Bool handled = handle_gdb_monitor_command (tid, (Char*)arg[1]); + Bool handled = handle_gdb_monitor_command (tid, (HChar*)arg[1]); if (handled) *ret = 1; else @@ -6131,7 +6131,7 @@ static void mc_post_clo_init ( void ) VG_(track_pre_reg_read) ( mc_pre_reg_read ); } -static void print_SM_info(char* type, int n_SMs) +static void print_SM_info(const HChar* type, Int n_SMs) { VG_(message)(Vg_DebugMsg, " memcheck: SMs: %s = %d (%ldk, %ldM)\n", diff --git a/memcheck/tests/unit_libcbase.c b/memcheck/tests/unit_libcbase.c index e90a8e20df..0b5777e756 100644 --- a/memcheck/tests/unit_libcbase.c +++ b/memcheck/tests/unit_libcbase.c @@ -342,8 +342,8 @@ void test_strtoll_and_strtod(void) // Nb: We test the results against strtoll() as well. int i; for (i = 0; i < (sizeof(a) / sizeof(StrtollInputs)); i++) { - Char* endptr1; - char* endptr2; + HChar* endptr1; + HChar* endptr2; Long res1 = VG_(strtoll10)(a[i].str, &endptr1); long long res2 = strtoll (a[i].str, &endptr2, 10); //printf("res1 = %lld, *endptr1 = '%c'\n", res1, *endptr1); @@ -397,8 +397,8 @@ void test_strtoll_and_strtod(void) // Nb: We test the results against strtoll() as well. int i; for (i = 0; i < (sizeof(a) / sizeof(StrtollInputs)); i++) { - Char* endptr1; - char* endptr2; + HChar* endptr1; + HChar* endptr2; Long res1 = VG_(strtoll16)(a[i].str, &endptr1); long long res2 = strtoll (a[i].str, &endptr2, 16); //printf(" res1 = %lld, *endptr1 = '%c'\n", res1, *endptr1);