{
Int i, fd;
SysRes sres;
- Char buf[512], *currFile = NULL, *currFn = NULL;
+ HChar buf[512];
+ Char *currFile = NULL, *currFn = NULL;
LineCC* lineCC;
// Setup output filename. Nb: it's important to do this now, ie. as late
static void cg_fini(Int exitcode)
{
- static Char buf1[128], buf2[128], buf3[128], buf4[123];
+ static HChar buf1[128], buf2[128], buf3[128], buf4[123];
static HChar fmt[128];
CacheCC D_total;
Int sets_min_1;
Int line_size_bits;
Int tag_shift;
- Char desc_line[128];
+ HChar desc_line[128];
UWord* tags;
} cache_t2;
static Bool dumps_initialized = False;
/* Command */
-static Char cmdbuf[BUF_LEN];
+static HChar cmdbuf[BUF_LEN];
/* Total reads/writes/misses sum over all dumps and threads.
* Updated during CC traversal at dump time.
* print_fn_pos, fprint_apos, fprint_fcost, fprint_jcc,
* fprint_fcc_ln, dump_run_info, dump_state_info
*/
-static Char outbuf[FILENAME_LEN + FN_NAME_LEN + OBJ_NAME_LEN + COSTS_LEN];
+static HChar outbuf[FILENAME_LEN + FN_NAME_LEN + OBJ_NAME_LEN + COSTS_LEN];
Int CLG_(get_dump_counter)(void)
{
#if 0
static __inline__
-static void my_fwrite(Int fd, Char* buf, Int len)
+static void my_fwrite(Int fd, HChar* buf, Int len)
{
- VG_(write)(fd, (void*)buf, len);
+ VG_(write)(fd, buf, len);
}
#else
#define FWRITE_BUFSIZE 32000
#define FWRITE_THROUGH 10000
-static Char fwrite_buf[FWRITE_BUFSIZE];
+static HChar fwrite_buf[FWRITE_BUFSIZE];
static Int fwrite_pos;
static Int fwrite_fd = -1;
void fwrite_flush(void)
{
if ((fwrite_fd>=0) && (fwrite_pos>0))
- VG_(write)(fwrite_fd, (void*)fwrite_buf, fwrite_pos);
+ VG_(write)(fwrite_fd, fwrite_buf, fwrite_pos);
fwrite_pos = 0;
}
-static void my_fwrite(Int fd, Char* buf, Int len)
+static void my_fwrite(Int fd, HChar* buf, Int len)
{
if (fwrite_fd != fd) {
fwrite_flush();
}
if (len > FWRITE_THROUGH) {
fwrite_flush();
- VG_(write)(fd, (void*)buf, len);
+ VG_(write)(fd, buf, len);
return;
}
if (FWRITE_BUFSIZE - fwrite_pos <= len) fwrite_flush();
#endif
-static void print_obj(Char* buf, obj_node* obj)
+static void print_obj(HChar* buf, obj_node* obj)
{
//int n;
#endif
}
-static void print_file(Char* buf, file_node* file)
+static void print_file(HChar* buf, file_node* file)
{
if (CLG_(clo).compress_strings) {
CLG_ASSERT(file_dumped != 0);
/*
* tag can be "fn", "cfn", "jfn"
*/
-static void print_fn(Int fd, Char* buf, const HChar* tag, fn_node* fn)
+static void print_fn(Int fd, HChar* buf, const HChar* tag, fn_node* fn)
{
int p;
p = VG_(sprintf)(buf, "%s=",tag);
my_fwrite(fd, buf, p);
}
-static void print_mangled_fn(Int fd, Char* buf, const HChar* tag,
+static void print_mangled_fn(Int fd, HChar* buf, const HChar* tag,
Context* cxt, int rec_index)
{
int p, i;
if (!CLG_(clo).mangle_names) {
if (last->rec_index != bbcc->rec_index) {
VG_(sprintf)(outbuf, "rec=%d\n\n", bbcc->rec_index);
- my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf));
+ my_fwrite(fd, outbuf, VG_(strlen)(outbuf));
last->rec_index = bbcc->rec_index;
last->cxt = 0; /* reprint context */
res = True;
if (last_from != 0) {
/* switch back to no context */
VG_(sprintf)(outbuf, "frfn=(spontaneous)\n");
- my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf));
+ my_fwrite(fd, outbuf, VG_(strlen)(outbuf));
res = True;
}
}
if (last->obj != bbcc->cxt->fn[0]->file->obj) {
VG_(sprintf)(outbuf, "ob=");
print_obj(outbuf+3, bbcc->cxt->fn[0]->file->obj);
- my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf));
+ my_fwrite(fd, outbuf, VG_(strlen)(outbuf));
last->obj = bbcc->cxt->fn[0]->file->obj;
res = True;
}
if (last->file != bbcc->cxt->fn[0]->file) {
VG_(sprintf)(outbuf, "fl=");
print_file(outbuf+3, bbcc->cxt->fn[0]->file);
- my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf));
+ my_fwrite(fd, outbuf, VG_(strlen)(outbuf));
last->file = bbcc->cxt->fn[0]->file;
res = True;
}
else
VG_(sprintf)(outbuf, "fi=");
print_file(outbuf+3, curr->file);
- my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf));
+ my_fwrite(fd, outbuf, VG_(strlen)(outbuf));
}
if (CLG_(clo).dump_bbs) {
if (curr->line != last->line) {
VG_(sprintf)(outbuf, "ln=%d\n", curr->line);
- my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf));
+ my_fwrite(fd, outbuf, VG_(strlen)(outbuf));
}
}
}
VG_(sprintf)(outbuf+p, "%u ", curr->line);
}
}
- my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf));
+ my_fwrite(fd, outbuf, VG_(strlen)(outbuf));
}
{
int p = CLG_(sprint_mappingcost)(outbuf, es, cost);
VG_(sprintf)(outbuf+p, "\n");
- my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf));
+ my_fwrite(fd, outbuf, VG_(strlen)(outbuf));
return;
}
if (last->file != target.file) {
VG_(sprintf)(outbuf, "jfi=");
print_file(outbuf+4, target.file);
- my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf));
+ my_fwrite(fd, outbuf, VG_(strlen)(outbuf));
}
if (jcc->from->cxt != jcc->to->cxt) {
VG_(sprintf)(outbuf, "jump=%llu ",
jcc->call_counter);
}
- my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf));
+ my_fwrite(fd, outbuf, VG_(strlen)(outbuf));
fprint_pos(fd, &target, last);
my_fwrite(fd, "\n", 1);
if (jcc->from->cxt->fn[0]->file->obj != obj) {
VG_(sprintf)(outbuf, "cob=");
print_obj(outbuf+4, obj);
- my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf));
+ my_fwrite(fd, outbuf, VG_(strlen)(outbuf));
}
/* file of called position different to current file? */
if (last->file != file) {
VG_(sprintf)(outbuf, "cfi=");
print_file(outbuf+4, file);
- my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf));
+ my_fwrite(fd, outbuf, VG_(strlen)(outbuf));
}
if (CLG_(clo).mangle_names)
if (!CLG_(is_zero_cost)( CLG_(sets).full, jcc->cost)) {
VG_(sprintf)(outbuf, "calls=%llu ",
jcc->call_counter);
- my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf));
+ my_fwrite(fd, outbuf, VG_(strlen)(outbuf));
fprint_pos(fd, &target, last);
my_fwrite(fd, "\n", 1);
currCost->cost, bbcc->skipped );
#if 0
VG_(sprintf)(outbuf, "# Skipped\n");
- my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf));
+ my_fwrite(fd, outbuf, VG_(strlen)(outbuf));
#endif
fprint_fcost(fd, currCost, last);
}
fprint_apos(fd, &(currCost->p), last, bbcc->cxt->fn[0]->file);
fprint_fcost(fd, currCost, last);
}
- if (CLG_(clo).dump_bbs) my_fwrite(fd, (void*)"\n", 1);
+ if (CLG_(clo).dump_bbs) my_fwrite(fd, "\n", 1);
/* when every cost was immediatly written, we must have done so,
* as this function is only called when there's cost in a BBCC
p = VG_(sprintf)(outbuf, "%s", prefix);
p += CLG_(sprint_mappingcost)(outbuf + p, em, cost);
VG_(sprintf)(outbuf + p, "\n");
- my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf));
+ my_fwrite(fd, outbuf, VG_(strlen)(outbuf));
}
static ULong bbs_done = 0;
-static Char* filename = 0;
+static HChar* filename = 0;
static
void file_err(void)
*
* Returns the file descriptor, and -1 on error (no write permission)
*/
-static int new_dumpfile(Char buf[BUF_LEN], int tid, const HChar* trigger)
+static int new_dumpfile(HChar buf[BUF_LEN], int tid, const HChar* trigger)
{
Bool appending = False;
int i, fd;
if (!appending) {
/* version */
VG_(sprintf)(buf, "version: 1\n");
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
/* creator */
VG_(sprintf)(buf, "creator: callgrind-" VERSION "\n");
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
/* "pid:" line */
VG_(sprintf)(buf, "pid: %d\n", VG_(getpid)());
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
/* "cmd:" line */
VG_(strcpy)(buf, "cmd: ");
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
- my_fwrite(fd, (void*)cmdbuf, VG_(strlen)(cmdbuf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
+ my_fwrite(fd, cmdbuf, VG_(strlen)(cmdbuf));
}
VG_(sprintf)(buf, "\npart: %d\n", out_counter);
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
if (CLG_(clo).separate_threads) {
VG_(sprintf)(buf, "thread: %d\n", tid);
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
}
/* "desc:" lines */
/* Global options changing the tracing behaviour */
VG_(sprintf)(buf, "\ndesc: Option: --skip-plt=%s\n",
CLG_(clo).skip_plt ? "yes" : "no");
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
VG_(sprintf)(buf, "desc: Option: --collect-jumps=%s\n",
CLG_(clo).collect_jumps ? "yes" : "no");
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
VG_(sprintf)(buf, "desc: Option: --separate-recs=%d\n",
CLG_(clo).separate_recursions);
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
VG_(sprintf)(buf, "desc: Option: --separate-callers=%d\n",
CLG_(clo).separate_callers);
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
VG_(sprintf)(buf, "desc: Option: --dump-bbs=%s\n",
CLG_(clo).dump_bbs ? "yes" : "no");
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
VG_(sprintf)(buf, "desc: Option: --separate-threads=%s\n",
CLG_(clo).separate_threads ? "yes" : "no");
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
#endif
(*CLG_(cachesim).getdesc)(buf);
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
}
VG_(sprintf)(buf, "\ndesc: Timerange: Basic block %llu - %llu\n",
bbs_done, CLG_(stat).bb_executions);
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
VG_(sprintf)(buf, "desc: Trigger: %s\n",
trigger ? trigger : "Program termination");
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
#if 0
/* Output function specific config
while (fnc) {
if (fnc->skip) {
VG_(sprintf)(buf, "desc: Option: --fn-skip=%s\n", fnc->name);
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
}
if (fnc->dump_at_enter) {
VG_(sprintf)(buf, "desc: Option: --fn-dump-at-enter=%s\n",
fnc->name);
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
}
if (fnc->dump_at_leave) {
VG_(sprintf)(buf, "desc: Option: --fn-dump-at-leave=%s\n",
fnc->name);
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
}
if (fnc->separate_callers != CLG_(clo).separate_callers) {
VG_(sprintf)(buf, "desc: Option: --separate-callers%d=%s\n",
fnc->separate_callers, fnc->name);
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
}
if (fnc->separate_recursions != CLG_(clo).separate_recursions) {
VG_(sprintf)(buf, "desc: Option: --separate-recs%d=%s\n",
fnc->separate_recursions, fnc->name);
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
}
fnc = fnc->next;
}
CLG_(clo).dump_instr ? " instr" : "",
CLG_(clo).dump_bb ? " bb" : "",
CLG_(clo).dump_line ? " line" : "");
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
/* "events:" line */
i = VG_(sprintf)(buf, "events: ");
CLG_(sprint_eventmapping)(buf+i, CLG_(dumpmap));
- my_fwrite(fd, (void*)buf, VG_(strlen)(buf));
+ my_fwrite(fd, buf, VG_(strlen)(buf));
my_fwrite(fd, "\n", 1);
/* summary lines */
static Int print_fd;
static const HChar* print_trigger;
-static Char print_buf[BUF_LEN];
+static HChar print_buf[BUF_LEN];
static void print_bbccs_of_thread(thread_info* ti)
{
/* switch back to file of function */
VG_(sprintf)(print_buf, "fe=");
print_file(print_buf+3, lastFnPos.cxt->fn[0]->file);
- my_fwrite(print_fd, (void*)print_buf, VG_(strlen)(print_buf));
+ my_fwrite(print_fd, print_buf, VG_(strlen)(print_buf));
}
my_fwrite(print_fd, "\n", 1);
}
VG_(sprintf)(print_buf+pos, "%d %llu\n",
(*p)->bb->instr_count,
ecounter);
- my_fwrite(print_fd, (void*)print_buf, VG_(strlen)(print_buf));
+ my_fwrite(print_fd, print_buf, VG_(strlen)(print_buf));
}
fprint_bbcc(print_fd, *p, &lastAPos);
return eventset_from_mask(es1->mask | es2->mask);
}
-Int CLG_(sprint_eventset)(Char* buf, EventSet* es)
+Int CLG_(sprint_eventset)(HChar* buf, EventSet* es)
{
Int i, j, pos;
UInt mask;
/* Returns number of characters written */
-Int CLG_(sprint_cost)(Char* buf, EventSet* es, ULong* c)
+Int CLG_(sprint_cost)(HChar* buf, EventSet* es, ULong* c)
{
Int i, pos, skipped = 0;
/* Returns number of characters written */
-Int CLG_(sprint_eventmapping)(Char* buf, EventMapping* em)
+Int CLG_(sprint_eventmapping)(HChar* buf, EventMapping* em)
{
Int i, pos = 0;
EventGroup* eg;
}
/* Returns number of characters written */
-Int CLG_(sprint_mappingcost)(Char* buf, EventMapping* em, ULong* c)
+Int CLG_(sprint_mappingcost)(HChar* buf, EventMapping* em, ULong* c)
{
Int i, pos, skipped = 0;
EventSet* CLG_(add_event_group2)(EventSet*, Int id1, Int id2);
EventSet* CLG_(add_event_set)(EventSet*, EventSet*);
/* Writes event names into buf. Returns number of characters written */
-Int CLG_(sprint_eventset)(Char* buf, EventSet*);
+Int CLG_(sprint_eventset)(HChar* buf, EventSet*);
/* Operations on costs. A cost pointer of 0 means zero cost.
Bool CLG_(add_diff_cost)(EventSet*,ULong* dst, ULong* old, ULong* new_cost);
Bool CLG_(add_diff_cost_lz)(EventSet*,ULong** pdst, ULong* old, ULong* new_cost);
/* Returns number of characters written */
-Int CLG_(sprint_cost)(Char* buf, EventSet*, ULong*);
+Int CLG_(sprint_cost)(HChar* buf, EventSet*, ULong*);
/* EventMapping: An ordered subset of events from an event set.
* This is used to print out part of an EventSet, or in another order.
EventMapping* CLG_(get_eventmapping)(EventSet*);
void CLG_(append_event)(EventMapping*, const HChar*);
/* Returns number of characters written */
-Int CLG_(sprint_eventmapping)(Char* buf, EventMapping*);
+Int CLG_(sprint_eventmapping)(HChar* buf, EventMapping*);
/* Returns number of characters written */
-Int CLG_(sprint_mappingcost)(Char* buf, EventMapping*, ULong*);
+Int CLG_(sprint_mappingcost)(HChar* buf, EventMapping*, ULong*);
#endif /* CLG_EVENTS */
*/
fn_node* CLG_(get_fn_node)(BB* bb)
{
- Char filename[FILENAME_LEN], fnname[FN_NAME_LEN];
+ HChar filename[FILENAME_LEN], fnname[FN_NAME_LEN];
DebugInfo* di;
UInt line_num;
fn_node* fn;
Bool (*parse_opt)(Char* arg);
void (*post_clo_init)(void);
void (*clear)(void);
- void (*getdesc)(Char* buf);
+ void (*getdesc)(HChar* buf);
void (*printstat)(Int,Int,Int);
void (*add_icost)(SimCost, BBCC*, InstrInfo*, ULong);
void (*finish)(void);
/* helper for dump_state_togdb */
static void dump_state_of_thread_togdb(thread_info* ti)
{
- static Char buf[512];
+ static HChar buf[512];
static FullCost sum = 0, tmp = 0;
Int t, p, i;
BBCC *from, *to;
/* Dump current state */
static void dump_state_togdb(void)
{
- static Char buf[512];
+ static HChar buf[512];
thread_info** th;
int t, p;
Int orig_tid = CLG_(current_tid);
static
void branchsim_printstat(int l1, int l2, int l3)
{
- static Char buf1[128], buf2[128], buf3[128];
+ static HChar buf1[128], buf2[128], buf3[128];
static HChar fmt[128];
FullCost total;
ULong Bc_total_b, Bc_total_mp, Bi_total_b, Bi_total_mp;
/* Cache state */
typedef struct {
- char* name;
+ const HChar* name;
int size; /* bytes */
int assoc;
int line_size; /* bytes */
int line_size_bits;
int tag_shift;
UWord tag_mask;
- char desc_line[128];
+ HChar desc_line[128];
UWord* tags;
/* for cache use */
}
-static void cachesim_getdesc(Char* buf)
+static void cachesim_getdesc(HChar* buf)
{
Int p;
p = VG_(sprintf)(buf, "\ndesc: I1 cache: %s\n", I1.desc_line);
/* Adds commas to ULong, right justifying in a field field_width wide, returns
* the string in buf. */
static
-Int commify(ULong n, int field_width, char* buf)
+Int commify(ULong n, int field_width, HChar* buf)
{
int len, n_commas, i, j, new_len, space;
}
static
-void percentify(Int n, Int ex, Int field_width, char buf[])
+void percentify(Int n, Int ex, Int field_width, HChar buf[])
{
int i, len, space;
/*--------------------------------------------------------------------*/
/*--- end ct_sim.c ---*/
/*--------------------------------------------------------------------*/
-
aspacem_assert(2+2 == 5);
}
-void ML_(am_barf) ( HChar* what )
+void ML_(am_barf) ( const HChar* what )
{
VG_(debugLog)(0, "aspacem", "Valgrind: FATAL: %s\n", what);
VG_(debugLog)(0, "aspacem", "Exiting now.\n");
ML_(am_exit)(1);
}
-void ML_(am_barf_toolow) ( HChar* what )
+void ML_(am_barf_toolow) ( const HChar* what )
{
VG_(debugLog)(0, "aspacem",
"Valgrind: FATAL: %s is too low.\n", what);
}
void ML_(am_assert_fail)( const HChar* expr,
- const Char* file,
+ const HChar* file,
Int line,
- const Char* fn )
+ const HChar* fn )
{
VG_(debugLog)(0, "aspacem",
"Valgrind: FATAL: aspacem assertion failed:\n");
UInt local_vsprintf ( HChar* buf, const HChar *format, va_list vargs )
{
Int ret;
- Char *aspacem_sprintf_ptr = buf;
+ HChar *aspacem_sprintf_ptr = buf;
ret = VG_(debugLog_vprintf)
( local_add_to_aspacem_sprintf_buf,
/* --- Pertaining to files --- */
-SysRes ML_(am_open) ( const Char* pathname, Int flags, Int mode )
+SysRes ML_(am_open) ( const HChar* pathname, Int flags, Int mode )
{
SysRes res = VG_(do_syscall3)(__NR_open, (UWord)pathname, flags, mode);
return res;
static void parse_procselfmaps (
void (*record_mapping)( Addr addr, SizeT len, UInt prot,
ULong dev, ULong ino, Off64T offset,
- const UChar* filename ),
+ const HChar* filename ),
void (*record_gap)( Addr addr, SizeT len )
);
/*--- ---*/
/*-----------------------------------------------------------------*/
-static HChar* show_SegKind ( SegKind sk )
+static const HChar* show_SegKind ( SegKind sk )
{
switch (sk) {
case SkFree: return " ";
}
}
-static HChar* show_ShrinkMode ( ShrinkMode sm )
+static const HChar* show_ShrinkMode ( ShrinkMode sm )
{
switch (sm) {
case SmLower: return "SmLower";
static void show_len_concisely ( /*OUT*/HChar* buf, Addr start, Addr end )
{
- HChar* fmt;
+ const HChar* fmt;
ULong len = ((ULong)end) - ((ULong)start) + 1;
if (len < 10*1000*1000ULL) {
show_nsegment_full ( Int logLevel, Int segNo, NSegment* seg )
{
HChar len_buf[20];
- HChar* name = "(none)";
+ const HChar* name = "(none)";
if (seg->fnIdx >= 0 && seg->fnIdx < segnames_used
&& segnames[seg->fnIdx].inUse
}
/* Print out the segment array (debugging only!). */
-void VG_(am_show_nsegments) ( Int logLevel, HChar* who )
+void VG_(am_show_nsegments) ( Int logLevel, const HChar* who )
{
Int i;
VG_(debugLog)(logLevel, "aspacem",
static void sync_check_mapping_callback ( Addr addr, SizeT len, UInt prot,
ULong dev, ULong ino, Off64T offset,
- const UChar* filename )
+ const HChar* filename )
{
Int iLo, iHi, i;
Bool sloppyXcheck;
prot & VKI_PROT_READ ? 'r' : '-',
prot & VKI_PROT_WRITE ? 'w' : '-',
prot & VKI_PROT_EXEC ? 'x' : '-',
- dev, ino, offset, filename ? (HChar*)filename : "(none)" );
+ dev, ino, offset, filename ? filename : "(none)" );
return;
}
static void read_maps_callback ( Addr addr, SizeT len, UInt prot,
ULong dev, ULong ino, Off64T offset,
- const UChar* filename )
+ const HChar* filename )
{
NSegment seg;
init_nsegment( &seg );
#define M_PROCMAP_BUF 100000
/* static ... to keep it out of the stack frame. */
-static Char procmap_buf[M_PROCMAP_BUF];
+static HChar procmap_buf[M_PROCMAP_BUF];
/* Records length of /proc/self/maps read into procmap_buf. */
static Int buf_n_tot;
/* Helper fns. */
-static Int hexdigit ( Char c )
+static Int hexdigit ( HChar c )
{
if (c >= '0' && c <= '9') return (Int)(c - '0');
if (c >= 'a' && c <= 'f') return 10 + (Int)(c - 'a');
return -1;
}
-static Int decdigit ( Char c )
+static Int decdigit ( HChar c )
{
if (c >= '0' && c <= '9') return (Int)(c - '0');
return -1;
}
-static Int readchar ( const Char* buf, Char* ch )
+static Int readchar ( const HChar* buf, HChar* ch )
{
if (*buf == 0) return 0;
*ch = *buf;
return 1;
}
-static Int readhex ( const Char* buf, UWord* val )
+static Int readhex ( const HChar* buf, UWord* val )
{
/* Read a word-sized hex number. */
Int n = 0;
return n;
}
-static Int readhex64 ( const Char* buf, ULong* val )
+static Int readhex64 ( const HChar* buf, ULong* val )
{
/* Read a potentially 64-bit hex number. */
Int n = 0;
return n;
}
-static Int readdec64 ( const Char* buf, ULong* val )
+static Int readdec64 ( const HChar* buf, ULong* val )
{
Int n = 0;
*val = 0;
static void parse_procselfmaps (
void (*record_mapping)( Addr addr, SizeT len, UInt prot,
ULong dev, ULong ino, Off64T offset,
- const UChar* filename ),
+ const HChar* filename ),
void (*record_gap)( Addr addr, SizeT len )
)
{
Int i, j, i_eol;
Addr start, endPlusOne, gapStart;
- UChar* filename;
- UChar rr, ww, xx, pp, ch, tmp;
+ HChar* filename;
+ HChar rr, ww, xx, pp, ch, tmp;
UInt prot;
UWord maj, min;
ULong foffset, dev, ino;
static void parse_procselfmaps (
void (*record_mapping)( Addr addr, SizeT len, UInt prot,
ULong dev, ULong ino, Off64T offset,
- const UChar* filename ),
+ const HChar* filename ),
void (*record_gap)( Addr addr, SizeT len )
)
{
static void add_mapping_callback(Addr addr, SizeT len, UInt prot,
ULong dev, ULong ino, Off64T offset,
- const UChar *filename)
+ const HChar *filename)
{
// derived from sync_check_mapping_callback()
__attribute__ ((noreturn))
extern void ML_(am_exit) ( Int status );
-extern void ML_(am_barf) ( HChar* what );
-extern void ML_(am_barf_toolow) ( HChar* what );
+extern void ML_(am_barf) ( const HChar* what );
+extern void ML_(am_barf_toolow) ( const HChar* what );
__attribute__ ((noreturn))
extern void ML_(am_assert_fail) ( const HChar* expr,
- const Char* file,
+ const HChar* file,
Int line,
- const Char* fn );
+ const HChar* fn );
#define aspacem_assert(expr) \
((void) ((expr) ? 0 : \
/* There is also VG_(do_mmap_NO_NOTIFY), but that's not declared
here (obviously). */
-extern SysRes ML_(am_open) ( const Char* pathname, Int flags, Int mode );
+extern SysRes ML_(am_open) ( const HChar* pathname, Int flags, Int mode );
extern void ML_(am_close) ( Int fd );
extern Int ML_(am_read) ( Int fd, void* buf, Int count);
extern Int ML_(am_readlink) ( HChar* path, HChar* buf, UInt bufsiz );
struct note {
struct note *next;
ESZ(Nhdr) note;
- Char name[0];
+ HChar name[0];
};
static UInt note_size(const struct note *n)
}
#if !defined(VGPV_arm_linux_android) && !defined(VGPV_x86_linux_android)
-static void add_note(struct note **list, const Char *name, UInt type,
+static void add_note(struct note **list, const HChar *name, UInt type,
const void *data, UInt datasz)
{
Int namelen = VG_(strlen)(name)+1;
static void fill_prpsinfo(const ThreadState *tst,
struct vki_elf_prpsinfo *prpsinfo)
{
- static Char name[VKI_PATH_MAX];
+ static HChar name[VKI_PATH_MAX];
VG_(memset)(prpsinfo, 0, sizeof(*prpsinfo));
prpsinfo->pr_gid = 0;
if (VG_(resolve_filename)(VG_(cl_exec_fd), name, VKI_PATH_MAX)) {
- Char *n = name+VG_(strlen)(name)-1;
+ HChar *n = name+VG_(strlen)(name)-1;
while (n > name && *n != '/')
n--;
ThreadArchState* arch = (ThreadArchState*)&tst->arch;
#if defined(VGP_x86_linux)
-//:: static void fill_fpu(vki_elf_fpregset_t *fpu, const Char *from)
+//:: static void fill_fpu(vki_elf_fpregset_t *fpu, const HChar *from)
//:: {
//:: if (VG_(have_ssestate)) {
//:: UShort *to;
//:: VG_(memcpy)(fpu, from, sizeof(*fpu));
//:: }
-//:: fill_fpu(fpu, (const Char *)&arch->m_sse);
+//:: fill_fpu(fpu, (const HChar *)&arch->m_sse);
#elif defined(VGP_amd64_linux)
//:: fpu->cwd = ?;
static
void make_elf_coredump(ThreadId tid, const vki_siginfo_t *si, UInt max_size)
{
- Char* buf = NULL;
- Char *basename = "vgcore";
- Char *coreext = "";
+ HChar* buf = NULL;
+ const HChar *basename = "vgcore";
+ const HChar *coreext = "";
Int seq = 0;
Int core_fd;
NSegment const * seg;
VG_(kill)(pid, VKI_SIGSTOP) == 0 &&
VG_(ptrace)(VKI_PTRACE_DETACH, pid, NULL, 0) == 0)
{
- Char pidbuf[15];
- Char file[50];
- Char buf[N_BUF];
- Char *bufptr;
- Char *cmdptr;
+ HChar pidbuf[15];
+ HChar file[50];
+ HChar buf[N_BUF];
+ HChar *bufptr;
+ HChar *cmdptr;
VG_(sprintf)(pidbuf, "%d", pid);
VG_(sprintf)(file, "/proc/%d/fd/%d", pid, VG_(cl_exec_fd));
#if defined(VGP_x86_linux)
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
Int result;
#elif defined(VGP_amd64_linux)
__attribute__((noinline))
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
volatile Long block[2];
block[0] = (Long)buf;
#elif defined(VGP_ppc32_linux)
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
volatile Int block[2];
block[0] = (Int)buf;
#elif defined(VGP_ppc64_linux)
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
volatile Long block[2];
block[0] = (Long)buf;
#elif defined(VGP_arm_linux)
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
volatile Int block[2];
block[0] = (Int)buf;
asm code. Both macros give the same results for Unix-class syscalls (which
these all are, as identified by the use of 'int 0x80'). */
__attribute__((noinline))
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
UInt __res;
__asm__ volatile (
#elif defined(VGP_amd64_darwin)
__attribute__((noinline))
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
UInt __res;
__asm__ volatile (
}
#elif defined(VGP_s390x_linux)
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
- register Int r2 asm("2") = 2; /* file descriptor STDERR */
- register HChar* r3 asm("3") = buf;
- register ULong r4 asm("4") = n;
- register ULong r2_res asm("2");
+ register Int r2 asm("2") = 2; /* file descriptor STDERR */
+ register const HChar* r3 asm("3") = buf;
+ register ULong r4 asm("4") = n;
+ register ULong r2_res asm("2");
ULong __res;
__asm__ __volatile__ (
}
#elif defined(VGP_mips32_linux)
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
volatile Int block[2];
block[0] = (Int)buf;
/* Emit buf[0 .. n-1] to stderr. Unfortunately platform-specific.
*/
-static void emit ( HChar* buf, Int n )
+static void emit ( const HChar* buf, Int n )
{
if (n >= 1)
(void)local_sys_write_stderr(buf, n);
void* send_arg2,
Int flags,
Int width,
- HChar* str,
+ const HChar* str,
Bool capitalise )
{
# define MAYBE_TOUPPER(ch) (capitalise ? local_toupper(ch) : (ch))
static
UInt myvprintf_str_XML_simplistic ( void(*send)(HChar,void*),
void* send_arg2,
- HChar* str )
+ const HChar* str )
{
UInt ret = 0;
Int i;
Int len = local_strlen(str);
- HChar* alt;
+ const HChar* alt;
for (i = 0; i < len; i++) {
switch (str[i]) {
Int ind = 0;
Int i, nc = 0;
Bool neg = False;
- HChar* digits = capitalised ? "0123456789ABCDEF" : "0123456789abcdef";
+ const HChar* digits = capitalised ? "0123456789ABCDEF" : "0123456789abcdef";
UInt ret = 0;
if (base < 2 || base > 16)
i++;
/* %pS, like %s but escaping chars for XML safety */
/* Note: simplistic; ignores field width and flags */
- char *str = va_arg (vargs, char *);
- if (str == (char*) 0)
+ HChar *str = va_arg (vargs, HChar *);
+ if (str == NULL)
str = "(null)";
ret += myvprintf_str_XML_simplistic(send, send_arg2, str);
} else if (format[i+1] == 's') {
i++;
/* %ps, synonym for %s with --xml=no / %pS with --xml=yes */
- char *str = va_arg (vargs, char *);
- if (str == (char*) 0)
+ HChar *str = va_arg (vargs, HChar *);
+ if (str == NULL)
str = "(null)";
if (clo_xml)
ret += myvprintf_str_XML_simplistic(send, send_arg2, str);
send(va_arg (vargs, int), send_arg2);
break;
case 's': case 'S': { /* %s */
- char *str = va_arg (vargs, char *);
- if (str == (char*) 0) str = "(null)";
+ HChar *str = va_arg (vargs, HChar *);
+ if (str == NULL) str = "(null)";
ret += myvprintf_str(send, send_arg2,
flags, width, str, format[i]=='S');
break;
/* Module startup. */
/* EXPORTED */
-void VG_(debugLog_startup) ( Int level, HChar* who )
+void VG_(debugLog_startup) ( Int level, const HChar* who )
{
if (level < 0) level = 0;
if (level > 10) level = 10;
(void)myvprintf_str ( add_to_buf, &buf, 0, 1, ":", False );
(void)myvprintf_int64 ( add_to_buf, &buf, 0, 10, 1, False, (ULong)level );
(void)myvprintf_str ( add_to_buf, &buf, 0, 1, ":", False );
- (void)myvprintf_str ( add_to_buf, &buf, 0, 8, (HChar*)modulename, False );
+ (void)myvprintf_str ( add_to_buf, &buf, 0, 8, modulename, False );
(void)myvprintf_str ( add_to_buf, &buf, 0, indent, "", False );
va_start(vargs,format);
{
Char xtra[256]; /* assumed big enough (is overrun-safe) */
Bool anyXtra;
- Char* name;
+ const HChar* name;
ExeContext* ec;
XArray* /* HChar */ text;
#include "pub_core_translate.h"
#include "pub_core_mallocfree.h"
#include "pub_core_initimg.h"
+#include "pub_core_syswrap.h" // VG_(show_open_fds)
unsigned long cont_thread;
unsigned long general_thread;
UInt iterChain; // next chain to be traversed by the iterator
VgHashNode** chains; // expanding array of hash chains
Bool iterOK; // table safe to iterate over?
- HChar* name; // name of table (for debugging only)
+ const HChar* name; // name of table (for debugging only)
};
#define N_HASH_PRIMES 20
/*--- Functions ---*/
/*--------------------------------------------------------------------*/
-VgHashTable VG_(HT_construct) ( HChar* name )
+VgHashTable VG_(HT_construct) ( const HChar* name )
{
/* Initialises to zero, ie. all entries NULL */
SizeT n_chains = primes[0];
Int line, const HChar* fn, const HChar* format, ... )
{
va_list vargs;
- Char buf[256];
+ HChar buf[256];
const HChar* component;
const HChar* bugs_to;
# endif
}
-Int VG_(write_socket)( Int sd, void *msg, Int count )
+Int VG_(write_socket)( Int sd, const void *msg, Int count )
{
/* This is actually send(). */
/* Do the low-level send of a message to the logging sink. */
static
-void send_bytes_to_logging_sink ( OutputSink* sink, Char* msg, Int nbytes )
+void send_bytes_to_logging_sink ( OutputSink* sink, const HChar* msg, Int nbytes )
{
if (sink->is_socket) {
Int rc = VG_(write_socket)( sink->fd, msg, nbytes );
*(*b)++ = c;
}
-UInt VG_(vsprintf) ( Char* buf, const HChar *format, va_list vargs )
+UInt VG_(vsprintf) ( HChar* buf, const HChar *format, va_list vargs )
{
Int ret;
HChar* sprintf_ptr = buf;
return ret;
}
-UInt VG_(sprintf) ( Char* buf, const HChar *format, ... )
+UInt VG_(sprintf) ( HChar* buf, const HChar *format, ... )
{
UInt ret;
va_list vargs;
}
}
-UInt VG_(vsnprintf) ( Char* buf, Int size, const HChar *format, va_list vargs )
+UInt VG_(vsnprintf) ( HChar* buf, Int size, const HChar *format, va_list vargs )
{
snprintf_buf_t b;
b.buf = buf;
return b.buf_used;
}
-UInt VG_(snprintf) ( Char* buf, Int size, const HChar *format, ... )
+UInt VG_(snprintf) ( HChar* buf, Int size, const HChar *format, ... )
{
UInt ret;
va_list vargs;
// Percentify n/m with d decimal places. Includes the '%' symbol at the end.
// Right justifies in 'buf'.
-void VG_(percentify)(ULong n, ULong m, UInt d, Int n_buf, char buf[])
+void VG_(percentify)(ULong n, ULong m, UInt d, Int n_buf, HChar buf[])
{
Int i, len, space;
ULong p1;
- Char fmt[32];
+ HChar fmt[32];
if (m == 0) {
// Have to generate the format string in order to be flexible about
void show_BB_profile ( BBProfEntry tops[], UInt n_tops, ULong score_total )
{
ULong score_cumul, score_here;
- Char buf_cumul[10], buf_here[10];
+ HChar buf_cumul[10], buf_here[10];
Char name[64];
Int r;
------------------------------------------------------------------ */
static
-void print_sched_event ( ThreadId tid, Char* what )
+void print_sched_event ( ThreadId tid, const HChar* what )
{
VG_(message)(Vg_DebugMsg, " SCHED[%d]: %s\n", tid, what );
}
When this returns, we'll actually be running.
*/
-void VG_(acquire_BigLock)(ThreadId tid, HChar* who)
+void VG_(acquire_BigLock)(ThreadId tid, const HChar* who)
{
ThreadState *tst;
but it may mean that we remain in a Runnable state and we're just
yielding the CPU to another thread).
*/
-void VG_(release_BigLock)(ThreadId tid, ThreadStatus sleepstate, HChar* who)
+void VG_(release_BigLock)(ThreadId tid, ThreadStatus sleepstate,
+ const HChar* who)
{
ThreadState *tst = VG_(get_ThreadState)(tid);
VG_(running_tid) = VG_INVALID_THREADID;
if (VG_(clo_trace_sched)) {
- Char buf[200];
+ HChar buf[200];
vg_assert(VG_(strlen)(who) <= 200-100);
VG_(sprintf)(buf, "releasing lock (%s) -> %s",
who, VG_(name_of_ThreadStatus)(sleepstate));
}
/* See pub_core_scheduler.h for description */
-void VG_(acquire_BigLock_LL) ( HChar* who )
+void VG_(acquire_BigLock_LL) ( const HChar* who )
{
ML_(acquire_sched_lock)(the_BigLock);
}
/* See pub_core_scheduler.h for description */
-void VG_(release_BigLock_LL) ( HChar* who )
+void VG_(release_BigLock_LL) ( const HChar* who )
{
ML_(release_sched_lock)(the_BigLock);
}
case VG_USERREQ__MAP_IP_TO_SRCLOC: {
Addr ip = arg[1];
- UChar* buf64 = (UChar*)arg[2];
+ HChar* buf64 = (HChar*)arg[2];
VG_(memset)(buf64, 0, 64);
UInt linenum = 0;
if (!whined && VG_(clo_verbosity) > 2) {
// Allow for requests in core, but defined by tools, which
// have 0 and 0 in their two high bytes.
- Char c1 = (arg[0] >> 24) & 0xff;
- Char c2 = (arg[0] >> 16) & 0xff;
+ HChar c1 = (arg[0] >> 24) & 0xff;
+ HChar c2 = (arg[0] >> 16) & 0xff;
if (c1 == 0) c1 = '_';
if (c2 == 0) c2 = '_';
VG_(message)(Vg_UserMsg, "Warning:\n"
Bool (*read_extra) (Int, Char**, SizeT*, Supp*),
Bool (*matches) (Error*, Supp*),
const HChar* (*name) (Error*),
- Bool (*get_xtra_si)(Error*,/*OUT*/Char*,Int)
+ Bool (*get_xtra_si)(Error*,/*OUT*/HChar*,Int)
)
{
VG_(needs).tool_errors = True;
void VG_(print_translation_stats) ( void )
{
- Char buf[7];
+ HChar buf[7];
UInt n_SP_updates = n_SP_updates_fast + n_SP_updates_generic_known
+ n_SP_updates_generic_unknown;
VG_(percentify)(n_SP_updates_fast, n_SP_updates, 1, 6, buf);
#if defined(VGO_linux)
//---------------------------------------------------------------------------
-Char* VG_(sysnum_string)(Word sysnum, SizeT n_buf, Char* buf)
+HChar* VG_(sysnum_string)(Word sysnum, SizeT n_buf, HChar* buf)
{
VG_(snprintf)(buf, n_buf, "%3ld", sysnum);
return buf;
}
-Char* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, Char* buf)
+HChar* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, HChar* buf)
{
return VG_(sysnum_string)(sysnum, n_buf, buf);
}
#elif defined(VGO_darwin)
//---------------------------------------------------------------------------
-Char* VG_(sysnum_string)(Word sysnum, SizeT n_buf, Char* buf)
+HChar* VG_(sysnum_string)(Word sysnum, SizeT n_buf, HChar* buf)
{
- Char* classname = NULL;
+ const HChar* classname = NULL;
switch (VG_DARWIN_SYSNO_CLASS(sysnum)) {
case VG_DARWIN_SYSCALL_CLASS_MACH: classname = "mach"; break;
case VG_DARWIN_SYSCALL_CLASS_UNIX: classname = "unix"; break;
return buf;
}
-Char* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, Char* buf)
+HChar* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, HChar* buf)
{
return VG_(sysnum_string)(sysnum, n_buf, buf);
}
extern ULong VG_(am_get_anonsize_total)( void );
/* Show the segment array on the debug log, at given loglevel. */
-extern void VG_(am_show_nsegments) ( Int logLevel, HChar* who );
+extern void VG_(am_show_nsegments) ( Int logLevel, const HChar* who );
/* Get the filename corresponding to this segment, if known and if it
has one. The returned name's storage cannot be assumed to be
/* Module startup. */
extern
-void VG_(debugLog_startup) ( Int level, HChar* who );
+void VG_(debugLog_startup) ( Int level, const HChar* who );
/* Whether %ps should escape XML metacharacters. */
extern Int VG_(socket) ( Int domain, Int type, Int protocol );
-extern Int VG_(write_socket)( Int sd, void *msg, Int count );
+extern Int VG_(write_socket)( Int sd, const void *msg, Int count );
extern Int VG_(getsockname) ( Int sd, struct vki_sockaddr *name, Int *namelen );
extern Int VG_(getpeername) ( Int sd, struct vki_sockaddr *name, Int *namelen );
extern Int VG_(getsockopt) ( Int sd, Int level, Int optname,
thread state to VgTs_Runnable, and the thread will attempt to take
the CPU lock. By the time it returns, tid will be the running
thread. */
-extern void VG_(acquire_BigLock) ( ThreadId tid, HChar* who );
+extern void VG_(acquire_BigLock) ( ThreadId tid, const HChar* who );
/* Simple version, which simply acquires the lock, but does not mess
with the guest state in the same way as the non _LL version
does. */
-extern void VG_(acquire_BigLock_LL) ( HChar* who );
+extern void VG_(acquire_BigLock_LL) ( const HChar* who );
/* Set a thread into a sleeping state. Before the call, the thread
must be runnable, and holding the CPU lock. When this call
the caller's responsibility to actually block until the thread is
ready to run again. */
extern void VG_(release_BigLock) ( ThreadId tid,
- ThreadStatus state, HChar* who );
+ ThreadStatus state, const HChar* who );
/* Matching function to acquire_BigLock_LL. */
-extern void VG_(release_BigLock_LL) ( HChar* who );
+extern void VG_(release_BigLock_LL) ( const HChar* who );
/* Whether the specified thread owns the big lock. */
extern Bool VG_(owns_BigLock_LL) ( ThreadId tid );
Bool (*tool_read_extra_suppression_info) (Int, Char**, SizeT*, Supp*);
Bool (*tool_error_matches_suppression) (Error*, Supp*);
const HChar* (*tool_get_error_name) (Error*);
- Bool (*tool_get_extra_suppression_info) (Error*,/*OUT*/Char*,Int);
+ Bool (*tool_get_extra_suppression_info) (Error*,/*OUT*/HChar*,Int);
// VG_(needs).superblock_discards
void (*tool_discard_superblock_info)(Addr64, VexGuestExtents);
*/
static
Bool drd_get_extra_suppression_info(Error* e,
- /*OUT*/Char* buf, Int nBuf)
+ /*OUT*/HChar* buf, Int nBuf)
{
return False;
}
{ return memcmp(s1, s2, n); }
UInt VG_(printf)(const HChar *format, ...)
{ UInt ret; va_list vargs; va_start(vargs, format); ret = vprintf(format, vargs); va_end(vargs); return ret; }
-UInt VG_(snprintf)(Char* buf, Int size, const HChar *format, ...)
+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); }
UInt VG_(message)(VgMsgKind kind, const HChar* format, ...)
static Bool generate_pc_file=False;
/* write buffer */
-static UChar buf[1024];
+static HChar buf[1024];
/* Global values */
static OSet* instr_info_table; /* table that holds the basic block info */
static Int open_tracefile(Int thread_num)
{
SysRes sres;
- UChar temp_string[2048];
+ HChar temp_string[2048];
/* For thread 1, don't append any thread number */
/* This lets the single-thread case not have any */
/* Do a printf-style operation on either the XML or normal output
channel, depending on the setting of VG_(clo_xml).
*/
-static void emit_WRK ( HChar* format, va_list vargs )
+static void emit_WRK ( const HChar* format, va_list vargs )
{
if (VG_(clo_xml)) {
VG_(vprintf_xml)(format, vargs);
VG_(vmessage)(Vg_UserMsg, format, vargs);
}
}
-static void emit ( HChar* format, ... ) PRINTF_CHECK(1, 2);
-static void emit ( HChar* format, ... )
+static void emit ( const HChar* format, ... ) PRINTF_CHECK(1, 2);
+static void emit ( const HChar* format, ... )
{
va_list vargs;
va_start(vargs, format);
emit_WRK(format, vargs);
va_end(vargs);
}
-static void emiN ( HChar* format, ... ) /* With NO FORMAT CHECK */
+static void emiN ( const HChar* format, ... ) /* With NO FORMAT CHECK */
{
va_list vargs;
va_start(vargs, format);
}
-static HChar* readwrite(SSizeT sszB)
+static const HChar* readwrite(SSizeT sszB)
{
return ( sszB < 0 ? "write" : "read" );
}
//----------------------------------------------------------
case XE_Heap: {
- HChar *place, *legit, *how_invalid;
+ const HChar *place, *legit, *how_invalid;
Addr a = xe->XE.Heap.addr;
Seg* vseg = xe->XE.Heap.vseg;
case XE_Arith: {
Seg* seg1 = xe->XE.Arith.seg1;
Seg* seg2 = xe->XE.Arith.seg2;
- HChar* which;
+ const HChar* which;
tl_assert(BOTTOM != seg1);
tl_assert(BOTTOM != seg2 && UNKNOWN != seg2);
Seg* seglo = xe->XE.SysParam.seglo;
Seg* seghi = xe->XE.SysParam.seghi;
const HChar* s = VG_(get_error_string) (err);
- HChar* what;
+ const HChar* what;
tl_assert(BOTTOM != seglo && BOTTOM != seghi);
}
Bool pc_get_extra_suppression_info ( Error* err,
- /*OUT*/Char* buf, Int nBuf )
+ /*OUT*/HChar* buf, Int nBuf )
{
ErrorKind ekind = VG_(get_error_kind )(err);
tl_assert(buf);
Bool pc_error_matches_suppression (Error* err, Supp* su);
const HChar* pc_get_error_name ( Error* err );
Bool pc_get_extra_suppression_info ( Error* err,
- /*OUT*/Char* buf, Int nBuf );
+ /*OUT*/HChar* buf, Int nBuf );
extern Bool h_clo_partial_loads_ok;
/* extern Bool h_clo_lossage_check; */
}
Bool HG_(get_extra_suppression_info) ( Error* err,
- /*OUT*/Char* buf, Int nBuf )
+ /*OUT*/HChar* buf, Int nBuf )
{
/* Do nothing */
return False;
Bool HG_(error_matches_suppression) ( Error* err, Supp* su );
const HChar* HG_(get_error_name) ( Error* err );
Bool HG_(get_extra_suppression_info) ( Error* err,
- /*OUT*/Char* buf, Int nBuf );
+ /*OUT*/HChar* buf, Int nBuf );
/* Functions for recording various kinds of errors. */
void HG_(record_error_Race) ( Thread* thr,
be freed with VG_(free)(). The table starts small but will
periodically be expanded. This is transparent to the users of this
module. */
-extern VgHashTable VG_(HT_construct) ( HChar* name );
+extern VgHashTable VG_(HT_construct) ( const HChar* name );
/* Count the number of nodes in a table. */
extern Int VG_(HT_count_nodes) ( VgHashTable table );
Formatting functions
------------------------------------------------------------------ */
-extern UInt VG_(sprintf) ( Char* buf, const HChar* format, ... )
+extern UInt VG_(sprintf) ( HChar* buf, const HChar* format, ... )
PRINTF_CHECK(2, 3);
-extern UInt VG_(vsprintf) ( Char* buf, const HChar* format, va_list vargs )
+extern UInt VG_(vsprintf) ( HChar* buf, const HChar* format, va_list vargs )
PRINTF_CHECK(2, 0);
-extern UInt VG_(snprintf) ( Char* buf, Int size,
+extern UInt VG_(snprintf) ( HChar* buf, Int size,
const HChar *format, ... )
PRINTF_CHECK(3, 4);
-extern UInt VG_(vsnprintf)( Char* buf, Int size,
+extern UInt VG_(vsnprintf)( HChar* buf, Int size,
const HChar *format, va_list vargs )
PRINTF_CHECK(3, 0);
// Percentify n/m with d decimal places. Includes the '%' symbol at the end.
// Right justifies in 'buf'.
-extern void VG_(percentify)(ULong n, ULong m, UInt d, Int n_buf, char buf[]);
+extern void VG_(percentify)(ULong n, ULong m, UInt d, Int n_buf, HChar buf[]);
/* ---------------------------------------------------------------------
// do nothing, and return False. This function is the inverse of
// VG_(tdict).tool_read_extra_suppression_info().
Bool (*print_extra_suppression_info)(Error* err,
- /*OUT*/Char* buf, Int nBuf)
+ /*OUT*/HChar* buf, Int nBuf)
);
/* Is information kept by the tool about specific instructions or
// This converts a syscall number into a string, suitable for printing. It is
// needed because some platforms (Darwin) munge sysnums in various ways.
// It is used in places where the sycall name will be printed alongside.
-extern Char* VG_(sysnum_string) (Word sysnum, SizeT n_buf, Char* buf);
+extern HChar* VG_(sysnum_string) (Word sysnum, SizeT n_buf, HChar* buf);
// This is like VG_(sysnum_string), but prints extra info if needed. It is
// called in places where the syscall name will *not* be printed alongside.
-extern Char* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, Char* buf);
+extern HChar* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, HChar* buf);
// Macros that make the above functions easier to use by declaring a local
// buffer.
#define VG_SYSNUM_STRING(sysnum) \
- ({ Char qq_zz_buf[32]; VG_(sysnum_string)(sysnum, 32, qq_zz_buf); })
+ ({ HChar qq_zz_buf[32]; VG_(sysnum_string)(sysnum, 32, qq_zz_buf); })
#define VG_SYSNUM_STRING_EXTRA(sysnum) \
- ({ Char qq_zz_buf[64]; VG_(sysnum_string_extra)(sysnum, 64, qq_zz_buf); })
+ ({ HChar qq_zz_buf[64]; VG_(sysnum_string_extra)(sysnum, 64, qq_zz_buf); })
#endif // __PUB_TOOL_VKISCNUMS_H
//--- Writing snapshots ---//
//------------------------------------------------------------//
-Char FP_buf[BUF_LEN];
+HChar FP_buf[BUF_LEN];
// XXX: implement f{,n}printf in m_libcprint.c eventually, and use it here.
// Then change Cachegrind to use it too.
})
// Nb: uses a static buffer, each call trashes the last string returned.
-static Char* make_perc(double x)
+static HChar* make_perc(double x)
{
- static Char mbuf[32];
+ static HChar mbuf[32];
VG_(percentify)((ULong)(x * 100), 10000, 2, 6, mbuf);
// XXX: this is bogus if the denominator was zero -- resulting string is
/* Do a printf-style operation on either the XML or normal output
channel, depending on the setting of VG_(clo_xml).
*/
-static void emit_WRK ( HChar* format, va_list vargs )
+static void emit_WRK ( const HChar* format, va_list vargs )
{
if (VG_(clo_xml)) {
VG_(vprintf_xml)(format, vargs);
VG_(vmessage)(Vg_UserMsg, format, vargs);
}
}
-static void emit ( HChar* format, ... ) PRINTF_CHECK(1, 2);
-static void emit ( HChar* format, ... )
+static void emit ( const HChar* format, ... ) PRINTF_CHECK(1, 2);
+static void emit ( const HChar* format, ... )
{
va_list vargs;
va_start(vargs, format);
emit_WRK(format, vargs);
va_end(vargs);
}
-static void emiN ( HChar* format, ... ) /* NO FORMAT CHECK */
+static void emiN ( const HChar* format, ... ) /* NO FORMAT CHECK */
{
va_list vargs;
va_start(vargs, format);
}
}
-char * MC_(snprintf_delta) (char * buf, Int size,
- SizeT current_val, SizeT old_val,
- LeakCheckDeltaMode delta_mode)
+HChar * MC_(snprintf_delta) (HChar * buf, Int size,
+ SizeT current_val, SizeT old_val,
+ LeakCheckDeltaMode delta_mode)
{
if (delta_mode == LCD_Any)
buf[0] = '\0';
{
// char arrays to produce the indication of increase/decrease in case
// of delta_mode != LCD_Any
- char d_bytes[20];
- char d_direct_bytes[20];
- char d_indirect_bytes[20];
- char d_num_blocks[20];
+ HChar d_bytes[20];
+ HChar d_direct_bytes[20];
+ HChar d_indirect_bytes[20];
+ HChar d_num_blocks[20];
MC_(snprintf_delta) (d_bytes, 20,
lr->szB + lr->indirect_szB,
}
Bool MC_(get_extra_suppression_info) ( Error* err,
- /*OUT*/Char* buf, Int nBuf )
+ /*OUT*/HChar* buf, Int nBuf )
{
ErrorKind ekind = VG_(get_error_kind )(err);
tl_assert(buf);
// if delta_mode == LCD_Any, prints in buf an empty string
// otherwise prints a delta in the layout " (+%'lu)" or " (-%'lu)"
-extern char * MC_(snprintf_delta) (char * buf, Int size,
- SizeT current_val, SizeT old_val,
- LeakCheckDeltaMode delta_mode);
+extern HChar * MC_(snprintf_delta) (HChar * buf, Int size,
+ SizeT current_val, SizeT old_val,
+ LeakCheckDeltaMode delta_mode);
Bool MC_(is_valid_aligned_word) ( Addr a );
Bool MC_(error_matches_suppression) ( Error* err, Supp* su );
Bool MC_(get_extra_suppression_info) ( Error* err,
- /*OUT*/Char* buf, Int nBuf );
+ /*OUT*/HChar* buf, Int nBuf );
const HChar* MC_(get_error_name) ( Error* err );
secVBitTable = secVBitTable2;
if (VG_(clo_verbosity) > 1) {
- Char percbuf[7];
+ HChar percbuf[7];
VG_(percentify)(n_survivors, n_nodes, 1, 6, percbuf);
VG_(message)(Vg_DebugMsg, "memcheck GC: %d nodes, %d survivors (%s)\n",
n_nodes, n_survivors, percbuf);