}
-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.
}
-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);
// 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);
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 ---*/
// - 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;
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;
/*--- 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,
// 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;
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
// 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,
/*--- 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,
CLG_DEBUGIF(0) {
if (CLG_(clo).verbose<2) {
if (jcc && jcc->to && jcc->to->bb) {
- char spaces[][41] = { " . . . . . . . . . .",
+ const HChar spaces[][41] = {
+ " . . . . . . . . . .",
" . . . . . . . . . . ",
" . . . . . . . . . . ",
". . . . . . . . . . " };
config_node* wild_star;
config_node* wild_char;
- Char name[1];
+ HChar name[1];
};
/* root of trie */
}
-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",
}
static __inline__
-Bool is_wild(Char n)
+Bool is_wild(HChar n)
{
return (n == '*') || (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;
int i;
if (node != fn_configs) {
- char sp[] = " ";
+ const HChar sp[] = " ";
if (depth>40) depth=40;
VG_(printf)("%s", sp+40-depth);
}
/* 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;
* looking for a match to <name>. For every matching leaf,
* <fn> 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;
/*--- 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) {}
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);
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);
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);
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);
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);
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;
}
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);
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);
}
-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;
/* 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;
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);
/* 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 */
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;
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;
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);
eventGroup[i] = 0;
for(i=0; i< MAX_EVENTSET_COUNT; i++)
- eventSetTable[i] = 0;
+ eventSetTable[i] = 0;
eventSets_initialized = 1;
}
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;
struct chunk_t { int start, len; };
struct pattern
{
- const char* name;
+ const HChar* name;
int len;
struct chunk_t chunk[];
};
*/
__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;
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 };
"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,
#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,
#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,
#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++)
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++) {
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;
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;
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",
*/
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;
*/
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);
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);
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;
*/
struct _fn_node {
- Char* name;
+ HChar* name;
UInt number;
Context* last_cxt; /* LRU info */
Context* pure_cxt; /* the context with only the function itself */
#define N_BBCC2_ENTRIES 37
struct _file_node {
- Char* name;
+ HChar* name;
fn_node* fns[N_FN_ENTRIES];
UInt number;
obj_node* obj;
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);
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);
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);
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 */
/* 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 ---*/
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__)
}
/* 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);
}
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();
}
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");
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 */
}
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
static
void finish(void)
{
- Char buf[32+COSTS_LEN];
+ HChar buf[32+COSTS_LEN];
HChar fmt[128];
Int l1, l2, l3;
FullCost total;
*
* 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) {}
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;
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;
{
Int ret, i;
UInt level;
- Char vendor_id[13];
+ HChar vendor_id[13];
vg_assert(VG_(has_cpuid)());
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));
// 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);
/*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 )
{
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;
}
}
// 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)
/* 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;
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;
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;
/* 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.
};
return su->skind;
}
-Char* VG_(get_supp_string) ( Supp* su )
+HChar* VG_(get_supp_string) ( Supp* su )
{
return su->string;
}
su->skind = skind;
}
-void VG_(set_supp_string) ( Supp* su, Char* string )
+void VG_(set_supp_string) ( Supp* su, HChar* string )
{
su->string = string;
}
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)(" <sframe> <fun>%pS</fun> </sframe>\n", buf);
} else
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);
*/
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
/* 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);
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. */
/* 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 == '*')
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,
/* 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)) &&
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];
// 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;
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]);
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 "???"
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) {
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;
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;
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
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;
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;
#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
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);
*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;
*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;
#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');
}
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; }
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++;
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++;
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++;
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++;
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;
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';
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;
/* 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) {
}
}
-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) {
}
}
-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;
}
}
-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);
}
}
-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) {
}
}
-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) {
}
}
-Char* VG_(strstr) ( const Char* haystack, const Char* needle )
+HChar* VG_(strstr) ( const HChar* haystack, const HChar* needle )
{
SizeT n;
if (haystack == NULL)
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)
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;
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';
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')
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)
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') {
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++;
# 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,
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,
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);
(_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));
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;
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)());
/* 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);
}
-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 ); */
------------------------------------------------------------------ */
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 );
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;
/* 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;
}
-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, ""))
}
-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, "") ||
/* 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)
/* 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];
}
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;
}
/* 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);
}
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;
} 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++;
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
// 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)
#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:
}
/* 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);
envlen = oldenvp - oldenv + 1;
newenv = VG_(arena_malloc)(VG_AR_CORE, "libcproc.ec.1",
- envlen * sizeof(Char **));
+ envlen * sizeof(HChar *));
oldenvp = oldenv;
newenvp = newenv;
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 */
/* 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)
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. */
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
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') {
{ 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)())
"\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;
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;
*/
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)
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,
/* 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. */
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) {
break;
case VgLogTo_File: {
- Char* logfilename;
+ HChar* logfilename;
vg_assert(log_fsname_unexpanded != NULL);
vg_assert(VG_(strlen)(log_fsname_unexpanded) <= 900); /* paranoia */
break;
case VgLogTo_File: {
- Char* xmlfilename;
+ HChar* xmlfilename;
vg_assert(xml_fsname_unexpanded != NULL);
vg_assert(VG_(strlen)(xml_fsname_unexpanded) <= 900); /* paranoia */
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)++;
}
// 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;
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) {
/*====================================================================*/
// 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 = " \\<>";
}
// 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);
}
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;
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) );
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) {
{
ULong score_cumul, score_here;
HChar buf_cumul[10], buf_here[10];
- Char name[64];
+ HChar name[64];
Int r;
VG_(printf)("\n");
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;
//============================================================
/* 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
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;
/* 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;
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 );
}
#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
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;
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;
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;
// 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);
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) {
// 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;
}
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);
// 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;
}
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;
}
__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);
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* );
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. */
}
/* 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;
/* 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);
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;
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.
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,
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)(
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
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 */
/*------------------------------------------------------------*/
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)
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);
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);
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 ||
/* 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
/* 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
);
{
#define BUF_LEN 4096
- static UChar buf[BUF_LEN];
+ static HChar buf[BUF_LEN];
VG_(describe_IP)(ip, buf, BUF_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;
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))
// 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;
}
/* 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.
}
} else {
- path = (Char*)ARG1;
+ path = (HChar*)ARG1;
}
// Set up the child's environment.
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 );
}
// 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 );
// 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++;
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];
}
if (0) {
- Char **cpp;
+ HChar **cpp;
VG_(printf)("exec: %s\n", path);
for (cpp = argv; cpp && *cpp; cpp++)
VG_(printf)("argv: %s\n", *cpp);
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)());
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)());
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);
}
}
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);
}
}
* /proc/<pid>/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"))
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)
}
void VG_(needs_command_line_options)(
- Bool (*process)(Char*),
+ Bool (*process)(const HChar*),
void (*usage)(void),
void (*debug_usage)(void)
)
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);
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, "???");
/* 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) {
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)
* (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
struct _IICreateImageInfo {
/* ------ Mandatory fields ------ */
- HChar* toolname;
+ const HChar* toolname;
Addr sp_at_startup;
Addr clstack_top;
/* ------ Per-OS fields ------ */
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 );
// 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 );
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 );
/* 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);
/* 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);
/* 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
/* 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);
/* 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);
/* 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 */
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.
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);
/* 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? */
//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);
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);
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);
#include <crt_externs.h>
// 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++) {
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()
/* 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. */
/* 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
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);
}
}
-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)
{
}
}
-const char* DRD_(clientobj_type_name)(const ObjType t)
+const HChar* DRD_(clientobj_type_name)(const ObjType t)
{
switch (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 */
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:
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:
* 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),
* 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),
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);
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);
/**
* 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);
void drd_report_data_race(Error* const err, const DataRaceErrInfo* const dri)
{
const Bool xml = VG_(clo_xml);
- const char* const what_prefix = xml ? " <what>" : "";
- const char* const what_suffix = xml ? "</what>" : "";
- const char* const auxwhat_prefix = xml ? " <auxwhat>" : "";
- const char* const auxwhat_suffix = xml ? "</auxwhat>" : "";
- const char* const indent = xml ? " " : "";
+ const HChar* const what_prefix = xml ? " <what>" : "";
+ const HChar* const what_suffix = xml ? "</what>" : "";
+ const HChar* const auxwhat_prefix = xml ? " <auxwhat>" : "";
+ const HChar* const auxwhat_suffix = xml ? "</auxwhat>" : "";
+ const HChar* const indent = xml ? " " : "";
AddrInfo ai;
XArray* /* of HChar */ descr1
if (xml)
print_err_detail(" </allocation_context>\n");
} else {
- char sect_name[64];
+ HChar sect_name[64];
VgSectKind sect_kind;
sect_kind = VG_(DebugInfo_sect_kind)(sect_name, sizeof(sect_name),
static void drd_tool_error_pp(Error* const e)
{
const Bool xml = VG_(clo_xml);
- const char* const what_prefix = xml ? " <what>" : "";
- const char* const what_suffix = xml ? "</what>" : "";
+ const HChar* const what_prefix = xml ? " <what>" : "";
+ const HChar* const what_suffix = xml ? "</what>" : "";
if (xml)
VG_(printf_xml)( " <kind>%pS</kind>\n", drd_get_error_name(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;
* 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;
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;
/*
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 */
{
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)) {
/**
* 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;
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) {}
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
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));
}
}
}
-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)
{
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);
#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));
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",
{
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",
if (s_trace_segment)
{
- char* vc;
+ HChar* vc;
vc = DRD_(vc_aprint)(&sg->vc);
VG_(message)(Vg_DebugMsg,
if (s_trace_segment)
{
- char *vc1, *vc2;
+ HChar *vc1, *vc2;
vc1 = DRD_(vc_aprint)(&sg1->vc);
vc2 = DRD_(vc_aprint)(&sg2->vc);
/** 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;
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);
}
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",
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);
{
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);
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),
}
/** 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);
}
/** 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);
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);
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",
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);
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);
}
if (s_trace_conflict_set) {
- char* str;
+ HChar* str;
str = DRD_(vc_aprint)(DRD_(thread_get_vc)(tid));
VG_(message)(Vg_DebugMsg,
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",
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,
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,
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,
= !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,
&& !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,
Addr stack_startup; /**<Stack pointer after pthread_create() finished.*/
Addr stack_max; /**< Top of stack. */
SizeT stack_size; /**< Maximum size of stack. */
- char name[64]; /**< User-assigned thread name. */
+ HChar name[64]; /**< User-assigned thread name. */
Bool on_alt_stack;
/** Whether this structure contains valid information. */
Bool valid;
void DRD_(thread_set_joinable)(const DrdThreadId tid, const Bool joinable);
void DRD_(thread_entering_pthread_create)(const DrdThreadId tid);
void DRD_(thread_left_pthread_create)(const DrdThreadId tid);
-const char* DRD_(thread_get_name)(const DrdThreadId tid);
-void DRD_(thread_set_name)(const DrdThreadId tid, const char* const name);
+const HChar* DRD_(thread_get_name)(const DrdThreadId tid);
+void DRD_(thread_set_name)(const DrdThreadId tid, const HChar* const name);
void DRD_(thread_set_vg_running_tid)(const ThreadId vg_tid);
void DRD_(thread_set_running_tid)(const ThreadId vg_tid,
const DrdThreadId drd_tid);
/** Print the contents of vector clock 'vc'. */
void DRD_(vc_print)(const VectorClock* const vc)
{
- char* str;
+ HChar* str;
if ((str = DRD_(vc_aprint)(vc)) != NULL)
{
* Print the contents of vector clock 'vc' to a newly allocated string.
* The caller must call VG_(free)() on the return value of this function.
*/
-char* DRD_(vc_aprint)(const VectorClock* const vc)
+HChar* DRD_(vc_aprint)(const VectorClock* const vc)
{
unsigned i;
unsigned reserved;
unsigned size;
- char* str = 0;
+ HChar* str = 0;
tl_assert(vc);
reserved = 64;
void DRD_(vc_combine)(VectorClock* const result,
const VectorClock* const rhs);
void DRD_(vc_print)(const VectorClock* const vc);
-char* DRD_(vc_aprint)(const VectorClock* const vc);
+HChar* DRD_(vc_aprint)(const VectorClock* const vc);
void DRD_(vc_check)(const VectorClock* const vc);
void DRD_(vc_test)(void);
{ UInt ret; va_list vargs; va_start(vargs, format); ret = vprintf(format, vargs); va_end(vargs); return ret; }
UInt VG_(snprintf)(HChar* buf, Int size, const HChar *format, ...)
{ UInt ret; va_list vargs; va_start(vargs, format); ret = vsnprintf(buf, size, format, vargs); va_end(vargs); return ret; }
-SizeT VG_(strlen)(const Char* str) { return strlen(str); }
+SizeT VG_(strlen)(const HChar* str) { return strlen(str); }
UInt VG_(message)(VgMsgKind kind, const HChar* format, ...)
{ UInt ret; va_list vargs; va_start(vargs, format); ret = vprintf(format, vargs); va_end(vargs); printf("\n"); return ret; }
Bool DRD_(is_suppressed)(const Addr a1, const Addr a2)
static Int interval_size=DEFAULT_GRAIN_SIZE;
/* filenames */
-static HChar *clo_bb_out_file="bb.out.%p";
-static HChar *clo_pc_out_file="pc.out.%p";
-static UChar *pc_out_file=NULL;
-static UChar *bb_out_file=NULL;
+static const HChar *clo_bb_out_file="bb.out.%p";
+static const HChar *clo_pc_out_file="pc.out.%p";
+static HChar *pc_out_file=NULL;
+static HChar *bb_out_file=NULL;
/* output parameters */
Int block_num; /* unique block identifier */
Int *inst_counter; /* times entered * num_instructions */
Bool is_entry; /* is this block a function entry point */
- UChar fn_name[FUNCTION_NAME_LENGTH]; /* Function block is in */
+ HChar fn_name[FUNCTION_NAME_LENGTH]; /* Function block is in */
};
#if defined(VGA_x86) || defined(VGA_amd64)
- unsigned char *inst_pointer;
- unsigned char inst_byte;
+ UChar *inst_pointer;
+ UChar inst_byte;
int i,possible_rep;
/* rep prefixed instructions are counted as one instruction on */
/* SSE instructions. So we need to specifically check for */
/* the following: movs, cmps, scas, lods, stos, ins, outs */
- inst_pointer=(unsigned char *)addr;
+ inst_pointer=(UChar *)addr;
i=0;
inst_byte=0;
possible_rep=0;
/* performance counters on pentium 4 processors so it is */
/* useful to have that count when doing validation work. */
- inst_pointer=(unsigned char *)addr;
+ inst_pointer=(UChar *)addr;
if (len>1) {
/* FLDCW detection */
/* opcode is 0xd9/5, ie 1101 1001 oo10 1mmm */
}
/* 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) {}
Int goff_sp)
{
IRType tyAddr = Ity_INVALID;
- HChar* hName = NULL;
+ const HChar* hName= NULL;
void* hAddr = NULL;
IRExpr** argv = NULL;
IRDirty* di = NULL;
// 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) {}
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;
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 );
/* 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) {} */
Seg* vseg;
XArray* descr1; /* XArray* of HChar */
XArray* descr2; /* XArray* of HChar */
- Char datasym[96];
+ HChar datasym[96];
PtrdiffT datasymoff;
} Heap;
struct {
/*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;
return sizeof(XError);
}
-Bool pc_is_recognised_suppression ( Char* name, Supp *su )
+Bool pc_is_recognised_suppression ( const HChar* name, Supp *su )
{
SuppKind skind;
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;
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 );
/* 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);
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 );
}
#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;
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)
} 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;
}
}
}
}
-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))) { \
# 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
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 );
// 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");
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 );
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 );
/*--- 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)) {}
/*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 );
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 );
/* ------------------------------------------------------------------ */
/* 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 );
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
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
// 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
#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
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
------------------------------------------------------------------ */
/* 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
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.
#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'" \
#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; \
}) \
#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. */ \
#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 */ \
#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 */ \
/* An arbitrary user-supplied string which is copied into the
XML output, in between <usercomment> 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). */
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
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
/* 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
// 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
// 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),
/* 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) {}
}
}
-static HChar* nameOfTypeIndex ( Int i )
+static const HChar* nameOfTypeIndex ( Int i )
{
switch (i) {
case 0: return "I1"; break;
static void flushEvents(IRSB* sb)
{
Int i;
- HChar* helperName;
+ const HChar* helperName;
void* helperAddr;
IRExpr** argv;
IRDirty* di;
IRDirty* di;
Int i;
IRSB* sbOut;
- Char fnname[100];
+ HChar fnname[100];
IRType type;
IRTypeEnv* tyenv = sbIn->tyenv;
Addr iaddr = 0, dst;
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;
{
// 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.
{
// 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
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);
// 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 );
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;
/* 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]) {
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
})
// 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];
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)
{
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 "".
}
}
-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)
{
// 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)");
// 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;
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);
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;
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) {
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.
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);
}
VERB(1, " <empty>\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);
}
}
// 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;
// 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;
}
MC_SuppKind;
-Bool MC_(is_recognised_suppression) ( Char* name, Supp* su )
+Bool MC_(is_recognised_suppression) ( const HChar* name, Supp* su )
{
SuppKind skind;
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;
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 );
}
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",
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
/* 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)
/* 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);
Int i;
Word n_secmaps_found;
SecMap* sm;
- HChar* errmsg;
+ const HChar* errmsg;
Bool bad = False;
if (0) VG_(printf)("expensive sanity check\n");
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 );
}
/* 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);
case 2: { /* leak_check */
Int err = 0;
LeakCheckParams lcp;
- Char* kw;
+ HChar* kw;
lcp.mode = LC_Full;
lcp.show_reachable = False;
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");
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);
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);
}
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);
/* 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
}
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];
}
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
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",
// 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);
// 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);