From: Florian Krohm Date: Wed, 5 Aug 2015 19:04:51 +0000 (+0000) Subject: Fix printf format inconsistencies as pointed out by gcc -Wformat-signedness. X-Git-Tag: svn/VALGRIND_3_11_0~159 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84a68aadccafd0397dbf02bb59030b8f75354187;p=thirdparty%2Fvalgrind.git Fix printf format inconsistencies as pointed out by gcc -Wformat-signedness. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15498 --- diff --git a/callgrind/bb.c b/callgrind/bb.c index d6d5efb587..686f97c2c3 100644 --- a/callgrind/bb.c +++ b/callgrind/bb.c @@ -101,7 +101,7 @@ void resize_bb_table(void) VG_(free)(bbs.table); - CLG_DEBUG(0, "Resize BB Hash: %d => %d (entries %d, conflicts %d/%d)\n", + CLG_DEBUG(0, "Resize BB Hash: %u => %d (entries %u, conflicts %d/%d)\n", bbs.size, new_size, bbs.entries, conflicts1, conflicts2); @@ -157,7 +157,7 @@ static BB* new_bb(obj_node* obj, PtrdiffT offset, #if CLG_ENABLE_DEBUG CLG_DEBUGIF(3) { - VG_(printf)(" new_bb (instr %d, jmps %d, inv %s) [now %d]: ", + VG_(printf)(" new_bb (instr %u, jmps %u, inv %s) [now %d]: ", instr_count, cjmp_count, cjmp_inverted ? "yes":"no", CLG_(stat).distinct_bbs); @@ -188,7 +188,7 @@ BB* lookup_bb(obj_node* obj, PtrdiffT offset) } CLG_DEBUG(5, " lookup_bb (Obj %s, off %#lx): %p\n", - obj->name, offset, bb); + obj->name, (UWord)offset, bb); return bb; } @@ -260,12 +260,12 @@ BB* CLG_(get_bb)(Addr addr, IRSB* bbIn, /*OUT*/ Bool *seen_before) "ERROR: BB Retranslation Mismatch at BB %#lx\n", addr); VG_(message)(Vg_DebugMsg, " new: Obj %s, Off %#lx, BBOff %#lx, Instrs %u\n", - obj->name, obj->offset, + obj->name, (UWord)obj->offset, addr - obj->offset, n_instrs); VG_(message)(Vg_DebugMsg, " old: Obj %s, Off %#lx, BBOff %#lx, Instrs %u\n", - bb->obj->name, bb->obj->offset, - bb->offset, bb->instr_count); + bb->obj->name, (UWord)bb->obj->offset, + (UWord)bb->offset, bb->instr_count); CLG_ASSERT(bb->instr_count == n_instrs ); } CLG_ASSERT(bb->cjmp_count == n_jmps ); @@ -306,7 +306,7 @@ void CLG_(delete_bb)(Addr addr) if (bb == NULL) { CLG_DEBUG(3, " delete_bb (Obj %s, off %#lx): NOT FOUND\n", - obj->name, offset); + obj->name, (UWord)offset); /* we didn't find it. * this happens when callgrinds instrumentation mode @@ -327,7 +327,7 @@ void CLG_(delete_bb)(Addr addr) } CLG_DEBUG(3, " delete_bb (Obj %s, off %#lx): %p, BBCC head: %p\n", - obj->name, offset, bb, bb->bbcc_list); + obj->name, (UWord)offset, bb, bb->bbcc_list); if (bb->bbcc_list == 0) { /* can be safely deleted */ diff --git a/callgrind/bbcc.c b/callgrind/bbcc.c index 1580a47c29..9bf9c5cef6 100644 --- a/callgrind/bbcc.c +++ b/callgrind/bbcc.c @@ -86,8 +86,8 @@ void CLG_(zero_bbcc)(BBCC* bbcc) jCC* jcc; CLG_ASSERT(bbcc->cxt != 0); - CLG_DEBUG(1, " zero_bbcc: BB %#lx, Cxt %d " - "(fn '%s', rec %d)\n", + CLG_DEBUG(1, " zero_bbcc: BB %#lx, Cxt %u " + "(fn '%s', rec %u)\n", bb_addr(bbcc->bb), bbcc->cxt->base_number + bbcc->rec_index, bbcc->cxt->fn[0]->name, @@ -178,7 +178,7 @@ BBCC* lookup_bbcc(BB* bb, Context* cxt) bbcc = bbcc->next; } - CLG_DEBUG(2," lookup_bbcc(BB %#lx, Cxt %d, fn '%s'): %p (tid %d)\n", + CLG_DEBUG(2," lookup_bbcc(BB %#lx, Cxt %u, fn '%s'): %p (tid %u)\n", bb_addr(bb), cxt->base_number, cxt->fn[0]->name, bbcc, bbcc ? bbcc->tid : 0); @@ -230,7 +230,7 @@ static void resize_bbcc_hash(void) VG_(free)(current_bbccs.table); - CLG_DEBUG(0,"Resize BBCC Hash: %d => %d (entries %d, conflicts %d/%d)\n", + CLG_DEBUG(0,"Resize BBCC Hash: %u => %d (entries %u, conflicts %d/%d)\n", current_bbccs.size, new_size, current_bbccs.entries, conflicts1, conflicts2); @@ -332,7 +332,7 @@ void insert_bbcc_into_hash(BBCC* bbcc) bbcc->next = current_bbccs.table[idx]; current_bbccs.table[idx] = bbcc; - CLG_DEBUG(3,"- insert_bbcc_into_hash: %d entries\n", + CLG_DEBUG(3,"- insert_bbcc_into_hash: %u entries\n", current_bbccs.entries); } @@ -906,7 +906,7 @@ void CLG_(setup_bbcc)(BB* bb) VG_(printf)("\n"); } - CLG_DEBUG(3,"- setup_bbcc (BB %#lx): Cost %p (Len %d), Instrs %d (Len %d)\n", + CLG_DEBUG(3,"- setup_bbcc (BB %#lx): Cost %p (Len %u), Instrs %u (Len %u)\n", bb_addr(bb), bbcc->cost, bb->cost_count, bb->instr_count, bb->instr_len); CLG_DEBUGIF(3) diff --git a/callgrind/callstack.c b/callgrind/callstack.c index 19846af437..645378ee69 100644 --- a/callgrind/callstack.c +++ b/callgrind/callstack.c @@ -107,7 +107,7 @@ void ensure_stack_size(Int i) CLG_(stat).call_stack_resizes++; CLG_DEBUGIF(2) - VG_(printf)(" call stack enlarged to %d entries\n", + VG_(printf)(" call stack enlarged to %u entries\n", CLG_(current_call_stack).size); } @@ -280,7 +280,7 @@ void CLG_(push_call_stack)(BBCC* from, UInt jmp, BBCC* to, Addr sp, Bool skip) ". . . . . . . . . . " }; int s = CLG_(current_call_stack).sp; - Int* pars = (Int*) sp; + UInt* pars = (UInt*) sp; BB* bb = jcc->to->bb; if (s>40) s=40; @@ -288,7 +288,7 @@ void CLG_(push_call_stack)(BBCC* from, UInt jmp, BBCC* to, Addr sp, Bool skip) pars ? pars[1]:0, pars ? pars[2]:0, bb->obj->name + bb->obj->last_slash_pos, - bb->offset); + (UWord)bb->offset); } } else if (CLG_(clo).verbose<4) { diff --git a/callgrind/context.c b/callgrind/context.c index 92b85276e7..73d1122fa4 100644 --- a/callgrind/context.c +++ b/callgrind/context.c @@ -120,7 +120,7 @@ static void resize_cxt_table(void) VG_(free)(cxts.table); - CLG_DEBUG(0, "Resize Context Hash: %d => %d (entries %d, conflicts %d/%d)\n", + CLG_DEBUG(0, "Resize Context Hash: %u => %u (entries %u, conflicts %u/%u)\n", cxts.size, new_size, cxts.entries, conflicts1, conflicts2); @@ -236,7 +236,7 @@ Context* CLG_(get_cxt)(fn_node** fn) size = (*fn)->separate_callers+1; if (size<=0) { size = -size+1; } - CLG_DEBUG(5, "+ get_cxt(fn '%s'): size %d\n", + CLG_DEBUG(5, "+ get_cxt(fn '%s'): size %u\n", (*fn)->name, size); hash = cxt_hash_val(fn, size); @@ -279,7 +279,7 @@ void CLG_(push_cxt)(fn_node* fn) CLG_DEBUG(5, "+ push_cxt(fn '%s'): old ctx %d\n", fn ? fn->name : "0x0", CLG_(current_state).cxt ? - CLG_(current_state).cxt->base_number : -1); + (Int)CLG_(current_state).cxt->base_number : -1); /* save old context on stack (even if not changed at all!) */ CLG_ASSERT(cs->sp < cs->size); @@ -294,7 +294,7 @@ void CLG_(push_cxt)(fn_node* fn) /* resizing needed ? */ fn_entries = CLG_(current_fn_stack).top - CLG_(current_fn_stack).bottom; if (fn_entries == CLG_(current_fn_stack).size-1) { - int new_size = CLG_(current_fn_stack).size *2; + UInt new_size = CLG_(current_fn_stack).size *2; fn_node** new_array = (fn_node**) CLG_MALLOC("cl.context.pc.1", new_size * sizeof(fn_node*)); int i; @@ -304,7 +304,7 @@ void CLG_(push_cxt)(fn_node* fn) CLG_(current_fn_stack).top = new_array + fn_entries; CLG_(current_fn_stack).bottom = new_array; - CLG_DEBUG(0, "Resize Context Stack: %d => %d (pushing '%s')\n", + CLG_DEBUG(0, "Resize Context Stack: %u => %u (pushing '%s')\n", CLG_(current_fn_stack).size, new_size, fn ? fn->name : "0x0"); @@ -326,7 +326,7 @@ void CLG_(push_cxt)(fn_node* fn) CLG_DEBUG(5, "- push_cxt(fn '%s'): new cxt %d, fn_sp %ld\n", fn ? fn->name : "0x0", CLG_(current_state).cxt ? - CLG_(current_state).cxt->base_number : -1, + (Int)CLG_(current_state).cxt->base_number : -1, CLG_(current_fn_stack).top - CLG_(current_fn_stack).bottom + 0L); } diff --git a/callgrind/debug.c b/callgrind/debug.c index 2ef21fd017..e4195cc0db 100644 --- a/callgrind/debug.c +++ b/callgrind/debug.c @@ -83,9 +83,9 @@ void CLG_(print_cxt)(Int s, Context* cxt, int rec_index) UInt *pactive = CLG_(get_fn_entry)(cxt->fn[0]->number); CLG_ASSERT(rec_index < cxt->fn[0]->separate_recursions); - VG_(printf)("Cxt %d" ,cxt->base_number + rec_index); + VG_(printf)("Cxt %u" ,cxt->base_number + rec_index); if (*pactive>0) - VG_(printf)(" [active=%d]", *pactive); + VG_(printf)(" [active=%u]", *pactive); VG_(printf)(": "); print_mangled_cxt(cxt, rec_index); VG_(printf)("\n"); @@ -131,7 +131,7 @@ void CLG_(print_bbcc)(int s, BBCC* bbcc) VG_(printf)("%s +%#lx=%#lx, ", bb->obj->name + bb->obj->last_slash_pos, - bb->offset, bb_addr(bb)); + (UWord)bb->offset, bb_addr(bb)); CLG_(print_cxt)(s+8, bbcc->cxt, bbcc->rec_index); } @@ -151,7 +151,7 @@ void CLG_(print_eventset)(int s, EventSet* es) return; } - VG_(printf)("EventSet %d (%d groups, size %d):", + VG_(printf)("EventSet %u (%d groups, size %d):", es->mask, es->count, es->size); if (es->count == 0) { @@ -188,7 +188,7 @@ void CLG_(print_cost)(int s, EventSet* es, ULong* c) return; } if (!c) { - VG_(printf)("Cost (Null, EventSet %d)\n", es->mask); + VG_(printf)("Cost (Null, EventSet %u)\n", es->mask); return; } @@ -297,11 +297,11 @@ void CLG_(print_bbcc_fn)(BBCC* bbcc) obj_node* obj; if (!bbcc) { - VG_(printf)("%08x", 0); + VG_(printf)("%08x", 0u); return; } - VG_(printf)("%08lx/%c %d:", bb_addr(bbcc->bb), + VG_(printf)("%08lx/%c %u:", bb_addr(bbcc->bb), (bbcc->bb->sect_kind == Vg_SectText) ? 'T' : (bbcc->bb->sect_kind == Vg_SectData) ? 'D' : (bbcc->bb->sect_kind == Vg_SectBSS) ? 'B' : @@ -317,7 +317,7 @@ void CLG_(print_bbcc_fn)(BBCC* bbcc) if (VG_(strcmp)(bbcc->cxt->fn[0]->file->name, "???") !=0) { VG_(printf)(" %s", bbcc->cxt->fn[0]->file->name); if ((bbcc->cxt->fn[0] == bbcc->bb->fn) && (bbcc->bb->line>0)) - VG_(printf)(":%d", bbcc->bb->line); + VG_(printf)(":%u", bbcc->bb->line); } } @@ -347,7 +347,7 @@ void CLG_(print_bbcc_cost)(int s, BBCC* bbcc) print_indent(s+2); VG_(printf)("ECounter: sum %llu ", ecounter); for(i=0; icjmp_count; i++) { - VG_(printf)("[%d]=%llu ", + VG_(printf)("[%u]=%llu ", bb->jmp[i].instr, bbcc->jmp[i].ecounter); } VG_(printf)("\n"); @@ -356,7 +356,7 @@ void CLG_(print_bbcc_cost)(int s, BBCC* bbcc) for(i=0; iinstr_count; i++) { InstrInfo* ii = &(bb->instr[i]); print_indent(s+2); - VG_(printf)("[%2d] IOff %2d ecnt %3llu ", + VG_(printf)("[%2d] IOff %2u ecnt %3llu ", i, ii->instr_offset, ecounter); CLG_(print_cost)(s+5, ii->eventset, bbcc->cost + ii->cost_offset); @@ -430,7 +430,7 @@ void CLG_(print_context)(void) { BBCC* bbcc; - CLG_DEBUG(0,"In tid %d [%d] ", + CLG_DEBUG(0,"In tid %u [%d] ", CLG_(current_tid), CLG_(current_call_stack).sp); bbcc = CLG_(current_state).bbcc; print_mangled_cxt(CLG_(current_state).cxt, diff --git a/callgrind/dump.c b/callgrind/dump.c index 044d69d8d0..d332890b78 100644 --- a/callgrind/dump.c +++ b/callgrind/dump.c @@ -129,9 +129,9 @@ static void print_obj(VgFile *fp, const HChar* prefix, obj_node* obj) if (CLG_(clo).compress_strings) { CLG_ASSERT(obj_dumped != 0); if (obj_dumped[obj->number]) - VG_(fprintf)(fp, "%s(%d)\n", prefix, obj->number); + VG_(fprintf)(fp, "%s(%u)\n", prefix, obj->number); else { - VG_(fprintf)(fp, "%s(%d) %s\n", prefix, obj->number, obj->name); + VG_(fprintf)(fp, "%s(%u) %s\n", prefix, obj->number, obj->name); } } else @@ -155,9 +155,9 @@ static void print_file(VgFile *fp, const char *prefix, const file_node* file) if (CLG_(clo).compress_strings) { CLG_ASSERT(file_dumped != 0); if (file_dumped[file->number]) - VG_(fprintf)(fp, "%s(%d)\n", prefix, file->number); + VG_(fprintf)(fp, "%s(%u)\n", prefix, file->number); else { - VG_(fprintf)(fp, "%s(%d) %s\n", prefix, file->number, file->name); + VG_(fprintf)(fp, "%s(%u) %s\n", prefix, file->number, file->name); file_dumped[file->number] = True; } } @@ -174,9 +174,9 @@ static void print_fn(VgFile *fp, const HChar* tag, const fn_node* fn) if (CLG_(clo).compress_strings) { CLG_ASSERT(fn_dumped != 0); if (fn_dumped[fn->number]) - VG_(fprintf)(fp, "(%d)\n", fn->number); + VG_(fprintf)(fp, "(%u)\n", fn->number); else { - VG_(fprintf)(fp, "(%d) %s\n", fn->number, fn->name); + VG_(fprintf)(fp, "(%u) %s\n", fn->number, fn->name); fn_dumped[fn->number] = True; } } @@ -196,7 +196,7 @@ static void print_mangled_fn(VgFile *fp, const HChar* tag, CLG_ASSERT(cxt_dumped != 0); if (cxt_dumped[cxt->base_number+rec_index]) { - VG_(fprintf)(fp, "%s=(%d)\n", + VG_(fprintf)(fp, "%s=(%u)\n", tag, cxt->base_number + rec_index); return; } @@ -216,13 +216,13 @@ static void print_mangled_fn(VgFile *fp, const HChar* tag, /* If the last context was the context to print, we are finished */ if ((last == cxt) && (rec_index == 0)) return; - VG_(fprintf)(fp, "%s=(%d) (%d)", tag, + VG_(fprintf)(fp, "%s=(%u) (%u)", tag, cxt->base_number + rec_index, cxt->fn[0]->pure_cxt->base_number); if (rec_index >0) VG_(fprintf)(fp, "'%d", rec_index +1); for(i=1;isize;i++) - VG_(fprintf)(fp, "'(%d)", + VG_(fprintf)(fp, "'(%u)", cxt->fn[i]->pure_cxt->base_number); VG_(fprintf)(fp, "\n"); @@ -235,11 +235,11 @@ static void print_mangled_fn(VgFile *fp, const HChar* tag, if (CLG_(clo).compress_strings) { CLG_ASSERT(cxt_dumped != 0); if (cxt_dumped[cxt->base_number+rec_index]) { - VG_(fprintf)(fp, "(%d)\n", cxt->base_number + rec_index); + VG_(fprintf)(fp, "(%u)\n", cxt->base_number + rec_index); return; } else { - VG_(fprintf)(fp, "(%d) ", cxt->base_number + rec_index); + VG_(fprintf)(fp, "(%u) ", cxt->base_number + rec_index); cxt_dumped[cxt->base_number+rec_index] = True; } } @@ -273,7 +273,7 @@ static Bool print_fn_pos(VgFile *fp, FnPos* last, BBCC* bbcc) if (!CLG_(clo).mangle_names) { if (last->rec_index != bbcc->rec_index) { - VG_(fprintf)(fp, "rec=%d\n\n", bbcc->rec_index); + VG_(fprintf)(fp, "rec=%u\n\n", bbcc->rec_index); last->rec_index = bbcc->rec_index; last->cxt = 0; /* reprint context */ res = True; @@ -436,7 +436,7 @@ static void fprint_apos(VgFile *fp, AddrPos* curr, AddrPos* last, file_node* func_file) { CLG_ASSERT(curr->file != 0); - CLG_DEBUG(2, " print_apos(file '%s', line %d, bb %#lx, addr %#lx) fnFile '%s'\n", + CLG_DEBUG(2, " print_apos(file '%s', line %u, bb %#lx, addr %#lx) fnFile '%s'\n", curr->file->name, curr->line, curr->bb_addr, curr->addr, func_file->name); @@ -451,7 +451,7 @@ static void fprint_apos(VgFile *fp, AddrPos* curr, AddrPos* last, if (CLG_(clo).dump_bbs) { if (curr->line != last->line) { - VG_(fprintf)(fp, "ln=%d\n", curr->line); + VG_(fprintf)(fp, "ln=%u\n", curr->line); } } } @@ -541,7 +541,7 @@ void fprint_cost(VgFile *fp, const EventMapping* es, const ULong* cost) static void fprint_fcost(VgFile *fp, AddrCost* c, AddrPos* last) { CLG_DEBUGIF(3) { - CLG_DEBUG(2, " print_fcost(file '%s', line %d, bb %#lx, addr %#lx):\n", + CLG_DEBUG(2, " print_fcost(file '%s', line %u, bb %#lx, addr %#lx):\n", c->p.file->name, c->p.line, c->p.bb_addr, c->p.addr); CLG_(print_cost)(-5, CLG_(sets).full, c->cost); } @@ -566,7 +566,7 @@ static void fprint_jcc(VgFile *fp, jCC* jcc, AddrPos* curr, AddrPos* last, obj_node* obj; CLG_DEBUGIF(2) { - CLG_DEBUG(2, " fprint_jcc (jkind %d)\n", jcc->jmpkind); + CLG_DEBUG(2, " fprint_jcc (jkind %d)\n", (Int)jcc->jmpkind); CLG_(print_jcc)(-10, jcc); } @@ -689,7 +689,7 @@ static Bool fprint_bbcc(VgFile *fp, BBCC* bbcc, AddrPos* last) CLG_ASSERT(bbcc->cxt != 0); CLG_DEBUGIF(1) { - VG_(printf)("+ fprint_bbcc (Instr %d): ", bb->instr_count); + VG_(printf)("+ fprint_bbcc (Instr %u): ", bb->instr_count); CLG_(print_bbcc)(15, bbcc); } @@ -1049,7 +1049,7 @@ static void cs_addCount(thread_info* ti) e->enter_cost, CLG_(current_state).cost); bbcc = e->jcc->from; - CLG_DEBUG(1, " [%2d] (tid %d), added active: %s\n", + CLG_DEBUG(1, " [%2d] (tid %u), added active: %s\n", i,CLG_(current_tid),bbcc->cxt->fn[0]->name); if (bbcc->ecounter_sum>0 || bbcc->ret_counter>0) { @@ -1372,11 +1372,11 @@ static void print_bbccs_of_thread(thread_info* ti) FnPos lastFnPos; AddrPos lastAPos; - CLG_DEBUG(1, "+ print_bbccs(tid %d)\n", CLG_(current_tid)); + CLG_DEBUG(1, "+ print_bbccs(tid %u)\n", CLG_(current_tid)); VgFile *print_fp = new_dumpfile(CLG_(current_tid), print_trigger); if (print_fp == NULL) { - CLG_DEBUG(1, "- print_bbccs(tid %d): No output...\n", CLG_(current_tid)); + CLG_DEBUG(1, "- print_bbccs(tid %u): No output...\n", CLG_(current_tid)); return; } @@ -1419,14 +1419,14 @@ static void print_bbccs_of_thread(thread_info* ti) /* FIXME: Specify Object of BB if different to object of fn */ int i; ULong ecounter = (*p)->ecounter_sum; - VG_(fprintf)(print_fp, "bb=%#lx ", (*p)->bb->offset); + VG_(fprintf)(print_fp, "bb=%#lx ", (UWord)(*p)->bb->offset); for(i = 0; i<(*p)->bb->cjmp_count;i++) { - VG_(fprintf)(print_fp, "%d %llu ", + VG_(fprintf)(print_fp, "%u %llu ", (*p)->bb->jmp[i].instr, ecounter); ecounter -= (*p)->jmp[i].ecounter; } - VG_(fprintf)(print_fp, "%d %llu\n", + VG_(fprintf)(print_fp, "%u %llu\n", (*p)->bb->instr_count, ecounter); } @@ -1443,7 +1443,7 @@ static void print_bbccs_of_thread(thread_info* ti) CLG_(copy_cost)( CLG_(sets).full, ti->lastdump_cost, CLG_(current_state).cost ); - CLG_DEBUG(1, "- print_bbccs(tid %d)\n", CLG_(current_tid)); + CLG_DEBUG(1, "- print_bbccs(tid %u)\n", CLG_(current_tid)); } diff --git a/callgrind/fn.c b/callgrind/fn.c index c348fd77d1..d2df957518 100644 --- a/callgrind/fn.c +++ b/callgrind/fn.c @@ -508,10 +508,10 @@ fn_node* CLG_(get_fn_node)(BB* bb) static HChar buf[32]; // for sure large enough /* Use address as found in library */ if (sizeof(Addr) == 4) - p = VG_(sprintf)(buf, "%#08lx", bb->offset); + p = VG_(sprintf)(buf, "%#08lx", (UWord)bb->offset); else // 64bit address - p = VG_(sprintf)(buf, "%#016lx", bb->offset); + p = VG_(sprintf)(buf, "%#016lx", (UWord)bb->offset); VG_(sprintf)(buf + p, "%s", (bb->sect_kind == Vg_SectData) ? " [Data]" : @@ -572,7 +572,7 @@ fn_node* CLG_(get_fn_node)(BB* bb) VG_(message)(Vg_DebugMsg, "Symbol match: found runtime_resolve:" " %s +%#lx=%#lx\n", bb->obj->name + bb->obj->last_slash_pos, - bb->offset, bb_addr(bb)); + (UWord)bb->offset, bb_addr(bb)); } fn->is_malloc = (VG_(strcmp)(fn->name, "malloc")==0); @@ -663,12 +663,12 @@ void CLG_(set_current_fn_array)(fn_array* a) static void resize_fn_array(void) { UInt* new_array; - Int i, newsize; + Int i; - newsize = current_fn_active.size; + UInt newsize = current_fn_active.size; while (newsize <= CLG_(stat).distinct_fns) newsize *=2; - CLG_DEBUG(0, "Resize fn_active_array: %d => %d\n", + CLG_DEBUG(0, "Resize fn_active_array: %u => %u\n", current_fn_active.size, newsize); new_array = (UInt*) CLG_MALLOC("cl.fn.rfa.1", newsize * sizeof(UInt)); diff --git a/callgrind/jumps.c b/callgrind/jumps.c index ae787b2faf..c7cfd307ab 100644 --- a/callgrind/jumps.c +++ b/callgrind/jumps.c @@ -119,7 +119,7 @@ static void resize_jcc_table(void) VG_(free)(current_jccs.table); - CLG_DEBUG(0, "Resize JCC Hash: %d => %d (entries %d, conflicts %d/%d)\n", + CLG_DEBUG(0, "Resize JCC Hash: %u => %d (entries %u, conflicts %d/%d)\n", current_jccs.size, new_size, current_jccs.entries, conflicts1, conflicts2); @@ -188,7 +188,7 @@ jCC* CLG_(get_jcc)(BBCC* from, UInt jmp, BBCC* to) jCC* jcc; UInt idx; - CLG_DEBUG(5, "+ get_jcc(bbcc %p/%d => bbcc %p)\n", + CLG_DEBUG(5, "+ get_jcc(bbcc %p/%u => bbcc %p)\n", from, jmp, to); /* first check last recently used JCC */ diff --git a/callgrind/main.c b/callgrind/main.c index 5e501bc41b..c9d5db24c8 100644 --- a/callgrind/main.c +++ b/callgrind/main.c @@ -140,7 +140,7 @@ void log_cond_branch(InstrInfo* ii, Word taken) Int fullOffset_Bc; ULong* cost_Bc; - CLG_DEBUG(6, "log_cond_branch: Ir %#lx, taken %lu\n", + CLG_DEBUG(6, "log_cond_branch: Ir %#lx, taken %ld\n", CLG_(bb_base) + ii->instr_offset, taken); miss = 1 & do_cond_branch_predict(CLG_(bb_base) + ii->instr_offset, taken); @@ -331,23 +331,23 @@ static void showEvent ( Event* ev ) { switch (ev->tag) { case Ev_Ir: - VG_(printf)("Ir (InstrInfo %p) at +%d\n", + VG_(printf)("Ir (InstrInfo %p) at +%u\n", ev->inode, ev->inode->instr_offset); break; case Ev_Dr: - VG_(printf)("Dr (InstrInfo %p) at +%d %d EA=", + VG_(printf)("Dr (InstrInfo %p) at +%u %d EA=", ev->inode, ev->inode->instr_offset, ev->Ev.Dr.szB); ppIRExpr(ev->Ev.Dr.ea); VG_(printf)("\n"); break; case Ev_Dw: - VG_(printf)("Dw (InstrInfo %p) at +%d %d EA=", + VG_(printf)("Dw (InstrInfo %p) at +%u %d EA=", ev->inode, ev->inode->instr_offset, ev->Ev.Dw.szB); ppIRExpr(ev->Ev.Dw.ea); VG_(printf)("\n"); break; case Ev_Dm: - VG_(printf)("Dm (InstrInfo %p) at +%d %d EA=", + VG_(printf)("Dm (InstrInfo %p) at +%u %d EA=", ev->inode, ev->inode->instr_offset, ev->Ev.Dm.szB); ppIRExpr(ev->Ev.Dm.ea); VG_(printf)("\n"); @@ -1353,7 +1353,7 @@ IRSB* CLG_(instrument)( VgCallbackClosure* closure, if (cJumps>0) { CLG_DEBUG(3, " [ "); for (i=0;ijmp[i].instr); + CLG_DEBUG(3, "%u ", clgs.bb->jmp[i].instr); CLG_DEBUG(3, "], last inverted: %s \n", clgs.bb->cjmp_inverted ? "yes":"no"); } @@ -1823,7 +1823,7 @@ void clg_print_stats(void) CLG_(stat).distinct_contexts); VG_(message)(Vg_DebugMsg, "Distinct BBs: %d\n", CLG_(stat).distinct_bbs); - VG_(message)(Vg_DebugMsg, "Cost entries: %d (Chunks %d)\n", + VG_(message)(Vg_DebugMsg, "Cost entries: %u (Chunks %u)\n", CLG_(costarray_entries), CLG_(costarray_chunks)); VG_(message)(Vg_DebugMsg, "Distinct BBCCs: %d\n", CLG_(stat).distinct_bbccs); diff --git a/callgrind/sim.c b/callgrind/sim.c index 7478a32edf..99d58259ab 100644 --- a/callgrind/sim.c +++ b/callgrind/sim.c @@ -305,7 +305,7 @@ CacheResult cachesim_ref(cache_t2* c, Addr a, UChar size) return ((res1 == Miss) || (res2 == Miss)) ? Miss : Hit; } else { - VG_(printf)("addr: %lx size: %u blocks: %ld %ld", + VG_(printf)("addr: %lx size: %u blocks: %lu %lu", a, size, block1, block2); VG_(tool_panic)("item straddles more than two cache sets"); } @@ -413,7 +413,7 @@ CacheResult cachesim_ref_wb(cache_t2* c, RefType ref, Addr a, UChar size) return ((res1 == Miss) || (res2 == Miss)) ? Miss : Hit; } else { - VG_(printf)("addr: %lx size: %u sets: %d %d", a, size, set1, set2); + VG_(printf)("addr: %lx size: %u sets: %u %u", a, size, set1, set2); VG_(tool_panic)("item straddles more than two cache sets"); } return Hit; @@ -666,7 +666,7 @@ void cacheuse_initcache(cache_t2* c) CLG_DEBUG(6, "Config %s:\n", c->desc_line); for(i=0;iline_size;i++) { CLG_DEBUG(6, " [%2d]: start mask %8x, end mask %8x\n", - i, c->line_start_mask[i], c->line_end_mask[i]); + i, (UInt)c->line_start_mask[i], (UInt)c->line_end_mask[i]); } /* We use lower tag bits as offset pointers to cache use info. @@ -694,7 +694,7 @@ static CacheModelResult cacheuse##_##L##_doRead(Addr a, UChar size) \ UWord *set, tmp_tag; \ UInt use_mask; \ \ - CLG_DEBUG(6,"%s.Acc(Addr %#lx, size %d): Sets [%d/%d]\n", \ + CLG_DEBUG(6,"%s.Acc(Addr %#lx, size %d): Sets [%u/%u]\n", \ L.name, a, size, set1, set2); \ \ /* First case: word entirely within line. */ \ @@ -711,7 +711,7 @@ static CacheModelResult cacheuse##_##L##_doRead(Addr a, UChar size) \ idx = (set1 * L.assoc) + (set[0] & ~L.tag_mask); \ L.use[idx].count ++; \ L.use[idx].mask |= use_mask; \ - CLG_DEBUG(6," Hit0 [idx %d] (line %#lx from %#lx): %x => %08x, count %d\n",\ + CLG_DEBUG(6," Hit0 [idx %d] (line %#lx from %#lx): %x => %08x, count %u\n",\ idx, L.loaded[idx].memline, L.loaded[idx].iaddr, \ use_mask, L.use[idx].mask, L.use[idx].count); \ return L1_Hit; \ @@ -728,7 +728,7 @@ static CacheModelResult cacheuse##_##L##_doRead(Addr a, UChar size) \ idx = (set1 * L.assoc) + (tmp_tag & ~L.tag_mask); \ L.use[idx].count ++; \ L.use[idx].mask |= use_mask; \ - CLG_DEBUG(6," Hit%d [idx %d] (line %#lx from %#lx): %x => %08x, count %d\n",\ + CLG_DEBUG(6," Hit%d [idx %d] (line %#lx from %#lx): %x => %08x, count %u\n",\ i, idx, L.loaded[idx].memline, L.loaded[idx].iaddr, \ use_mask, L.use[idx].mask, L.use[idx].count); \ return L1_Hit; \ @@ -755,7 +755,7 @@ static CacheModelResult cacheuse##_##L##_doRead(Addr a, UChar size) \ idx = (set1 * L.assoc) + (set[0] & ~L.tag_mask); \ L.use[idx].count ++; \ L.use[idx].mask |= use_mask; \ - CLG_DEBUG(6," Hit0 [idx %d] (line %#lx from %#lx): %x => %08x, count %d\n",\ + CLG_DEBUG(6," Hit0 [idx %d] (line %#lx from %#lx): %x => %08x, count %u\n",\ idx, L.loaded[idx].memline, L.loaded[idx].iaddr, \ use_mask, L.use[idx].mask, L.use[idx].count); \ goto block2; \ @@ -770,7 +770,7 @@ static CacheModelResult cacheuse##_##L##_doRead(Addr a, UChar size) \ idx = (set1 * L.assoc) + (tmp_tag & ~L.tag_mask); \ L.use[idx].count ++; \ L.use[idx].mask |= use_mask; \ - CLG_DEBUG(6," Hit%d [idx %d] (line %#lx from %#lx): %x => %08x, count %d\n",\ + CLG_DEBUG(6," Hit%d [idx %d] (line %#lx from %#lx): %x => %08x, count %u\n",\ i, idx, L.loaded[idx].memline, L.loaded[idx].iaddr, \ use_mask, L.use[idx].mask, L.use[idx].count); \ goto block2; \ @@ -792,7 +792,7 @@ block2: \ idx = (set2 * L.assoc) + (set[0] & ~L.tag_mask); \ L.use[idx].count ++; \ L.use[idx].mask |= use_mask; \ - CLG_DEBUG(6," Hit0 [idx %d] (line %#lx from %#lx): %x => %08x, count %d\n",\ + CLG_DEBUG(6," Hit0 [idx %d] (line %#lx from %#lx): %x => %08x, count %u\n",\ idx, L.loaded[idx].memline, L.loaded[idx].iaddr, \ use_mask, L.use[idx].mask, L.use[idx].count); \ return miss1; \ @@ -807,7 +807,7 @@ block2: \ idx = (set2 * L.assoc) + (tmp_tag & ~L.tag_mask); \ L.use[idx].count ++; \ L.use[idx].mask |= use_mask; \ - CLG_DEBUG(6," Hit%d [idx %d] (line %#lx from %#lx): %x => %08x, count %d\n",\ + CLG_DEBUG(6," Hit%d [idx %d] (line %#lx from %#lx): %x => %08x, count %u\n",\ i, idx, L.loaded[idx].memline, L.loaded[idx].iaddr, \ use_mask, L.use[idx].mask, L.use[idx].count); \ return miss1; \ @@ -824,7 +824,7 @@ block2: \ return (miss1==MemAccess || miss2==MemAccess) ? MemAccess:LL_Hit; \ \ } else { \ - VG_(printf)("addr: %#lx size: %u sets: %d %d", a, size, set1, set2); \ + VG_(printf)("addr: %#lx size: %u sets: %u %u", a, size, set1, set2); \ VG_(tool_panic)("item straddles more than two cache sets"); \ } \ return 0; \ @@ -858,7 +858,7 @@ static void update_LL_use(int idx, Addr memline) CLG_DEBUG(2, " LL.miss [%d]: at %#lx accessing memline %#lx\n", idx, CLG_(bb_base) + current_ii->instr_offset, memline); if (use->count>0) { - CLG_DEBUG(2, " old: used %d, loss bits %d (%08x) [line %#lx from %#lx]\n", + CLG_DEBUG(2, " old: used %u, loss bits %d (%08x) [line %#lx from %#lx]\n", use->count, i, use->mask, loaded->memline, loaded->iaddr); CLG_DEBUG(2, " collect: %d, use_base %p\n", CLG_(current_state).collect, loaded->use_base); @@ -889,13 +889,13 @@ CacheModelResult cacheuse_LL_access(Addr memline, line_loaded* l1_loaded) int i, j, idx; UWord tmp_tag; - CLG_DEBUG(6,"LL.Acc(Memline %#lx): Set %d\n", memline, setNo); + CLG_DEBUG(6,"LL.Acc(Memline %#lx): Set %u\n", memline, setNo); if (tag == (set[0] & LL.tag_mask)) { idx = (setNo * LL.assoc) + (set[0] & ~LL.tag_mask); l1_loaded->dep_use = &(LL.use[idx]); - CLG_DEBUG(6," Hit0 [idx %d] (line %#lx from %#lx): => %08x, count %d\n", + CLG_DEBUG(6," Hit0 [idx %d] (line %#lx from %#lx): => %08x, count %u\n", idx, LL.loaded[idx].memline, LL.loaded[idx].iaddr, LL.use[idx].mask, LL.use[idx].count); return LL_Hit; @@ -910,7 +910,7 @@ CacheModelResult cacheuse_LL_access(Addr memline, line_loaded* l1_loaded) idx = (setNo * LL.assoc) + (tmp_tag & ~LL.tag_mask); l1_loaded->dep_use = &(LL.use[idx]); - CLG_DEBUG(6," Hit%d [idx %d] (line %#lx from %#lx): => %08x, count %d\n", + CLG_DEBUG(6," Hit%d [idx %d] (line %#lx from %#lx): => %08x, count %u\n", i, idx, LL.loaded[idx].memline, LL.loaded[idx].iaddr, LL.use[idx].mask, LL.use[idx].count); return LL_Hit; @@ -946,7 +946,7 @@ static CacheModelResult update##_##L##_use(cache_t2* cache, int idx, \ CLG_DEBUG(2, " %s.miss [%d]: at %#lx accessing memline %#lx (mask %08x)\n", \ cache->name, idx, CLG_(bb_base) + current_ii->instr_offset, memline, mask); \ if (use->count>0) { \ - CLG_DEBUG(2, " old: used %d, loss bits %d (%08x) [line %#lx from %#lx]\n",\ + CLG_DEBUG(2, " old: used %u, loss bits %d (%08x) [line %#lx from %#lx]\n",\ use->count, c, use->mask, loaded->memline, loaded->iaddr); \ CLG_DEBUG(2, " collect: %d, use_base %p\n", \ CLG_(current_state).collect, loaded->use_base); \ @@ -1165,7 +1165,7 @@ static void log_1I1Dr(InstrInfo* ii, Addr data_addr, Word data_size) IrRes = (*simulator.I1_Read)(CLG_(bb_base) + ii->instr_offset, ii->instr_size); DrRes = (*simulator.D1_Read)(data_addr, data_size); - CLG_DEBUG(6, "log_1I1Dr: Ir %#lx/%u => %s, Dr %#lx/%lu => %s\n", + CLG_DEBUG(6, "log_1I1Dr: Ir %#lx/%u => %s, Dr %#lx/%ld => %s\n", CLG_(bb_base) + ii->instr_offset, ii->instr_size, cacheRes(IrRes), data_addr, data_size, cacheRes(DrRes)); @@ -1200,7 +1200,7 @@ static void log_0I1Dr(InstrInfo* ii, Addr data_addr, Word data_size) current_ii = ii; DrRes = (*simulator.D1_Read)(data_addr, data_size); - CLG_DEBUG(6, "log_0I1Dr: Dr %#lx/%lu => %s\n", + CLG_DEBUG(6, "log_0I1Dr: Dr %#lx/%ld => %s\n", data_addr, data_size, cacheRes(DrRes)); if (CLG_(current_state).collect) { @@ -1228,7 +1228,7 @@ static void log_1I1Dw(InstrInfo* ii, Addr data_addr, Word data_size) IrRes = (*simulator.I1_Read)(CLG_(bb_base) + ii->instr_offset, ii->instr_size); DwRes = (*simulator.D1_Write)(data_addr, data_size); - CLG_DEBUG(6, "log_1I1Dw: Ir %#lx/%u => %s, Dw %#lx/%lu => %s\n", + CLG_DEBUG(6, "log_1I1Dw: Ir %#lx/%u => %s, Dw %#lx/%ld => %s\n", CLG_(bb_base) + ii->instr_offset, ii->instr_size, cacheRes(IrRes), data_addr, data_size, cacheRes(DwRes)); @@ -1260,7 +1260,7 @@ static void log_0I1Dw(InstrInfo* ii, Addr data_addr, Word data_size) current_ii = ii; DwRes = (*simulator.D1_Write)(data_addr, data_size); - CLG_DEBUG(6, "log_0I1Dw: Dw %#lx/%lu => %s\n", + CLG_DEBUG(6, "log_0I1Dw: Dw %#lx/%ld => %s\n", data_addr, data_size, cacheRes(DwRes)); if (CLG_(current_state).collect) { diff --git a/callgrind/threads.c b/callgrind/threads.c index 7dca771f0d..55895a8665 100644 --- a/callgrind/threads.c +++ b/callgrind/threads.c @@ -131,7 +131,7 @@ void CLG_(switch_thread)(ThreadId tid) { if (tid == CLG_(current_tid)) return; - CLG_DEBUG(0, ">> thread %d (was %d)\n", tid, CLG_(current_tid)); + CLG_DEBUG(0, ">> thread %u (was %u)\n", tid, CLG_(current_tid)); if (CLG_(current_tid) != VG_INVALID_THREADID) { /* save thread state */ @@ -200,7 +200,7 @@ void CLG_(pre_signal)(ThreadId tid, Int sigNum, Bool alt_stack) { exec_state *es; - CLG_DEBUG(0, ">> pre_signal(TID %d, sig %d, alt_st %s)\n", + CLG_DEBUG(0, ">> pre_signal(TID %u, sig %d, alt_st %s)\n", tid, sigNum, alt_stack ? "yes":"no"); /* switch to the thread the handler runs in */ @@ -241,7 +241,7 @@ void CLG_(post_signal)(ThreadId tid, Int sigNum) exec_state* es; UInt fn_number, *pactive; - CLG_DEBUG(0, ">> post_signal(TID %d, sig %d)\n", + CLG_DEBUG(0, ">> post_signal(TID %u, sig %d)\n", tid, sigNum); /* thread switching potentially needed, eg. with instrumentation off */ @@ -261,7 +261,7 @@ void CLG_(post_signal)(ThreadId tid, Int sigNum) fn_number = CLG_(current_state).cxt->fn[0]->number; pactive = CLG_(get_fn_entry)(fn_number); (*pactive)--; - CLG_DEBUG(0, " set active count of %s back to %d\n", + CLG_DEBUG(0, " set active count of %s back to %u\n", CLG_(current_state).cxt->fn[0]->name, *pactive); }