From: Nicholas Nethercote Date: Sun, 23 Sep 2007 00:51:24 +0000 (+0000) Subject: Fix various format string errors, courtesy of Florian Krohm. X-Git-Tag: svn/VALGRIND_3_3_0~201 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7cb817e07838a33fa4bab2c2aebae0d34e13254e;p=thirdparty%2Fvalgrind.git Fix various format string errors, courtesy of Florian Krohm. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6902 --- diff --git a/cachegrind/cg_sim.c b/cachegrind/cg_sim.c index 80cdbfb6bf..12fb61bab1 100644 --- a/cachegrind/cg_sim.c +++ b/cachegrind/cg_sim.c @@ -184,7 +184,7 @@ miss_treatment: \ if (is_miss) { MISS_TREATMENT; } \ \ } else { \ - VG_(printf)("addr: %x size: %u sets: %d %d", a, size, set1, set2); \ + VG_(printf)("addr: %lx size: %u sets: %d %d", a, size, set1, set2);\ VG_(tool_panic)("item straddles more than two cache sets"); \ } \ return; \ diff --git a/callgrind/bbcc.c b/callgrind/bbcc.c index 89ebdfda80..e31ccc798c 100644 --- a/callgrind/bbcc.c +++ b/callgrind/bbcc.c @@ -714,7 +714,7 @@ void CLG_(setup_bbcc)(BB* bb) else ppIRJumpKind( jmpkind ); - VG_(printf)(" %08x -> %08x, SP %08x\n", + VG_(printf)(" %08lx -> %08x, SP %08x\n", last_bb ? bb_jmpaddr(last_bb) : 0, bb_addr(bb), sp); } diff --git a/callgrind/debug.c b/callgrind/debug.c index ff700ee87d..aaeedbe693 100644 --- a/callgrind/debug.c +++ b/callgrind/debug.c @@ -295,7 +295,7 @@ void CLG_(print_bbcc_fn)(BBCC* bbcc) return; } - VG_(printf)("%08x/%c %d:", bb_addr(bbcc->bb), + VG_(printf)("%08lx/%c %d:", 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' : @@ -339,9 +339,9 @@ void CLG_(print_bbcc_cost)(int s, BBCC* bbcc) ecounter = bbcc->ecounter_sum; print_indent(s+2); - VG_(printf)("ECounter: sum %d ", ecounter); + VG_(printf)("ECounter: sum %llu ", ecounter); for(i=0; icjmp_count; i++) { - VG_(printf)("[%d]=%d ", + VG_(printf)("[%d]=%llu ", bb->jmp[i].instr, bbcc->jmp[i].ecounter); } VG_(printf)("\n"); @@ -350,7 +350,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 %3d ", + VG_(printf)("[%2d] IOff %2d ecnt %3llu ", i, ii->instr_offset, ecounter); CLG_(print_cost)(s+5, ii->eventset, bbcc->cost + ii->cost_offset); @@ -374,7 +374,7 @@ void CLG_(print_addr)(Addr addr) int ln, i=0, opos=0; if (addr == 0) { - VG_(printf)("%08x", addr); + VG_(printf)("%08lx", addr); return; } @@ -431,7 +431,7 @@ void CLG_(print_context)(void) void* CLG_(malloc)(UWord s, char* f) { - CLG_DEBUG(3, "Malloc(%d) in %s.\n", s, f); + CLG_DEBUG(3, "Malloc(%lu) in %s.\n", s, f); return VG_(malloc)(s); } diff --git a/callgrind/dump.c b/callgrind/dump.c index dd445e2742..2a0442a0ea 100644 --- a/callgrind/dump.c +++ b/callgrind/dump.c @@ -554,7 +554,7 @@ static void fprint_pos(Int fd, AddrPos* curr, AddrPos* last) { if (0) //CLG_(clo).dump_bbs) - VG_(sprintf)(outbuf, "%u ", curr->addr - curr->bb_addr); + VG_(sprintf)(outbuf, "%lu ", curr->addr - curr->bb_addr); else { int p = 0; if (CLG_(clo).dump_instr) { diff --git a/callgrind/main.c b/callgrind/main.c index 52cc4b0638..7f2abdf4f3 100644 --- a/callgrind/main.c +++ b/callgrind/main.c @@ -817,7 +817,7 @@ Bool CLG_(handle_client_request)(ThreadId tid, UWord *args, UWord *ret) case VG_USERREQ__DUMP_STATS_AT: { Char buf[512]; - VG_(sprintf)(buf,"Client Request: %s", args[1]); + VG_(sprintf)(buf,"Client Request: %s", (Char*)args[1]); CLG_(dump_profile)(buf, True); *ret = 0; /* meaningless */ } diff --git a/callgrind/sim.c b/callgrind/sim.c index f15fc7d0c5..e785e1154e 100644 --- a/callgrind/sim.c +++ b/callgrind/sim.c @@ -309,7 +309,7 @@ static CacheResult cachesim_ref(cache_t2* c, Addr a, UChar size) return ((res1 == Miss) || (res2 == Miss)) ? Miss : Hit; } else { - VG_(printf)("addr: %x size: %u sets: %d %d", a, size, set1, set2); + VG_(printf)("addr: %lx size: %u sets: %d %d", a, size, set1, set2); VG_(tool_panic)("item straddles more than two cache sets"); } return Hit; @@ -416,7 +416,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: %x size: %u sets: %d %d", a, size, set1, set2); + VG_(printf)("addr: %lx size: %u sets: %d %d", a, size, set1, set2); VG_(tool_panic)("item straddles more than two cache sets"); } return Hit; diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c index ddafdfbf90..a2b8a4c05b 100644 --- a/coregrind/m_libcassert.c +++ b/coregrind/m_libcassert.c @@ -189,7 +189,7 @@ void VG_(assert_fail) ( Bool isCore, const Char* expr, const Char* file, // Treat vg_assert2(0, "foo") specially, as a panicky abort if (VG_STREQ(expr, "0")) { VG_(printf)("\n%s: %s:%d (%s): the 'impossible' happened.\n", - component, file, line, fn, expr ); + component, file, line, fn ); } else { VG_(printf)("\n%s: %s:%d (%s): Assertion '%s' failed.\n", component, file, line, fn, expr ); diff --git a/coregrind/m_libcprint.c b/coregrind/m_libcprint.c index 252d007a00..a5129ef66a 100644 --- a/coregrind/m_libcprint.c +++ b/coregrind/m_libcprint.c @@ -216,7 +216,7 @@ void VG_(percentify)(ULong n, ULong m, UInt d, Int n_buf, char buf[]) if (m == 0) { // Have to generate the format string in order to be flexible about // the width of the field. - VG_(sprintf)(fmt, "%%-%lds", n_buf); + VG_(sprintf)(fmt, "%%-%ds", n_buf); // fmt is now "%s" where is 1,2,3... VG_(sprintf)(buf, fmt, "--%"); return; diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 6e69e88cf8..18aa7de564 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -958,7 +958,7 @@ static void setup_file_descriptors(void) } if (show) - VG_(printf)("fd limits: host, before: cur %u max %u\n", + VG_(printf)("fd limits: host, before: cur %lu max %lu\n", rl.rlim_cur, rl.rlim_max); # if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) @@ -986,7 +986,7 @@ static void setup_file_descriptors(void) VG_(setrlimit)(VKI_RLIMIT_NOFILE, &rl); if (show) { - VG_(printf)("fd limits: host, after: cur %u max %u\n", + VG_(printf)("fd limits: host, after: cur %lu max %lu\n", rl.rlim_cur, rl.rlim_max); VG_(printf)("fd limits: guest : cur %u max %u\n", VG_(fd_soft_limit), VG_(fd_hard_limit)); diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c index 6f64d7ea96..131d179d09 100644 --- a/coregrind/m_mallocfree.c +++ b/coregrind/m_mallocfree.c @@ -846,12 +846,12 @@ void ppSuperblocks ( Arena* a ) Superblock * sb = a->sblocks[j]; VG_(printf)( "\n" ); - VG_(printf)( "superblock %d at %p, sb->n_pl_bs = %d\n", + VG_(printf)( "superblock %d at %p, sb->n_pl_bs = %lu\n", blockno++, sb, sb->n_payload_bytes); for (i = 0; i < sb->n_payload_bytes; i += b_bszB) { Block* b = (Block*)&sb->payload_bytes[i]; b_bszB = get_bszB(b); - VG_(printf)( " block at %d, bszB %d: ", i, b_bszB ); + VG_(printf)( " block at %d, bszB %lu: ", i, b_bszB ); VG_(printf)( "%s, ", is_inuse_block(b) ? "inuse" : "free"); VG_(printf)( "%s\n", blockSane(a, b) ? "ok" : "BAD" ); } @@ -901,15 +901,14 @@ static void sanity_check_malloc_arena ( ArenaId aid ) b = (Block*)&sb->payload_bytes[i]; b_bszB = get_bszB_as_is(b); if (!blockSane(a, b)) { - VG_(printf)("sanity_check_malloc_arena: sb %p, block %d (bszB %d): " - " BAD\n", sb, i, b_bszB ); + VG_(printf)("sanity_check_malloc_arena: sb %p, block %d " + "(bszB %lu): BAD\n", sb, i, b_bszB ); BOMB; } thisFree = !is_inuse_block(b); if (thisFree && lastWasFree) { - VG_(printf)("sanity_check_malloc_arena: sb %p, block %d (bszB %d): " - "UNMERGED FREES\n", - sb, i, b_bszB ); + VG_(printf)("sanity_check_malloc_arena: sb %p, block %d " + "(bszB %lu): UNMERGED FREES\n", sb, i, b_bszB ); BOMB; } if (thisFree) blockctr_sb_free++; @@ -956,7 +955,7 @@ static void sanity_check_malloc_arena ( ArenaId aid ) if (b_pszB < list_min_pszB || b_pszB > list_max_pszB) { VG_(printf)( "sanity_check_malloc_arena: list %d at %p: " - "WRONG CHAIN SIZE %dB (%dB, %dB)\n", + "WRONG CHAIN SIZE %luB (%luB, %luB)\n", listno, b, b_pszB, list_min_pszB, list_max_pszB ); BOMB; } @@ -1359,7 +1358,7 @@ void* VG_(arena_memalign) ( ArenaId aid, SizeT req_alignB, SizeT req_pszB ) if (req_alignB < VG_MIN_MALLOC_SZB || req_alignB > 1048576 || VG_(log2)( req_alignB ) == -1 /* not a power of 2 */) { - VG_(printf)("VG_(arena_memalign)(%p, %d, %d)\nbad alignment", + VG_(printf)("VG_(arena_memalign)(%p, %lu, %lu)\nbad alignment", a, req_alignB, req_pszB ); VG_(core_panic)("VG_(arena_memalign)"); /*NOTREACHED*/ diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index cc69fd398c..1978adc827 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -1337,7 +1337,7 @@ void do_client_request ( ThreadId tid ) case VG_USERREQ__DISCARD_TRANSLATIONS: if (VG_(clo_verbosity) > 2) VG_(printf)( "client request: DISCARD_TRANSLATIONS," - " addr %p, len %d\n", + " addr %p, len %lu\n", (void*)arg[1], arg[2] ); VG_(discard_translations)( @@ -1358,7 +1358,7 @@ void do_client_request ( ThreadId tid ) UWord ret; if (VG_(clo_verbosity) > 2) - VG_(printf)("client request: code %x, addr %p, len %d\n", + VG_(printf)("client request: code %lx, addr %p, len %lu\n", arg[0], (void*)arg[1], arg[2] ); if ( VG_TDICT_CALL(tool_handle_client_request, tid, arg, &ret) ) diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c index 6af368f256..a98f243956 100644 --- a/coregrind/m_signals.c +++ b/coregrind/m_signals.c @@ -2077,7 +2077,7 @@ void VG_(sigstartup_actions) ( void ) VG_(max_signal) = i; if (VG_(clo_trace_signals) && VG_(clo_verbosity) > 2) - VG_(printf)("snaffling handler 0x%x for signal %d\n", + VG_(printf)("snaffling handler 0x%lx for signal %d\n", (Addr)(sa.ksa_handler), i ); scss.scss_per_sig[i].scss_handler = sa.ksa_handler; diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c index eec5e8f749..f3fadea762 100644 --- a/coregrind/m_translate.c +++ b/coregrind/m_translate.c @@ -590,7 +590,7 @@ static Bool chase_into_ok ( void* closureV, Addr64 addr64 ) /*NOTREACHED*/ dontchase: - if (0) VG_(printf)("not chasing into 0x%x\n", addr); + if (0) VG_(printf)("not chasing into 0x%lx\n", addr); return False; } diff --git a/coregrind/m_ume.c b/coregrind/m_ume.c index 92d4012425..0b205265a9 100644 --- a/coregrind/m_ume.c +++ b/coregrind/m_ume.c @@ -74,7 +74,7 @@ static void check_mmap(SysRes res, Addr base, SizeT len) { if (res.isError) { VG_(printf)("valgrind: mmap(0x%llx, %lld) failed in UME " - "with error %d (%s).\n", + "with error %lu (%s).\n", (ULong)base, (Long)len, res.err, VG_(strerror)(res.err) ); if (res.err == VKI_EINVAL) { diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index 1e97453393..1b5a2ab220 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -553,7 +553,7 @@ void set_sword ( Addr a, shadow_word sword ) sm->swords[(a & 0xFFFC) >> 2] = sword; if (VGE_IS_DISTINGUISHED_SM(sm)) { - VG_(printf)("wrote to distinguished 2ndary map! 0x%x\n", a); + VG_(printf)("wrote to distinguished 2ndary map! 0x%lx\n", a); // XXX: may be legit, but I want to know when it happens --njn VG_(tool_panic)("wrote to distinguished 2ndary map!"); } @@ -568,7 +568,7 @@ shadow_word* get_sword_addr ( Addr a ) UInt sm_off = (a & 0xFFFC) >> 2; if (VGE_IS_DISTINGUISHED_SM(sm)) { - VG_(printf)("accessed distinguished 2ndary map! 0x%x\n", a); + VG_(printf)("accessed distinguished 2ndary map! 0x%lx\n", a); // XXX: may be legit, but I want to know when it happens --njn //VG_(tool_panic)("accessed distinguished 2ndary map!"); return SEC_MAP_ACCESS; @@ -3000,7 +3000,7 @@ static void hg_mem_read_word(Addr a, ThreadId tid) sword = get_sword_addr(a); if (sword == SEC_MAP_ACCESS) { - VG_(printf)("read distinguished 2ndary map! 0x%x\n", a); + VG_(printf)("read distinguished 2ndary map! 0x%lx\n", a); return; } @@ -3110,7 +3110,7 @@ static void hg_mem_write_word(Addr a, ThreadId tid) sword = get_sword_addr(a); if (sword == SEC_MAP_ACCESS) { - VG_(printf)("read distinguished 2ndary map! 0x%x\n", a); + VG_(printf)("read distinguished 2ndary map! 0x%lx\n", a); return; } diff --git a/lackey/lk_main.c b/lackey/lk_main.c index 028a1aaa2d..8f9cf95e99 100644 --- a/lackey/lk_main.c +++ b/lackey/lk_main.c @@ -444,22 +444,22 @@ static Int events_used = 0; static VG_REGPARM(2) void trace_instr(Addr addr, SizeT size) { - VG_(printf)("I %08lx,%d\n", addr, size); + VG_(printf)("I %08lx,%lu\n", addr, size); } static VG_REGPARM(2) void trace_load(Addr addr, SizeT size) { - VG_(printf)(" L %08lx,%d\n", addr, size); + VG_(printf)(" L %08lx,%lu\n", addr, size); } static VG_REGPARM(2) void trace_store(Addr addr, SizeT size) { - VG_(printf)(" S %08lx,%d\n", addr, size); + VG_(printf)(" S %08lx,%lu\n", addr, size); } static VG_REGPARM(2) void trace_modify(Addr addr, SizeT size) { - VG_(printf)(" M %08lx,%d\n", addr, size); + VG_(printf)(" M %08lx,%lu\n", addr, size); } diff --git a/massif/ms_main.c b/massif/ms_main.c index 3941a2418f..781368f8e3 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -1325,7 +1325,7 @@ static void write_hp_file(void) if ( ! VG_(get_fnname)(xtree_snapshot->xpt->ip, buf2, 16)) { VG_(sprintf)(buf2, "???"); } - SPRINTF(buf, "x%x:%s %d\n", xtree_snapshot->xpt->ip, + SPRINTF(buf, "x%lx:%s %d\n", xtree_snapshot->xpt->ip, clean_fnname(buf3, buf2), xtree_snapshot->space); } diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c index 79b767f45c..fc94fb7a09 100644 --- a/memcheck/mc_leakcheck.c +++ b/memcheck/mc_leakcheck.c @@ -273,11 +273,11 @@ static void lc_markstack_push_WRK(Addr ptr, Int clique) if (sh_no != clique) { if (VG_DEBUG_CLIQUE) { if (lc_markstack[sh_no].indirect) - VG_(printf)(" clique %d joining clique %d adding %d+%d bytes\n", + VG_(printf)(" clique %d joining clique %d adding %lu+%lu bytes\n", sh_no, clique, lc_shadows[sh_no]->szB, lc_markstack[sh_no].indirect); else - VG_(printf)(" %d joining %d adding %d\n", + VG_(printf)(" %d joining %d adding %lu\n", sh_no, clique, lc_shadows[sh_no]->szB); } diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c index 0c09b18c94..06546d25b2 100644 --- a/memcheck/mc_main.c +++ b/memcheck/mc_main.c @@ -2196,7 +2196,7 @@ void MC_(helperc_MAKE_STACK_UNINIT) ( Addr base, UWord len ) { tl_assert(sizeof(UWord) == sizeof(SizeT)); if (0) - VG_(printf)("helperc_MAKE_STACK_UNINIT %p %d\n", base, len ); + VG_(printf)("helperc_MAKE_STACK_UNINIT %p %lu\n", base, len ); # if 0 /* Really slow version */