Fix various format string errors, courtesy of Florian Krohm.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6902 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/cachegrind/cg_sim.c b/cachegrind/cg_sim.c
index 80cdbfb..12fb61b 100644
--- a/cachegrind/cg_sim.c
+++ b/cachegrind/cg_sim.c
@@ -184,7 +184,7 @@
       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 89ebdfd..e31ccc7 100644
--- a/callgrind/bbcc.c
+++ b/callgrind/bbcc.c
@@ -714,7 +714,7 @@
       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 ff700ee..aaeedbe 100644
--- a/callgrind/debug.c
+++ b/callgrind/debug.c
@@ -295,7 +295,7 @@
 	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 @@
   ecounter = bbcc->ecounter_sum;
 
   print_indent(s+2);
-  VG_(printf)("ECounter: sum %d ", ecounter);
+  VG_(printf)("ECounter: sum %llu ", ecounter);
   for(i=0; i<bb->cjmp_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 @@
   for(i=0; i<bb->instr_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 @@
     int ln, i=0, opos=0;
 	
     if (addr == 0) {
-	VG_(printf)("%08x", addr);
+	VG_(printf)("%08lx", addr);
 	return;
     }
 
@@ -431,7 +431,7 @@
 
 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 dd445e2..2a0442a 100644
--- a/callgrind/dump.c
+++ b/callgrind/dump.c
@@ -554,7 +554,7 @@
 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 52cc4b0..7f2abdf 100644
--- a/callgrind/main.c
+++ b/callgrind/main.c
@@ -817,7 +817,7 @@
    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 f15fc7d..e785e11 100644
--- a/callgrind/sim.c
+++ b/callgrind/sim.c
@@ -309,7 +309,7 @@
 	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 @@
 	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 ddafdfb..a2b8a4c 100644
--- a/coregrind/m_libcassert.c
+++ b/coregrind/m_libcassert.c
@@ -189,7 +189,7 @@
    // 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 252d007..a5129ef 100644
--- a/coregrind/m_libcprint.c
+++ b/coregrind/m_libcprint.c
@@ -216,7 +216,7 @@
    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 "%<n_buf>s" where <d> is 1,2,3...
       VG_(sprintf)(buf, fmt, "--%");
       return;
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index 6e69e88..18aa7de 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -958,7 +958,7 @@
    }
 
    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 @@
    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 6f64d7e..131d179 100644
--- a/coregrind/m_mallocfree.c
+++ b/coregrind/m_mallocfree.c
@@ -846,12 +846,12 @@
       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 @@
          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 @@
          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 @@
    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 cc69fd3..1978adc 100644
--- a/coregrind/m_scheduler/scheduler.c
+++ b/coregrind/m_scheduler/scheduler.c
@@ -1337,7 +1337,7 @@
       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 @@
 	    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 6af368f..a98f243 100644
--- a/coregrind/m_signals.c
+++ b/coregrind/m_signals.c
@@ -2077,7 +2077,7 @@
       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 eec5e8f..f3fadea 100644
--- a/coregrind/m_translate.c
+++ b/coregrind/m_translate.c
@@ -590,7 +590,7 @@
    /*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 92d4012..0b20526 100644
--- a/coregrind/m_ume.c
+++ b/coregrind/m_ume.c
@@ -74,7 +74,7 @@
 {
    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 1e97453..1b5a2ab 100644
--- a/helgrind/hg_main.c
+++ b/helgrind/hg_main.c
@@ -553,7 +553,7 @@
    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 @@
    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 @@
 
    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 @@
 
    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 028a1aa..8f9cf95 100644
--- a/lackey/lk_main.c
+++ b/lackey/lk_main.c
@@ -444,22 +444,22 @@
 
 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 3941a24..781368f 100644
--- a/massif/ms_main.c
+++ b/massif/ms_main.c
@@ -1325,7 +1325,7 @@
             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 79b767f..fc94fb7 100644
--- a/memcheck/mc_leakcheck.c
+++ b/memcheck/mc_leakcheck.c
@@ -273,11 +273,11 @@
 	 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 0c09b18..06546d2 100644
--- a/memcheck/mc_main.c
+++ b/memcheck/mc_main.c
@@ -2196,7 +2196,7 @@
 {
    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 */