Merged FORMATCHECK branch (r8368) to trunk.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8369 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c
index bd68325..ac4771b 100644
--- a/cachegrind/cg_main.c
+++ b/cachegrind/cg_main.c
@@ -1609,11 +1609,11 @@
       VG_(message)(Vg_DebugMsg, "cachegrind: with zero      info:%s (%d)", 
                    buf4, no_debugs);
 
-      VG_(message)(Vg_DebugMsg, "cachegrind: string table size: %u",
+      VG_(message)(Vg_DebugMsg, "cachegrind: string table size: %lu",
                    VG_(OSetGen_Size)(stringTable));
-      VG_(message)(Vg_DebugMsg, "cachegrind: CC table size: %u",
+      VG_(message)(Vg_DebugMsg, "cachegrind: CC table size: %lu",
                    VG_(OSetGen_Size)(CC_table));
-      VG_(message)(Vg_DebugMsg, "cachegrind: InstrInfo table size: %u",
+      VG_(message)(Vg_DebugMsg, "cachegrind: InstrInfo table size: %lu",
                    VG_(OSetGen_Size)(instrInfoTable));
    }
 }
diff --git a/callgrind/bb.c b/callgrind/bb.c
index 74ffee7..0ccc63f 100644
--- a/callgrind/bb.c
+++ b/callgrind/bb.c
@@ -187,7 +187,7 @@
       bb = bb->next;
     }
 
-    CLG_DEBUG(5, "  lookup_bb (Obj %s, off %p): %p\n",
+    CLG_DEBUG(5, "  lookup_bb (Obj %s, off %#lx): %p\n",
 	     obj->name, offset, bb);
     return bb;
 }
@@ -209,7 +209,7 @@
   if (obj->offset != offset) {
       Addr start = di ? VG_(seginfo_get_text_avma)(di) : 0;
 
-      CLG_DEBUG(0, "Mapping changed for '%s': %p -> %p\n",
+      CLG_DEBUG(0, "Mapping changed for '%s': %#lx -> %#lx\n",
 		obj->name, obj->start, start);
 
       /* Size should be the same, and offset diff == start diff */
@@ -244,7 +244,7 @@
   UInt n_instrs, n_jmps;
   Bool cjmp_inverted = False;
 
-  CLG_DEBUG(5, "+ get_bb(BB %p)\n", addr);
+  CLG_DEBUG(5, "+ get_bb(BB %#lx)\n", addr);
 
   obj = obj_of_address(addr);
   bb = lookup_bb(obj, addr - obj->offset);
@@ -257,13 +257,13 @@
   if (*seen_before) {
     if (bb->instr_count != n_instrs) {
       VG_(message)(Vg_DebugMsg, 
-		   "ERROR: BB Retranslation Mismatch at BB %p", addr);
+		   "ERROR: BB Retranslation Mismatch at BB %#lx", addr);
       VG_(message)(Vg_DebugMsg,
-		   "  new: Obj %s, Off %p, BBOff %p, Instrs %u",
+		   "  new: Obj %s, Off %#lx, BBOff %#lx, Instrs %u",
 		   obj->name, obj->offset,
 		   addr - obj->offset, n_instrs);
       VG_(message)(Vg_DebugMsg,
-		   "  old: Obj %s, Off %p, BBOff %p, Instrs %u",
+		   "  old: Obj %s, Off %#lx, BBOff %#lx, Instrs %u",
 		   bb->obj->name, bb->obj->offset,
 		   bb->offset, bb->instr_count);
       CLG_ASSERT(bb->instr_count == n_instrs );
@@ -271,13 +271,13 @@
     CLG_ASSERT(bb->cjmp_count == n_jmps );
     CLG_(stat).bb_retranslations++;
 
-    CLG_DEBUG(5, "- get_bb(BB %p): seen before.\n", addr);
+    CLG_DEBUG(5, "- get_bb(BB %#lx): seen before.\n", addr);
     return bb;
   }
 
   bb = new_bb(obj, addr - obj->offset, n_instrs, n_jmps, cjmp_inverted);
 
-  CLG_DEBUG(5, "- get_bb(BB %p)\n", addr);
+  CLG_DEBUG(5, "- get_bb(BB %#lx)\n", addr);
 
   return bb;
 }
@@ -305,7 +305,7 @@
     }
 
     if (bb == NULL) {
-	CLG_DEBUG(3, "  delete_bb (Obj %s, off %p): NOT FOUND\n",
+	CLG_DEBUG(3, "  delete_bb (Obj %s, off %#lx): NOT FOUND\n",
 		  obj->name, offset);
 
 	/* we didn't find it.
@@ -326,7 +326,7 @@
        bp->next = bb->next;
     }
 
-    CLG_DEBUG(3, "  delete_bb (Obj %s, off %p): %p, BBCC head: %p\n",
+    CLG_DEBUG(3, "  delete_bb (Obj %s, off %#lx): %p, BBCC head: %p\n",
 	      obj->name, offset, bb, bb->bbcc_list);
 
     if (bb->bbcc_list == 0) {
diff --git a/callgrind/bbcc.c b/callgrind/bbcc.c
index 4b91c7c..c564266 100644
--- a/callgrind/bbcc.c
+++ b/callgrind/bbcc.c
@@ -85,7 +85,7 @@
   jCC* jcc;
 
   CLG_ASSERT(bbcc->cxt != 0);
-  CLG_DEBUG(1, "  zero_bbcc: BB %p, Cxt %d "
+  CLG_DEBUG(1, "  zero_bbcc: BB %#lx, Cxt %d "
 	   "(fn '%s', rec %d)\n", 
 	   bb_addr(bbcc->bb),
 	   bbcc->cxt->base_number + bbcc->rec_index,
@@ -177,7 +177,7 @@
        bbcc = bbcc->next;
    }
    
-   CLG_DEBUG(2,"  lookup_bbcc(BB %p, Cxt %d, fn '%s'): %p (tid %d)\n",
+   CLG_DEBUG(2,"  lookup_bbcc(BB %#lx, Cxt %d, fn '%s'): %p (tid %d)\n",
 	    bb_addr(bb), cxt->base_number, cxt->fn[0]->name, 
 	    bbcc, bbcc ? bbcc->tid : 0);
 
@@ -294,7 +294,7 @@
    
    CLG_(stat).distinct_bbccs++;
 
-   CLG_DEBUG(3, "  new_bbcc(BB %p): %p (now %d)\n", 
+   CLG_DEBUG(3, "  new_bbcc(BB %#lx): %p (now %d)\n",
 	    bb_addr(bb), new, CLG_(stat).distinct_bbccs);
 
    return new;
@@ -319,7 +319,7 @@
     
     CLG_ASSERT(bbcc->cxt != 0);
 
-    CLG_DEBUG(3,"+ insert_bbcc_into_hash(BB %p, fn '%s')\n",
+    CLG_DEBUG(3,"+ insert_bbcc_into_hash(BB %#lx, fn '%s')\n",
 	     bb_addr(bbcc->bb), bbcc->cxt->fn[0]->name);
 
     /* check fill degree of hash and resize if needed (>90%) */
@@ -368,7 +368,7 @@
 {
     BBCC*      new;
 
-    CLG_DEBUG(3,"+ clone_bbcc(BB %p, rec %d, fn %s)\n",
+    CLG_DEBUG(3,"+ clone_bbcc(BB %#lx, rec %d, fn %s)\n",
 	     bb_addr(orig->bb), rec_index, cxt->fn[0]->name);
 
     new  = new_bbcc(orig->bb);
@@ -410,7 +410,7 @@
     CLG_DEBUGIF(3)
       CLG_(print_bbcc)(-2, new, False);
 
-    CLG_DEBUG(2,"- clone_BBCC(%p, %d) for BB %p\n"
+    CLG_DEBUG(2,"- clone_BBCC(%p, %d) for BB %#lx\n"
 		"   orig %s\n"
 		"   new  %s\n",
 	     orig, rec_index, bb_addr(orig->bb),
@@ -433,7 +433,7 @@
 {
    BBCC* bbcc;
 
-   CLG_DEBUG(3, "+ get_bbcc(BB %p)\n", bb_addr(bb));
+   CLG_DEBUG(3, "+ get_bbcc(BB %#lx)\n", bb_addr(bb));
 
    bbcc = bb->bbcc_list;
 
@@ -453,7 +453,7 @@
        CLG_(print_bbcc)(-2, bbcc, False);
    }
 
-   CLG_DEBUG(3, "- get_bbcc(BB %p): BBCC %p\n",
+   CLG_DEBUG(3, "- get_bbcc(BB %#lx): BBCC %p\n",
 		bb_addr(bb), bbcc);
 
    return bbcc;
@@ -558,7 +558,7 @@
   Bool ret_without_call = False;
   Int popcount_on_return = 1;
 
-  CLG_DEBUG(3,"+ setup_bbcc(BB %p)\n", bb_addr(bb));
+  CLG_DEBUG(3,"+ setup_bbcc(BB %#lx)\n", bb_addr(bb));
 
   /* This is needed because thread switches can not reliable be tracked
    * with callback CLG_(run_thread) only: we have otherwise no way to get
@@ -714,7 +714,7 @@
       else
 	  ppIRJumpKind( jmpkind );
 
-      VG_(printf)(" %08lx -> %08x, SP %08x\n",
+      VG_(printf)(" %08lx -> %08lx, SP %08lx\n",
 		  last_bb ? bb_jmpaddr(last_bb) : 0,
 		  bb_addr(bb), sp);
   }
@@ -870,7 +870,7 @@
     VG_(printf)("\n");
   }
   
-  CLG_DEBUG(3,"- setup_bbcc (BB %p): Cost %p (Len %d), Instrs %d (Len %d)\n",
+  CLG_DEBUG(3,"- setup_bbcc (BB %#lx): Cost %p (Len %d), Instrs %d (Len %d)\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 b5502a4..89f5cea 100644
--- a/callgrind/callstack.c
+++ b/callgrind/callstack.c
@@ -275,7 +275,7 @@
 
 	    BB* bb = jcc->to->bb;
 	    if (s>40) s=40;
-	    VG_(printf)("%s> %s(0x%x, 0x%x, ...) [%s / %p]\n", spaces[s%4]+40-s, bb->fn->name,
+	    VG_(printf)("%s> %s(0x%x, 0x%x, ...) [%s / %#lx]\n", spaces[s%4]+40-s, bb->fn->name,
                         pars ? pars[1]:0,
 			pars ? pars[2]:0,
 			bb->obj->name + bb->obj->last_slash_pos,
@@ -285,7 +285,7 @@
 	else if (CLG_(clo).verbose<4) {
 	    VG_(printf)("+ %2d ", CLG_(current_call_stack).sp);
 	    CLG_(print_short_jcc)(jcc);
-	    VG_(printf)(", SP %p, RA %p\n", sp, ret_addr);
+	    VG_(printf)(", SP %#lx, RA %#lx\n", sp, ret_addr);
 	}
 	else {
 	    VG_(printf)("  Pushed ");
@@ -365,16 +365,16 @@
 	if (CLG_(clo).verbose<4) {
 	    if (jcc) {
 		/* popped JCC target first */
-		VG_(printf)("- %2d %p => ", 
+		VG_(printf)("- %2d %#lx => ",
 			    CLG_(current_call_stack).sp,
 			    bb_addr(jcc->to->bb));
 		CLG_(print_addr)(bb_jmpaddr(jcc->from->bb));
-		VG_(printf)(", SP %p\n",
+		VG_(printf)(", SP %#lx\n",
 			    CLG_(current_call_stack).entry[CLG_(current_call_stack).sp].sp);
 		CLG_(print_cost)(10, CLG_(sets).full, jcc->cost);
 	    }
 	    else
-		VG_(printf)("- %2d [Skipped JCC], SP %p\n",
+		VG_(printf)("- %2d [Skipped JCC], SP %#lx\n",
 			    CLG_(current_call_stack).sp,
 			    CLG_(current_call_stack).entry[CLG_(current_call_stack).sp].sp);
 	}
@@ -397,7 +397,7 @@
 void CLG_(unwind_call_stack)(Addr sp, Int minpops)
 {
     Int csp;
-    CLG_DEBUG(4,"+ unwind_call_stack(sp %p, minpops %d): frame %d\n",
+    CLG_DEBUG(4,"+ unwind_call_stack(sp %#lx, minpops %d): frame %d\n",
 	      sp, minpops, CLG_(current_call_stack).sp);
 
     /* We pop old stack frames.
diff --git a/callgrind/context.c b/callgrind/context.c
index 9a80166..2ff0fcd 100644
--- a/callgrind/context.c
+++ b/callgrind/context.c
@@ -326,10 +326,10 @@
   *(CLG_(current_fn_stack).top) = fn;
   CLG_(current_state).cxt = CLG_(get_cxt)(CLG_(current_fn_stack).top);
 
-  CLG_DEBUG(5, "- push_cxt(fn '%s'): new cxt %d, fn_sp %d\n", 
+  CLG_DEBUG(5, "- push_cxt(fn '%s'): new cxt %d, fn_sp %ld\n",
 	    fn ? fn->name : (Char*)"0x0",
 	    CLG_(current_state).cxt ?
 	      CLG_(current_state).cxt->base_number : -1,
-	    CLG_(current_fn_stack).top - CLG_(current_fn_stack).bottom);
+	    CLG_(current_fn_stack).top - CLG_(current_fn_stack).bottom + 0L);
 }
 			       
diff --git a/callgrind/debug.c b/callgrind/debug.c
index 99ec7dc..43854b7 100644
--- a/callgrind/debug.c
+++ b/callgrind/debug.c
@@ -51,7 +51,7 @@
 	print_indent(s);
     }
 
-    VG_(printf)("BB %p (Obj '%s')", bb_addr(bb), bb->obj->name);
+    VG_(printf)("BB %#lx (Obj '%s')", bb_addr(bb), bb->obj->name);
 }
 
 static
@@ -136,7 +136,7 @@
 	      bb->jmp_offset, bb_jmpaddr(bb));
   else
 #endif
-    VG_(printf)("%s +%p=%p, ",
+    VG_(printf)("%s +%#lx=%#lx, ",
 		bb->obj->name + bb->obj->last_slash_pos,
 		bb->offset, bb_addr(bb));
   CLG_(print_cxt)(s+8, bbcc->cxt, bbcc->rec_index);
@@ -220,7 +220,7 @@
 void CLG_(print_short_jcc)(jCC* jcc)
 {
     if (jcc)
-	VG_(printf)("%p => %p [%llu/%llu,%llu,%llu]",
+	VG_(printf)("%#lx => %#lx [%llu/%llu,%llu,%llu]",
 		    bb_jmpaddr(jcc->from->bb),
 		    bb_addr(jcc->to->bb),
 		    jcc->call_counter,
@@ -264,9 +264,9 @@
     }
 
     ce = CLG_(get_call_entry)(sp);
-    VG_(printf)("[%-2d] SP %p, RA %p", sp, ce->sp, ce->ret_addr);
+    VG_(printf)("[%-2d] SP %#lx, RA %#lx", sp, ce->sp, ce->ret_addr);
     if (ce->nonskipped)
-	VG_(printf)(" NonSkipped BB %p / %s",
+	VG_(printf)(" NonSkipped BB %#lx / %s",
 		    bb_addr(ce->nonskipped->bb),
 		    ce->nonskipped->cxt->fn[0]->name);
     VG_(printf)("\n");
@@ -381,9 +381,9 @@
     CLG_(get_debug_info)(addr, fl_buf, fn_buf, &ln, &di);
 
     if (VG_(strcmp)(fn_buf,"???")==0)
-	VG_(printf)("%p", addr);
+	VG_(printf)("%#lx", addr);
     else
-	VG_(printf)("%p %s", addr, fn_buf);
+	VG_(printf)("%#lx %s", addr, fn_buf);
 
     if (di) {
       obj_name = VG_(seginfo_filename)(di);
diff --git a/callgrind/dump.c b/callgrind/dump.c
index 5bae981..3a91972 100644
--- a/callgrind/dump.c
+++ b/callgrind/dump.c
@@ -477,7 +477,7 @@
     p->addr = addr - bbcc->bb->obj->offset;
     p->bb_addr = bbcc->bb->offset;
 
-    CLG_DEBUG(3, "  get_debug_pos(%p): BB %p, fn '%s', file '%s', line %u\n",
+    CLG_DEBUG(3, "  get_debug_pos(%#lx): BB %#lx, fn '%s', file '%s', line %u\n",
 	     addr, bb_addr(bbcc->bb), bbcc->cxt->fn[0]->name,
 	     p->file->name, p->line);
 
@@ -519,7 +519,7 @@
 static void fprint_apos(Int fd, AddrPos* curr, AddrPos* last, file_node* func_file)
 {
     CLG_ASSERT(curr->file != 0);
-    CLG_DEBUG(2, "    print_apos(file '%s', line %d, bb %p, addr %p) fnFile '%s'\n",
+    CLG_DEBUG(2, "    print_apos(file '%s', line %d, bb %#lx, addr %#lx) fnFile '%s'\n",
 	     curr->file->name, curr->line, curr->bb_addr, curr->addr,
 	     func_file->name);
 
@@ -569,7 +569,7 @@
 		    p = VG_(sprintf)(outbuf, "%d ", diff);
 	    }
 	    else
-		p = VG_(sprintf)(outbuf, "%p ", curr->addr);
+		p = VG_(sprintf)(outbuf, "%#lx ", curr->addr);
 	}
 
 	if (CLG_(clo).dump_bb) {
@@ -584,7 +584,7 @@
 		    p += VG_(sprintf)(outbuf+p, "%d ", diff);
 	    }
 	    else
-		p += VG_(sprintf)(outbuf+p, "%p ", curr->bb_addr);
+		p += VG_(sprintf)(outbuf+p, "%#lx ", curr->bb_addr);
 	}
 
 	if (CLG_(clo).dump_line) {
@@ -630,7 +630,7 @@
 static void fprint_fcost(Int fd, AddrCost* c, AddrPos* last)
 {
   CLG_DEBUGIF(3) {
-    CLG_DEBUG(2, "   print_fcost(file '%s', line %d, bb %p, addr %p):\n",
+    CLG_DEBUG(2, "   print_fcost(file '%s', line %d, 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);
   }
@@ -1018,7 +1018,7 @@
 	int s, r;
 	BBCC* v;
 
-	CLG_DEBUG(8, "  qsort(%d,%d)\n", a-qsort_start, n);
+	CLG_DEBUG(8, "  qsort(%ld,%ld)\n", a-qsort_start + 0L, n + 0L);
 
 	if (n < 7) {	 /* Insertion sort on smallest arrays */
 		for (pm = a+1; pm < a+n; pm++)
@@ -1027,7 +1027,8 @@
 
 		CLG_DEBUGIF(8) {
 		    for (pm = a; pm < a+n; pm++) {
-			VG_(printf)("   %3d BB %p, ", pm - qsort_start,
+			VG_(printf)("   %3ld BB %#lx, ",
+                                    pm - qsort_start + 0L,
 				    bb_addr((*pm)->bb));      
 			CLG_(print_cxt)(9, (*pm)->cxt, (*pm)->rec_index);
 		    }
@@ -1081,25 +1082,30 @@
 	if ((s = a+n-1-pd)>0) { for(r=0;r<s;r++) swap(pc+r, a+n-s+r); }	    
 
 	CLG_DEBUGIF(8) {
-	  VG_(printf)("   PV BB %p, ", bb_addr((*pv)->bb));
+	  VG_(printf)("   PV BB %#lx, ", bb_addr((*pv)->bb));
 	    CLG_(print_cxt)(9, (*pv)->cxt, (*pv)->rec_index);
 
 	    s = pb-pa+1;
-	    VG_(printf)("    Lower %d - %d:\n", a-qsort_start, a+s-1-qsort_start);
+	    VG_(printf)("    Lower %ld - %ld:\n",
+                        a-qsort_start + 0L,
+                        a+s-1-qsort_start + 0L);
 	    for (r=0;r<s;r++) {
 		pm = a+r;
-		VG_(printf)("     %3d BB %p, ", 
-			    pm-qsort_start,bb_addr((*pm)->bb));
+		VG_(printf)("     %3ld BB %#lx, ",
+			    pm-qsort_start + 0L,
+                            bb_addr((*pm)->bb));
 		CLG_(print_cxt)(9, (*pm)->cxt, (*pm)->rec_index);
 	    }
 
 	    s = pd-pc+1;
-	    VG_(printf)("    Upper %d - %d:\n", 
-			a+n-s-qsort_start, a+n-1-qsort_start);
+	    VG_(printf)("    Upper %ld - %ld:\n",
+			a+n-s-qsort_start + 0L,
+                        a+n-1-qsort_start + 0L);
 	    for (r=0;r<s;r++) {
 		pm = a+n-s+r;
-		VG_(printf)("     %3d BB %p, ", 
-			    pm-qsort_start,bb_addr((*pm)->bb));
+		VG_(printf)("     %3ld BB %#lx, ",
+			    pm-qsort_start + 0L,
+                            bb_addr((*pm)->bb));
 		CLG_(print_cxt)(9, (*pm)->cxt, (*pm)->rec_index);
 	    }
 	}
@@ -1549,7 +1555,7 @@
 	/* FIXME: Specify Object of BB if different to object of fn */
 	int i, pos = 0;
 	ULong ecounter = (*p)->ecounter_sum;
-	pos = VG_(sprintf)(print_buf, "bb=%p ", (*p)->bb->offset);
+	pos = VG_(sprintf)(print_buf, "bb=%#lx ", (*p)->bb->offset);
 	for(i = 0; i<(*p)->bb->cjmp_count;i++) {
 	    pos += VG_(sprintf)(print_buf+pos, "%d %llu ", 
 				(*p)->bb->jmp[i].instr,
diff --git a/callgrind/fn.c b/callgrind/fn.c
index 7fd14f3..66389b0 100644
--- a/callgrind/fn.c
+++ b/callgrind/fn.c
@@ -128,7 +128,7 @@
 	    r = range + 2;
 	    found = True;
 	    while(r[1]) {
-		CLG_DEBUG(1, " [%p] Found! Checking %d bytes of [%x %x %x...]\n",
+		CLG_DEBUG(1, " [%#lx] Found! Checking %d bytes of [%x %x %x...]\n",
 			  addr, r[1], code[r[0]], code[r[0]+1], code[r[0]+2]);
 
 		if (VG_(memcmp)( (void*)(addr+r[0]), code+r[0], r[1]) != 0) {
@@ -145,7 +145,7 @@
     if (!found || (r==0)) return;
 
     if (VG_(clo_verbosity) > 1)
-	VG_(message)(Vg_DebugMsg, "Code check found runtime_resolve: %s +%p=%p, length %d",
+	VG_(message)(Vg_DebugMsg, "Code check found runtime_resolve: %s +%#lx=%#lx, length %d",
 		     obj->name + obj->last_slash_pos,
 		     addr - obj->start, addr, r[0]);
 
@@ -375,7 +375,7 @@
   Char dir[FILENAME_LEN];
   UInt line;
   
-  CLG_DEBUG(6, "  + get_debug_info(%p)\n", instr_addr);
+  CLG_DEBUG(6, "  + get_debug_info(%#lx)\n", instr_addr);
 
   if (pDebugInfo) {
       *pDebugInfo = VG_(find_seginfo)(instr_addr);
@@ -421,7 +421,7 @@
      if (line_num) *line_num=0;
    }
 
-   CLG_DEBUG(6, "  - get_debug_info(%p): seg '%s', fn %s\n",
+   CLG_DEBUG(6, "  - get_debug_info(%#lx): seg '%s', fn %s\n",
 	    instr_addr,
 	    !pDebugInfo   ? (const UChar*)"-" :
 	    (*pDebugInfo) ? VG_(seginfo_filename)(*pDebugInfo) :
@@ -448,7 +448,7 @@
     /* fn from debug info is idempotent for a BB */
     if (bb->fn) return bb->fn;
 
-    CLG_DEBUG(3,"+ get_fn_node(BB %p)\n", bb_addr(bb));
+    CLG_DEBUG(3,"+ get_fn_node(BB %#lx)\n", bb_addr(bb));
 
     /* get function/file name, line number and object of
      * the BB according to debug information
@@ -461,10 +461,10 @@
 
 	/* Use address as found in library */
 	if (sizeof(Addr) == 4)
-	    p = VG_(sprintf)(fnname, "%08p", bb->offset);
+	    p = VG_(sprintf)(fnname, "%#08lx", bb->offset);
 	else 	    
 	    // 64bit address
-	    p = VG_(sprintf)(fnname, "%016p", bb->offset);
+	    p = VG_(sprintf)(fnname, "%#016lx", bb->offset);
 
 	VG_(sprintf)(fnname+p, "%s", 
 		     (bb->sect_kind == Vg_SectData) ? " [Data]" :
@@ -521,7 +521,7 @@
 	  fn->pop_on_jump = True;
 
 	  if (VG_(clo_verbosity) > 1)
-	      VG_(message)(Vg_DebugMsg, "Symbol match: found runtime_resolve: %s +%p=%p",
+	      VG_(message)(Vg_DebugMsg, "Symbol match: found runtime_resolve: %s +%#lx=%#lx",
 		      bb->obj->name + bb->obj->last_slash_pos,
 		      bb->offset, bb_addr(bb));
       }
@@ -539,7 +539,7 @@
     bb->fn   = fn;
     bb->line = line_num;
 
-    CLG_DEBUG(3,"- get_fn_node(BB %p): %s (in %s:%u)\n",
+    CLG_DEBUG(3,"- get_fn_node(BB %#lx): %s (in %s:%u)\n",
 	     bb_addr(bb), fnname, filename, line_num);
 
     return fn;
diff --git a/callgrind/main.c b/callgrind/main.c
index 8ac72fd..a6d2075 100644
--- a/callgrind/main.c
+++ b/callgrind/main.c
@@ -522,12 +522,12 @@
 
    // No instrumentation if it is switched off
    if (! CLG_(instrument_state)) {
-       CLG_DEBUG(5, "instrument(BB %p) [Instrumentation OFF]\n",
+       CLG_DEBUG(5, "instrument(BB %#lx) [Instrumentation OFF]\n",
 		 (Addr)closure->readdr);
        return bbIn;
    }
 
-   CLG_DEBUG(3, "+ instrument(BB %p)\n", (Addr)closure->readdr);
+   CLG_DEBUG(3, "+ instrument(BB %#lx)\n", (Addr)closure->readdr);
 
    /* Set up SB for instrumented IR */
    bbOut = deepCopyIRSBExceptStmts(bbIn);
@@ -681,7 +681,7 @@
        bb->jmpkind = bbIn->jumpkind;
    }
    
-   CLG_DEBUG(3, "- instrument(BB %p): byteLen %u, CJumps %u, CostLen %u\n",
+   CLG_DEBUG(3, "- instrument(BB %#lx): byteLen %u, CJumps %u, CostLen %u\n",
 	     origAddr, bb->instr_len, bb->cjmp_count, bb->cost_count);
    if (cJumps>0) {
        CLG_DEBUG(3, "                     [ ");
diff --git a/callgrind/sim.c b/callgrind/sim.c
index 7c14fd6..3d9ae6c 100644
--- a/callgrind/sim.c
+++ b/callgrind/sim.c
@@ -691,7 +691,7 @@
     c->use[idx].count ++;
     c->use[idx].mask |= use_mask;
 
-    CLG_DEBUG(6," Hit [idx %d] (line %p from %p): %x => %08x, count %d\n",
+    CLG_DEBUG(6," Hit [idx %d] (line %#lx from %#lx): %x => %08x, count %d\n",
 	      idx, c->loaded[idx].memline,  c->loaded[idx].iaddr,
 	      use_mask, c->use[idx].mask, c->use[idx].count);
 }
@@ -790,7 +790,7 @@
    UWord *set, tmp_tag; 						    \
    UInt use_mask;							    \
                                                                             \
-   CLG_DEBUG(6,"%s.Acc(Addr %p, size %d): Sets [%d/%d]\n",                  \
+   CLG_DEBUG(6,"%s.Acc(Addr %#lx, size %d): Sets [%d/%d]\n",                  \
 	    L.name, a, size, set1, set2);				    \
                                                                             \
    /* First case: word entirely within line. */                             \
@@ -808,7 +808,7 @@
         idx = (set1 << L.assoc_bits) | (set[0] & ~L.tag_mask);              \
         L.use[idx].count ++;                                                \
         L.use[idx].mask |= use_mask;                                        \
-	CLG_DEBUG(6," Hit0 [idx %d] (line %p from %p): %x => %08x, count %d\n",\
+	CLG_DEBUG(6," Hit0 [idx %d] (line %#lx from %#lx): %x => %08x, count %d\n",\
 		 idx, L.loaded[idx].memline,  L.loaded[idx].iaddr,          \
 		 use_mask, L.use[idx].mask, L.use[idx].count);              \
 	return L1_Hit;							    \
@@ -825,7 +825,7 @@
             idx = (set1 << L.assoc_bits) | (tmp_tag & ~L.tag_mask);         \
             L.use[idx].count ++;                                            \
             L.use[idx].mask |= use_mask;                                    \
-	CLG_DEBUG(6," Hit%d [idx %d] (line %p from %p): %x => %08x, count %d\n",\
+	CLG_DEBUG(6," Hit%d [idx %d] (line %#lx from %#lx): %x => %08x, count %d\n",\
 		 i, idx, L.loaded[idx].memline,  L.loaded[idx].iaddr,       \
 		 use_mask, L.use[idx].mask, L.use[idx].count);              \
             return L1_Hit;                                                  \
@@ -852,7 +852,7 @@
          idx = (set1 << L.assoc_bits) | (set[0] & ~L.tag_mask);             \
          L.use[idx].count ++;                                               \
          L.use[idx].mask |= use_mask;                                       \
-	CLG_DEBUG(6," Hit0 [idx %d] (line %p from %p): %x => %08x, count %d\n",\
+	CLG_DEBUG(6," Hit0 [idx %d] (line %#lx from %#lx): %x => %08x, count %d\n",\
 		 idx, L.loaded[idx].memline,  L.loaded[idx].iaddr,          \
 		 use_mask, L.use[idx].mask, L.use[idx].count);              \
          goto block2;                                                       \
@@ -867,7 +867,7 @@
             idx = (set1 << L.assoc_bits) | (tmp_tag & ~L.tag_mask);         \
             L.use[idx].count ++;                                            \
             L.use[idx].mask |= use_mask;                                    \
-	CLG_DEBUG(6," Hit%d [idx %d] (line %p from %p): %x => %08x, count %d\n",\
+	CLG_DEBUG(6," Hit%d [idx %d] (line %#lx from %#lx): %x => %08x, count %d\n",\
 		 i, idx, L.loaded[idx].memline,  L.loaded[idx].iaddr,       \
 		 use_mask, L.use[idx].mask, L.use[idx].count);              \
             goto block2;                                                    \
@@ -889,7 +889,7 @@
          idx = (set2 << L.assoc_bits) | (set[0] & ~L.tag_mask);             \
          L.use[idx].count ++;                                               \
          L.use[idx].mask |= use_mask;                                       \
-	CLG_DEBUG(6," Hit0 [idx %d] (line %p from %p): %x => %08x, count %d\n",\
+	CLG_DEBUG(6," Hit0 [idx %d] (line %#lx from %#lx): %x => %08x, count %d\n",\
 		 idx, L.loaded[idx].memline,  L.loaded[idx].iaddr,          \
 		 use_mask, L.use[idx].mask, L.use[idx].count);              \
          return miss1;                                                      \
@@ -904,7 +904,7 @@
             idx = (set2 << L.assoc_bits) | (tmp_tag & ~L.tag_mask);         \
             L.use[idx].count ++;                                            \
             L.use[idx].mask |= use_mask;                                    \
-	CLG_DEBUG(6," Hit%d [idx %d] (line %p from %p): %x => %08x, count %d\n",\
+	CLG_DEBUG(6," Hit%d [idx %d] (line %#lx from %#lx): %x => %08x, count %d\n",\
 		 i, idx, L.loaded[idx].memline,  L.loaded[idx].iaddr,       \
 		 use_mask, L.use[idx].mask, L.use[idx].count);              \
             return miss1;                                                   \
@@ -921,7 +921,7 @@
       return (miss1==MemAccess || miss2==MemAccess) ? MemAccess:L2_Hit;     \
                                                                             \
    } else {                                                                 \
-       VG_(printf)("addr: %p  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 0;                                                                \
@@ -952,10 +952,10 @@
   line_use* use = &(L2.use[idx]);
   int i = ((32 - countBits(use->mask)) * L2.line_size)>>5;
   
-  CLG_DEBUG(2, " L2.miss [%d]: at %p accessing memline %p\n",
+  CLG_DEBUG(2, " L2.miss [%d]: at %#lx accessing memline %#lx\n",
 	   idx, bb_base + current_ii->instr_offset, memline);
   if (use->count>0) {
-    CLG_DEBUG(2, "   old: used %d, loss bits %d (%08x) [line %p from %p]\n",
+    CLG_DEBUG(2, "   old: used %d, 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);
@@ -986,13 +986,13 @@
    int i, j, idx;
    UWord tmp_tag;
    
-   CLG_DEBUG(6,"L2.Acc(Memline %p): Set %d\n", memline, setNo);
+   CLG_DEBUG(6,"L2.Acc(Memline %#lx): Set %d\n", memline, setNo);
 
    if (tag == (set[0] & L2.tag_mask)) {
      idx = (setNo << L2.assoc_bits) | (set[0] & ~L2.tag_mask);
      l1_loaded->dep_use = &(L2.use[idx]);
 
-     CLG_DEBUG(6," Hit0 [idx %d] (line %p from %p): => %08x, count %d\n",
+     CLG_DEBUG(6," Hit0 [idx %d] (line %#lx from %#lx): => %08x, count %d\n",
 		 idx, L2.loaded[idx].memline,  L2.loaded[idx].iaddr,
 		 L2.use[idx].mask, L2.use[idx].count);
      return L2_Hit;
@@ -1007,7 +1007,7 @@
        idx = (setNo << L2.assoc_bits) | (tmp_tag & ~L2.tag_mask);
        l1_loaded->dep_use = &(L2.use[idx]);
 
-	CLG_DEBUG(6," Hit%d [idx %d] (line %p from %p): => %08x, count %d\n",
+	CLG_DEBUG(6," Hit%d [idx %d] (line %#lx from %#lx): => %08x, count %d\n",
 		 i, idx, L2.loaded[idx].memline,  L2.loaded[idx].iaddr,
 		 L2.use[idx].mask, L2.use[idx].count);
 	return L2_Hit;
@@ -1040,10 +1040,10 @@
   line_use* use = &(cache->use[idx]);				     \
   int c = ((32 - countBits(use->mask)) * cache->line_size)>>5;       \
                                                                      \
-  CLG_DEBUG(2, " %s.miss [%d]: at %p accessing memline %p (mask %08x)\n", \
+  CLG_DEBUG(2, " %s.miss [%d]: at %#lx accessing memline %#lx (mask %08x)\n", \
 	   cache->name, idx, bb_base + current_ii->instr_offset, memline, mask); \
   if (use->count>0) {                                                \
-    CLG_DEBUG(2, "   old: used %d, loss bits %d (%08x) [line %p from %p]\n",\
+    CLG_DEBUG(2, "   old: used %d, 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);	     \
@@ -1149,7 +1149,7 @@
     current_ii = ii;
     IrRes = (*simulator.I1_Read)(bb_base + ii->instr_offset, ii->instr_size);
 
-    CLG_DEBUG(6, "log_1I0D:  Ir=%p/%u => Ir %d\n",
+    CLG_DEBUG(6, "log_1I0D:  Ir=%#lx/%u => Ir %d\n",
 	      bb_base + ii->instr_offset, ii->instr_size, IrRes);
 
     if (CLG_(current_state).collect) {
@@ -1177,7 +1177,7 @@
     IrRes = (*simulator.I1_Read)(bb_base + ii->instr_offset, ii->instr_size);
     DrRes = (*simulator.D1_Read)(data, ii->data_size);
 
-    CLG_DEBUG(6, "log_1I1Dr: Ir=%p/%u, Dr=%p/%u => Ir %d, Dr %d\n",
+    CLG_DEBUG(6, "log_1I1Dr: Ir=%#lx/%u, Dr=%#lx/%u => Ir %d, Dr %d\n",
 	      bb_base + ii->instr_offset, ii->instr_size,
 	      data, ii->data_size, IrRes, DrRes);
 
@@ -1209,7 +1209,7 @@
     current_ii = ii;
     DrRes = (*simulator.D1_Read)(data, ii->data_size);
 
-    CLG_DEBUG(6, "log_0I1Dr: Dr=%p/%u => Dr %d\n",
+    CLG_DEBUG(6, "log_0I1Dr: Dr=%#lx/%u => Dr %d\n",
 	      data, ii->data_size, DrRes);
 
     if (CLG_(current_state).collect) {
@@ -1239,7 +1239,7 @@
     IrRes = (*simulator.I1_Read)(bb_base + ii->instr_offset, ii->instr_size);
     DwRes = (*simulator.D1_Write)(data, ii->data_size);
 
-    CLG_DEBUG(6, "log_1I1Dw: Ir=%p/%u, Dw=%p/%u => Ir %d, Dw %d\n",
+    CLG_DEBUG(6, "log_1I1Dw: Ir=%#lx/%u, Dw=%#lx/%u => Ir %d, Dw %d\n",
 	      bb_base + ii->instr_offset, ii->instr_size,
 	      data, ii->data_size, IrRes, DwRes);
 
@@ -1270,7 +1270,7 @@
     current_ii = ii;
     DwRes = (*simulator.D1_Write)(data, ii->data_size);
 
-    CLG_DEBUG(6, "log_0I1Dw: Dw=%p/%u => Dw %d\n",
+    CLG_DEBUG(6, "log_0I1Dw: Dw=%#lx/%u => Dw %d\n",
 	      data, ii->data_size, DwRes);
 
     if (CLG_(current_state).collect) {
@@ -1301,7 +1301,7 @@
     DwRes = (*simulator.D1_Write)(data2, ii->data_size);
 
     CLG_DEBUG(6,
-	      "log_1I2D: Ir=%p/%u, Dr=%p/%u, Dw=%p/%u => Ir %d, Dr %d, Dw %d\n",
+	      "log_1I2D: Ir=%#lx/%u, Dr=%#lx/%u, Dw=%#lx/%u => Ir %d, Dr %d, Dw %d\n",
 	      bb_base + ii->instr_offset, ii->instr_size,
 	      data1, ii->data_size, data2, ii->data_size, IrRes, DrRes, DwRes);
 
@@ -1338,7 +1338,7 @@
     DwRes = (*simulator.D1_Write)(data2, ii->data_size);
 
     CLG_DEBUG(6,
-	      "log_0D2D: Dr=%p/%u, Dw=%p/%u => Dr %d, Dw %d\n",
+	      "log_0D2D: Dr=%#lx/%u, Dw=%#lx/%u => Dr %d, Dw %d\n",
 	      data1, ii->data_size, data2, ii->data_size, DrRes, DwRes);
 
     if (CLG_(current_state).collect) {
diff --git a/coregrind/m_debuginfo/d3basics.c b/coregrind/m_debuginfo/d3basics.c
index 020407f..d349f3c 100644
--- a/coregrind/m_debuginfo/d3basics.c
+++ b/coregrind/m_debuginfo/d3basics.c
@@ -646,7 +646,7 @@
       aMax   = * (Addr*)p;   p += sizeof(Addr);
       nbytes = * (UShort*)p; p += sizeof(UShort);
       nGuards++;
-      if (0) VG_(printf)("           guard %d: %p %p\n", 
+      if (0) VG_(printf)("           guard %d: %#lx %#lx\n",
                          (Int)nGuards, aMin,aMax);
       if (regs == NULL) {
          vg_assert(aMin == (Addr)0);
diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c
index 9606330..ebb552c 100644
--- a/coregrind/m_debuginfo/debuginfo.c
+++ b/coregrind/m_debuginfo/debuginfo.c
@@ -279,7 +279,7 @@
          if (curr->have_dinfo
              && (VG_(clo_verbosity) > 1 || VG_(clo_trace_redir)))
             VG_(message)(Vg_DebugMsg, 
-                         "Discarding syms at %p-%p in %s due to %s()", 
+                         "Discarding syms at %#lx-%#lx in %s due to %s()",
                          di->text_avma, 
                          di->text_avma + di->text_size,
                          curr->filename ? curr->filename : (UChar*)"???",
@@ -501,7 +501,7 @@
    vg_assert(seg);
 
    if (debug)
-      VG_(printf)("di_notify_mmap-1: %p-%p %c%c%c\n",
+      VG_(printf)("di_notify_mmap-1: %#lx-%#lx %c%c%c\n",
                   seg->start, seg->end, 
                   seg->hasR ? 'r' : '-',
                   seg->hasW ? 'w' : '-',seg->hasX ? 'x' : '-' );
@@ -698,7 +698,7 @@
    [a, a+len).  */
 void VG_(di_notify_munmap)( Addr a, SizeT len )
 {
-   if (0) VG_(printf)("DISCARD %p %p\n", a, a+len);
+   if (0) VG_(printf)("DISCARD %#lx %#lx\n", a, a+len);
    discard_syms_in_range(a, len);
 }
 
@@ -1494,7 +1494,7 @@
    static UInt n_steps = 0;
    n_search++;
 
-   if (0) VG_(printf)("search for %p\n", *ipP);
+   if (0) VG_(printf)("search for %#lx\n", *ipP);
 
    for (si = debugInfo_list; si != NULL; si = si->next) {
       n_steps++;
@@ -1659,7 +1659,7 @@
    var_szB = muw.w;
 
    if (show) {
-      VG_(printf)("VVVV: data_address_%p_is_in_var: %s :: ",
+      VG_(printf)("VVVV: data_address_%#lx_is_in_var: %s :: ",
                   data_addr, var->name );
       ML_(pp_Type_C_ishly)( var->type );
       VG_(printf)("\n");
@@ -1760,7 +1760,7 @@
          dname1, n_dname,
          "Location 0x%lx is %lu byte%s inside %s%s",
          data_addr, residual_offset, ro_plural, var->name,
-         VG_(indexXA)(described,0) );
+         (char*)(VG_(indexXA)(described,0)) );
       VG_(snprintf)(
          dname2, n_dname,
          "in frame #%d of thread %d", frameNo, (Int)tid);
@@ -1773,7 +1773,7 @@
          dname1, n_dname,
          "Location 0x%lx is %lu byte%s inside %s%s,",
          data_addr, residual_offset, ro_plural, var->name,
-         VG_(indexXA)(described,0) );
+         (char*)(VG_(indexXA)(described,0)) );
       VG_(snprintf)(
          dname2, n_dname,
          "declared at %s:%d, in frame #%d of thread %d",
@@ -1815,7 +1815,7 @@
          dname1, n_dname,
          "Location 0x%lx is %lu byte%s inside %s%s,",
          data_addr, residual_offset, ro_plural, var->name,
-         VG_(indexXA)(described,0) );
+         (char*)(VG_(indexXA)(described,0)) );
       VG_(snprintf)(
          dname2, n_dname,
          "a global variable");
@@ -1828,7 +1828,7 @@
          dname1, n_dname,
          "Location 0x%lx is %lu byte%s inside %s%s,",
          data_addr, residual_offset, ro_plural, var->name,
-         VG_(indexXA)(described,0) );
+         (char*)(VG_(indexXA)(described,0)) );
       VG_(snprintf)(
          dname2, n_dname,
          "a global variable declared at %s:%d",
@@ -1863,7 +1863,7 @@
    static UInt n_steps = 0;
    n_search++;
    if (debug)
-      VG_(printf)("QQQQ: cvif: ip,sp,fp %p,%p,%p\n", ip,sp,fp);
+      VG_(printf)("QQQQ: cvif: ip,sp,fp %#lx,%#lx,%#lx\n", ip,sp,fp);
    /* first, find the DebugInfo that pertains to 'ip'. */
    for (di = debugInfo_list; di; di = di->next) {
       n_steps++;
@@ -1947,7 +1947,7 @@
          DiVariable* var = (DiVariable*)VG_(indexXA)( vars, j );
          SizeT       offset;
          if (debug)
-            VG_(printf)("QQQQ:    var:name=%s %p-%p %p\n", 
+            VG_(printf)("QQQQ:    var:name=%s %#lx-%#lx %#lx\n",
                         var->name,arange->aMin,arange->aMax,ip);
          if (data_address_is_in_var( &offset, var, &regs, data_addr,
                                      di->data_bias )) {
@@ -1989,7 +1989,7 @@
    vg_assert(n_dname > 1);
    dname1[n_dname-1] = dname2[n_dname-1] = 0;
 
-   if (0) VG_(printf)("get_data_description: dataaddr %p\n", data_addr);
+   if (0) VG_(printf)("get_data_description: dataaddr %#lx\n", data_addr);
    /* First, see if data_addr is (or is part of) a global variable.
       Loop over the DebugInfos we have.  Check data_addr against the
       outermost scope of all of them, as that should be a global
@@ -2283,7 +2283,7 @@
 
       if (0)
          VG_(printf)(
-            "addr=%p di=%p %s got=%p,%ld plt=%p,%ld data=%p,%ld bss=%p,%ld\n",
+            "addr=%#lx di=%p %s got=%#lx,%ld plt=%#lx,%ld data=%#lx,%ld bss=%#lx,%ld\n",
             a, di, di->filename,
             di->got_avma,  di->got_size,
             di->plt_avma,  di->plt_size,
diff --git a/coregrind/m_debuginfo/readdwarf.c b/coregrind/m_debuginfo/readdwarf.c
index d7f5f9b..34baf86 100644
--- a/coregrind/m_debuginfo/readdwarf.c
+++ b/coregrind/m_debuginfo/readdwarf.c
@@ -292,7 +292,7 @@
 static 
 void reset_state_machine ( Int is_stmt )
 {
-   if (0) VG_(printf)("smr.a := %p (reset)\n", 0 );
+   if (0) VG_(printf)("smr.a := %p (reset)\n", NULL );
    state_machine_regs.last_address = 0;
    state_machine_regs.last_file = 1;
    state_machine_regs.last_line = 1;
@@ -360,7 +360,7 @@
 
    switch (op_code) {
       case DW_LNE_end_sequence:
-         if (0) VG_(printf)("1001: si->o %p, smr.a %p\n", 
+         if (0) VG_(printf)("1001: si->o %#lx, smr.a %#lx\n",
                             di->text_bias, state_machine_regs.address );
          /* JRS: added for compliance with spec; is pointless due to
             reset_state_machine below */
@@ -720,9 +720,9 @@
          advAddr = adv;
          state_machine_regs.address += adv;
 
-         if (0) VG_(printf)("smr.a += %p\n", adv );
+         if (0) VG_(printf)("smr.a += %#x\n", adv );
          adv = (op_code % info.li_line_range) + info.li_line_base;
-         if (0) VG_(printf)("1002: di->o %p, smr.a %p\n", 
+         if (0) VG_(printf)("1002: di->o %#lx, smr.a %#lx\n",
                             di->text_bias, state_machine_regs.address );
          state_machine_regs.line += adv;
 
@@ -769,7 +769,7 @@
             break;
 
          case DW_LNS_copy:
-            if (0) VG_(printf)("1002: di->o %p, smr.a %p\n", 
+            if (0) VG_(printf)("1002: di->o %#lx, smr.a %#lx\n",
                                di->text_bias, state_machine_regs.address );
             if (state_machine_regs.is_stmt) {
                /* only add a statement if there was a previous boundary */
@@ -805,7 +805,7 @@
                      * read_leb128 (data, & bytes_read, 0);
             data += bytes_read;
             state_machine_regs.address += adv;
-            if (0) VG_(printf)("smr.a += %p\n", adv );
+            if (0) VG_(printf)("smr.a += %#x\n", adv );
             if (di->ddump_line)
                VG_(printf)("  Advance PC by %d to 0x%lx\n", 
                            (Int)adv, state_machine_regs.address);
@@ -855,7 +855,7 @@
             adv = (((255 - info.li_opcode_base) / info.li_line_range)
                    * info.li_min_insn_length);
             state_machine_regs.address += adv;
-            if (0) VG_(printf)("smr.a += %p\n", adv );
+            if (0) VG_(printf)("smr.a += %#x\n", adv );
             if (di->ddump_line)
                VG_(printf)("  Advance PC by constant %d to 0x%lx\n", 
                            (Int)adv, (Addr)state_machine_regs.address);
@@ -866,7 +866,7 @@
             adv = *((UShort *)data);
             data += 2;
             state_machine_regs.address += adv;
-            if (0) VG_(printf)("smr.a += %p\n", adv );
+            if (0) VG_(printf)("smr.a += %#x\n", adv );
             if (di->ddump_line)
                VG_(printf)("  DWARF2-line: fixed_advance_pc\n");
             break;
@@ -1173,8 +1173,8 @@
       
       /* Fill ui with offset in .debug_line and compdir */
       if (0)
-         VG_(printf)( "Reading UnitInfo at 0x%x.....\n", 
-                      block_img - debug_info_img );
+         VG_(printf)( "Reading UnitInfo at 0x%lx.....\n",
+                      block_img - debug_info_img + 0UL );
       read_unitinfo_dwarf2( &ui, block_img, 
                                  debug_abbv_img, debug_str_img, di );
       if (0)
@@ -1186,7 +1186,7 @@
          continue;
       
       if (0) 
-         VG_(printf)("debug_line_sz %d, ui.stmt_list %lld  %s\n", 
+         VG_(printf)("debug_line_sz %ld, ui.stmt_list %lld  %s\n",
                      debug_line_sz, ui.stmt_list, ui.name );
       /* Read the .debug_line block for this compile unit */
       read_dwarf2_lineblock( 
@@ -2136,7 +2136,7 @@
   failed:
    if (VG_(clo_verbosity) > 2 || debuginfo->trace_cfi) {
       VG_(message)(Vg_DebugMsg,
-                  "summarise_context(loc_start = %p)"
+                  "summarise_context(loc_start = %#lx)"
                   ": cannot summarise(why=%d):   ", loc_start, why);
       ppUnwindContext(ctx);
    }
@@ -2209,7 +2209,7 @@
    if (ctx->cfa_reg == FP_REG) {
       VG_(printf)("SP/CFA=%d+FP   ", ctx->cfa_off);
    } else {
-      VG_(printf)("SP/CFA=unknown  ", ctx->cfa_off);
+      VG_(printf)("SP/CFA=unknown  ");
    }
 
    VG_(printf)("RA=");
@@ -3056,7 +3056,7 @@
             (now known to be incorrect -- the address is encoded) */
          loc = read_encoded_Addr(&len, adi, &instr[i]);
          i += len;
-         VG_(printf)("  sci:DW_CFA_set_loc(%p)\n", loc); 
+         VG_(printf)("  sci:DW_CFA_set_loc(%#lx)\n", loc);
          break;
 
       case DW_CFA_advance_loc1:
@@ -3350,9 +3350,9 @@
 
    if (di->trace_cfi) {
       VG_(printf)("\n-----------------------------------------------\n");
-      VG_(printf)("CFI info: szB %ld, _avma %p, _image %p\n",
-                  di->ehframe_size, (void*)di->ehframe_avma, 
-                  (void*)ehframe_image );
+      VG_(printf)("CFI info: szB %ld, _avma %#lx, _image %p\n",
+                  di->ehframe_size, di->ehframe_avma,
+                  ehframe_image );
       VG_(printf)("CFI info: name %s\n",
                   di->filename );
    }
@@ -3400,7 +3400,8 @@
       ciefde_start = data;
       if (di->trace_cfi) 
          VG_(printf)("\ncie/fde.start   = %p (ehframe_image + 0x%lx)\n", 
-                     ciefde_start, ciefde_start - ehframe_image);
+                     ciefde_start,
+                     ciefde_start - ehframe_image + 0UL);
 
       ciefde_len = (ULong) read_UInt(data); data += sizeof(UInt);
       if (di->trace_cfi) 
@@ -3659,7 +3660,7 @@
          fde_initloc = read_encoded_Addr(&nbytes, &adi, data);
          data += nbytes;
          if (di->trace_cfi) 
-            VG_(printf)("fde.initloc     = %p\n", (void*)fde_initloc);
+            VG_(printf)("fde.initloc     = %#lx\n", fde_initloc);
 
          adi.encoding      = the_CIEs[cie].address_encoding & 0xf;
          adi.ehframe_image = ehframe_image;
@@ -3685,7 +3686,7 @@
          }
 
          if (di->trace_cfi) 
-            VG_(printf)("fde.arangec     = %p\n", (void*)fde_arange);
+            VG_(printf)("fde.arangec     = %#lx\n", fde_arange);
 
          if (di->ddump_frames)
             VG_(printf)("%08lx %08lx %08lx FDE cie=%08lx pc=%08lx..%08lx\n",
diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c
index 83556a9..c6a8797 100644
--- a/coregrind/m_debuginfo/readdwarf3.c
+++ b/coregrind/m_debuginfo/readdwarf3.c
@@ -467,7 +467,7 @@
       aMin   = * (Addr*)p;  p += sizeof(Addr);
       aMax   = * (Addr*)p;  p += sizeof(Addr);
       nbytes = * (UShort*)p; p += sizeof(UShort);
-      VG_(printf)("[%p,%p]=", aMin, aMax);
+      VG_(printf)("[%#lx,%#lx]=", aMin, aMax);
       while (nbytes > 0) {
          VG_(printf)("%02x", (UInt)*p++);
          nbytes--;
@@ -1119,7 +1119,7 @@
          break;
       }
       default:
-         VG_(printf)("get_Form_contents: unhandled %lld (%s)\n",
+         VG_(printf)("get_Form_contents: unhandled %d (%s)\n",
                      form, ML_(pp_DW_FORM)(form));
          c->barf("get_Form_contents: unhandled DW_FORM");
    }
@@ -1215,7 +1215,7 @@
          for (j = 0; j < VG_(sizeXA)( xa ); j++) {
             AddrRange* range = (AddrRange*) VG_(indexXA)( xa, j );
             vg_assert(range);
-            VG_(printf)("[%p,%p] ", range->aMin, range->aMax);
+            VG_(printf)("[%#lx,%#lx] ", range->aMin, range->aMax);
          }
       }
       VG_(printf)("\n");
@@ -3405,7 +3405,7 @@
 
            if (i > 0 && (i%2) == 0) 
               TRACE_D3("\n                       ");
-           TRACE_D3("[%p,%p] ", pcMin, pcMax );
+           TRACE_D3("[%#lx,%#lx] ", pcMin, pcMax );
 
            ML_(addVar)(
               di, varp->level, 
diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c
index d7670c9..24934a7 100644
--- a/coregrind/m_debuginfo/readelf.c
+++ b/coregrind/m_debuginfo/readelf.c
@@ -165,8 +165,8 @@
       case STT_HIPROC:  VG_(printf)("hip "); break;
       default:          VG_(printf)("??? "); break;
    }
-   VG_(printf)(": svma %010p, %ssz %4d  %s\n",
-               sym_svma, space, sym->st_size,
+   VG_(printf)(": svma %#010lx, %ssz %4ld  %s\n",
+               sym_svma, space, sym->st_size + 0UL,
                ( sym->st_name ? sym_name : (Char*)"NONAME" ) ); 
 }               
 
@@ -472,7 +472,7 @@
          vg_assert(in_rx);
       if (!in_rx) {
          TRACE_SYMTAB(
-            "ignore -- %p .. %p outside .text svma range %p .. %p\n",
+            "ignore -- %#lx .. %#lx outside .text svma range %#lx .. %#lx\n",
             *sym_avma_out, *sym_avma_out + *sym_size_out,
             di->text_avma,
             di->text_avma + di->text_size);
@@ -481,7 +481,7 @@
    } else {
      if (!(in_data || in_sdata || in_bss)) {
          TRACE_SYMTAB(
-            "ignore -- %p .. %p outside .data / .sdata / .bss svma ranges\n",
+            "ignore -- %#lx .. %#lx outside .data / .sdata / .bss svma ranges\n",
             *sym_avma_out, *sym_avma_out + *sym_size_out);
          return False;
       }
@@ -531,7 +531,7 @@
       return;
    }
 
-   TRACE_SYMTAB("\n--- Reading (ELF, standard) %s (%d entries) ---\n",
+   TRACE_SYMTAB("\n--- Reading (ELF, standard) %s (%ld entries) ---\n",
                 tab_name, symtab_szB/sizeof(ElfXX_Sym) );
 
    /* Perhaps should start at i = 1; ELF docs suggest that entry
@@ -562,11 +562,13 @@
          ML_(addSym) ( di, &risym );
 
          if (di->trace_symtab) {
-            VG_(printf)("    rec(%c) [%4d]:          "
-                        "  val %010p, sz %4d  %s\n",
+            VG_(printf)("    rec(%c) [%4ld]:          "
+                        "  val %#010lx, sz %4d  %s\n",
                         is_text ? 't' : 'd',
-                        i, (void*)risym.addr, (Int)risym.size, 
-                           (HChar*)risym.name
+                        i,
+                        risym.addr,
+                        (Int)risym.size,
+                        (HChar*)risym.name
             );
          }
 
@@ -632,7 +634,7 @@
       return;
    }
 
-   TRACE_SYMTAB("\n--- Reading (ELF, ppc64-linux) %s (%d entries) ---\n",
+   TRACE_SYMTAB("\n--- Reading (ELF, ppc64-linux) %s (%ld entries) ---\n",
                 tab_name, symtab_szB/sizeof(ElfXX_Sym) );
 
    oset = VG_(OSetGen_Create)( offsetof(TempSym,key), 
@@ -702,21 +704,21 @@
 
             if (modify_size && di->trace_symtab) {
                VG_(printf)("    modify (old sz %4d)    "
-                           " val %010p, toc %010p, sz %4d  %s\n",
+                           " val %#010lx, toc %#010lx, sz %4d  %s\n",
                            old_size,
-                           (void*) prev->key.addr, 
-                           (void*) prev->tocptr,
+                           prev->key.addr,
+                           prev->tocptr,
                            (Int)   prev->size, 
                            (HChar*)prev->key.name
                );
             }
             if (modify_tocptr && di->trace_symtab) {
                VG_(printf)("    modify (upd tocptr)     "
-                           " val %010p, toc %010p, sz %4d  %s\n",
-                            (void*) prev->key.addr, 
-                            (void*) prev->tocptr, 
-                            (Int)   prev->size, 
-                            (HChar*)prev->key.name
+                           " val %#010lx, toc %#010lx, sz %4d  %s\n",
+                           prev->key.addr,
+                           prev->tocptr,
+                           (Int)   prev->size,
+                           (HChar*)prev->key.name
                );
             }
 
@@ -732,12 +734,13 @@
             elem->is_text  = is_text;
             VG_(OSetGen_Insert)(oset, elem);
             if (di->trace_symtab) {
-               VG_(printf)("   to-oset [%4d]:          "
-                           "  val %010p, toc %010p, sz %4d  %s\n",
-                           i, (void*) elem->key.addr,
-                              (void*) elem->tocptr,
-                              (Int)   elem->size, 
-                              (HChar*)elem->key.name
+               VG_(printf)("   to-oset [%4ld]:          "
+                           "  val %#010lx, toc %#010lx, sz %4d  %s\n",
+                           i,
+                           elem->key.addr,
+                           elem->tocptr,
+                           (Int)   elem->size,
+                           (HChar*)elem->key.name
                );
             }
 
@@ -761,13 +764,14 @@
 
       ML_(addSym) ( di, &risym );
       if (di->trace_symtab) {
-         VG_(printf)("    rec(%c) [%4d]:          "
-                     "   val %010p, toc %010p, sz %4d  %s\n",
+         VG_(printf)("    rec(%c) [%4ld]:          "
+                     "   val %#010lx, toc %#010lx, sz %4d  %s\n",
                      risym.isText ? 't' : 'd',
-                     i, (void*) risym.addr,
-                        (void*) risym.tocptr,
-                        (Int)   risym.size, 
-                        (HChar*)risym.name
+                     i,
+                     risym.addr,
+                     risym.tocptr,
+                     (Int)   risym.size,
+                     (HChar*)risym.name
                );
       }
       i++;
@@ -1066,7 +1070,7 @@
 
    oimage = (Addr)NULL;
    if (VG_(clo_verbosity) > 1 || VG_(clo_trace_redir))
-      VG_(message)(Vg_DebugMsg, "Reading syms from %s (%p)", 
+      VG_(message)(Vg_DebugMsg, "Reading syms from %s (%#lx)",
                                 di->filename, di->rx_map_avma );
 
    /* mmap the object image aboard, so that we can read symbols and
@@ -1186,8 +1190,9 @@
 
          /* Make sure the PT_LOADable entries are in order */
          if (phdr->p_type == PT_LOAD) {
-            TRACE_SYMTAB("PT_LOAD in order?: %p %p\n",
-                         prev_svma, phdr->p_vaddr);
+            TRACE_SYMTAB("PT_LOAD in order?: %#lx %#lx\n",
+                         prev_svma + 0UL,
+                         phdr->p_vaddr + 0UL);
             if (phdr->p_vaddr < prev_svma) {
                ML_(symerr)(di, True,
                            "ELF Program Headers are not in ascending order");
@@ -1258,10 +1263,10 @@
    TRACE_SYMTAB("\n");
    TRACE_SYMTAB("------ Examining the section headers "
                 "and program headers ------\n");
-   TRACE_SYMTAB("rx: at %p are mapped foffsets %ld .. %ld\n",
+   TRACE_SYMTAB("rx: at %#lx are mapped foffsets %ld .. %ld\n",
                di->rx_map_avma,
                di->rx_map_foff, di->rx_map_foff + di->rx_map_size - 1 );
-   TRACE_SYMTAB("rw: at %p are mapped foffsets %ld .. %ld\n",
+   TRACE_SYMTAB("rw: at %#lx are mapped foffsets %ld .. %ld\n",
                di->rw_map_avma,
                di->rw_map_foff, di->rw_map_foff + di->rw_map_size - 1 );
 
@@ -1315,13 +1320,13 @@
             di->text_avma = di->rx_map_avma + foff - di->rx_map_foff;
             di->text_size = size;
             di->text_bias = di->text_avma - svma;
-            TRACE_SYMTAB("acquiring .text svma = %p .. %p\n",
+            TRACE_SYMTAB("acquiring .text svma = %#lx .. %#lx\n",
                          di->text_svma, 
                          di->text_svma + di->text_size - 1);
-            TRACE_SYMTAB("acquiring .text avma = %p .. %p\n",
+            TRACE_SYMTAB("acquiring .text avma = %#lx .. %#lx\n",
                          di->text_avma, 
                          di->text_avma + di->text_size - 1);
-            TRACE_SYMTAB("acquiring .text bias = %p\n", di->text_bias);
+            TRACE_SYMTAB("acquiring .text bias = %#lx\n", di->text_bias);
          } else {
             BAD(".text");
          }
@@ -1337,13 +1342,13 @@
             di->data_avma = di->rw_map_avma + foff - di->rw_map_foff;
             di->data_size = size;
             di->data_bias = di->data_avma - svma;
-            TRACE_SYMTAB("acquiring .data svma = %p .. %p\n", 
+            TRACE_SYMTAB("acquiring .data svma = %#lx .. %#lx\n",
                          di->data_svma,
                          di->data_svma + di->data_size - 1);
-            TRACE_SYMTAB("acquiring .data avma = %p .. %p\n", 
+            TRACE_SYMTAB("acquiring .data avma = %#lx .. %#lx\n",
                          di->data_avma,
                          di->data_avma + di->data_size - 1);
-            TRACE_SYMTAB("acquiring .data bias = %p\n", di->data_bias);
+            TRACE_SYMTAB("acquiring .data bias = %#lx\n", di->data_bias);
          } else {
             BAD(".data");
          }
@@ -1359,13 +1364,13 @@
             di->sdata_avma = di->rw_map_avma + foff - di->rw_map_foff;
             di->sdata_size = size;
             di->sdata_bias = di->sdata_avma - svma;
-            TRACE_SYMTAB("acquiring .sdata svma = %p .. %p\n", 
+            TRACE_SYMTAB("acquiring .sdata svma = %#lx .. %#lx\n",
                          di->sdata_svma,
                          di->sdata_svma + di->sdata_size - 1);
-            TRACE_SYMTAB("acquiring .sdata avma = %p .. %p\n", 
+            TRACE_SYMTAB("acquiring .sdata avma = %#lx .. %#lx\n",
                          di->sdata_avma,
                          di->sdata_avma + di->sdata_size - 1);
-            TRACE_SYMTAB("acquiring .sdata bias = %p\n", di->sdata_bias);
+            TRACE_SYMTAB("acquiring .sdata bias = %#lx\n", di->sdata_bias);
          } else {
             BAD(".sdata");
          }
@@ -1385,13 +1390,13 @@
             di->bss_size = size;
             di->bss_bias = di->bss_avma - svma;
             bss_align = alyn;
-            TRACE_SYMTAB("acquiring .bss svma = %p .. %p\n", 
+            TRACE_SYMTAB("acquiring .bss svma = %#lx .. %#lx\n",
                          di->bss_svma,
                          di->bss_svma + di->bss_size - 1);
-            TRACE_SYMTAB("acquiring .bss avma = %p .. %p\n", 
+            TRACE_SYMTAB("acquiring .bss avma = %#lx .. %#lx\n",
                          di->bss_avma,
                          di->bss_avma + di->bss_size - 1);
-            TRACE_SYMTAB("acquiring .bss bias = %p\n", di->bss_bias);
+            TRACE_SYMTAB("acquiring .bss bias = %#lx\n", di->bss_bias);
          } else
 
          /* Now one from the wtf?! department ... */
@@ -1462,7 +1467,7 @@
             di->got_present = True;
             di->got_avma = di->rw_map_avma + foff - di->rw_map_foff;
             di->got_size = size;
-            TRACE_SYMTAB("acquiring .got avma = %p\n", di->got_avma);
+            TRACE_SYMTAB("acquiring .got avma = %#lx\n", di->got_avma);
          } else {
             BAD(".got");
          }
@@ -1474,7 +1479,7 @@
             di->gotplt_present = True;
             di->gotplt_avma = di->rw_map_avma + foff - di->rw_map_foff;
             di->gotplt_size = size;
-            TRACE_SYMTAB("acquiring .got.plt avma = %p\n", di->gotplt_avma);
+            TRACE_SYMTAB("acquiring .got.plt avma = %#lx\n", di->gotplt_avma);
          } else if (size != 0) {
             BAD(".got.plt");
          }
@@ -1488,7 +1493,7 @@
             di->plt_present = True;
             di->plt_avma = di->rx_map_avma + foff - di->rx_map_foff;
             di->plt_size = size;
-            TRACE_SYMTAB("acquiring .plt avma = %p\n", di->plt_avma);
+            TRACE_SYMTAB("acquiring .plt avma = %#lx\n", di->plt_avma);
          } else {
             BAD(".plt");
          }
@@ -1500,7 +1505,7 @@
             di->plt_present = True;
             di->plt_avma = di->rw_map_avma + foff - di->rw_map_foff;
             di->plt_size = size;
-            TRACE_SYMTAB("acquiring .plt avma = %p\n", di->plt_avma);
+            TRACE_SYMTAB("acquiring .plt avma = %#lx\n", di->plt_avma);
          } else {
             BAD(".plt");
          }
@@ -1512,7 +1517,7 @@
             di->plt_present = True;
             di->plt_avma = di->rw_map_avma + foff - di->rw_map_foff;
             di->plt_size = size;
-            TRACE_SYMTAB("acquiring .plt avma = %p\n", di->plt_avma);
+            TRACE_SYMTAB("acquiring .plt avma = %#lx\n", di->plt_avma);
          } else 
          if ((!inrw) && (!inrx) && size > 0 && !di->plt_present) {
             /* File contains a .plt, but it didn't get mapped.
@@ -1535,7 +1540,7 @@
             di->opd_present = True;
             di->opd_avma = di->rw_map_avma + foff - di->rw_map_foff;
             di->opd_size = size;
-            TRACE_SYMTAB("acquiring .opd avma = %p\n", di->opd_avma);
+            TRACE_SYMTAB("acquiring .opd avma = %#lx\n", di->opd_avma);
          } else {
             BAD(".opd");
          }
@@ -1549,13 +1554,13 @@
             di->ehframe_present = True;
             di->ehframe_avma = di->rx_map_avma + foff - di->rx_map_foff;
             di->ehframe_size = size;
-            TRACE_SYMTAB("acquiring .eh_frame avma = %p\n", di->ehframe_avma);
+            TRACE_SYMTAB("acquiring .eh_frame avma = %#lx\n", di->ehframe_avma);
          } else
          if (inrw && size > 0 && !di->ehframe_present) {
             di->ehframe_present = True;
             di->ehframe_avma = di->rw_map_avma + foff - di->rw_map_foff;
             di->ehframe_size = size;
-            TRACE_SYMTAB("acquiring .eh_frame avma = %p\n", di->ehframe_avma);
+            TRACE_SYMTAB("acquiring .eh_frame avma = %#lx\n", di->ehframe_avma);
          } else {
             BAD(".eh_frame");
          }
@@ -1576,18 +1581,18 @@
       di->bss_size = bss_totsize;
       di->bss_avma = di->data_avma + (di->bss_svma - di->data_svma);
       di->bss_bias = di->data_bias;
-      TRACE_SYMTAB("kludged .bss svma = %p .. %p\n", 
+      TRACE_SYMTAB("kludged .bss svma = %#lx .. %#lx\n",
                    di->bss_svma, di->bss_svma + di->bss_size - 1);
-      TRACE_SYMTAB("kludged .bss avma = %p .. %p\n",
+      TRACE_SYMTAB("kludged .bss avma = %#lx .. %#lx\n",
                    di->bss_avma, di->bss_avma + di->bss_size - 1);
-      TRACE_SYMTAB("kludged .bss bias = %p\n", di->bss_bias);
+      TRACE_SYMTAB("kludged .bss bias = %#lx\n", di->bss_bias);
    }
 
-   if (0) VG_(printf)("YYYY text_: avma %p  size %ld  bias %p\n", 
+   if (0) VG_(printf)("YYYY text_: avma %#lx  size %ld  bias %#lx\n",
                       di->text_avma, di->text_size, di->text_bias);
 
    if (VG_(clo_verbosity) > 2 || VG_(clo_trace_redir))
-      VG_(message)(Vg_DebugMsg, "   svma %010p, avma %010p", 
+      VG_(message)(Vg_DebugMsg, "   svma %#010lx, avma %#010lx",
                                 di->text_avma - di->text_bias,
                                 di->text_avma );
 
diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c
index 8edf1b4..173b15e 100644
--- a/coregrind/m_debuginfo/storage.c
+++ b/coregrind/m_debuginfo/storage.c
@@ -89,7 +89,7 @@
 /* Print a symbol. */
 void ML_(ppSym) ( Int idx, DiSym* sym )
 {
-  VG_(printf)( "%5d:  %8p .. %8p (%d)      %s\n",
+  VG_(printf)( "%5d:  %#8lx .. %#8lx (%d)      %s\n",
                idx,
                sym->addr, 
                sym->addr + sym->size - 1, sym->size,
@@ -122,7 +122,7 @@
          }                                       \
       } while (0)
 
-   VG_(printf)("[%p .. %p]: ", si->base, 
+   VG_(printf)("[%#lx .. %#lx]: ", si->base,
                                si->base + (UWord)si->len - 1);
    switch (si->cfa_how) {
       case CFIC_SPREL: 
@@ -275,7 +275,7 @@
    if (this == next) return;
 
    if (debug)
-      VG_(printf)( "  src %s %s line %d %p-%p\n",
+      VG_(printf)( "  src %s %s line %d %#lx-%#lx\n",
                    dirname ? dirname : (UChar*)"(unknown)",
                    filename, lineno, this, next );
 
@@ -290,7 +290,7 @@
        if (VG_(clo_verbosity) > 2) {
            VG_(message)(Vg_DebugMsg, 
                         "warning: line info addresses out of order "
-                        "at entry %d: 0x%x 0x%x", entry, this, next);
+                        "at entry %d: 0x%lx 0x%lx", entry, this, next);
        }
        size = 1;
    }
@@ -312,7 +312,7 @@
        if (0)
           VG_(message)(Vg_DebugMsg, 
                        "warning: ignoring line info entry falling "
-                       "outside current DebugInfo: %p %p %p %p",
+                       "outside current DebugInfo: %#lx %#lx %#lx %#lx",
                        di->text_avma, 
                        di->text_avma + di->text_size, 
                        this, next-1);
@@ -343,7 +343,7 @@
    loc.dirname   = dirname;
 
    if (0) VG_(message)(Vg_DebugMsg, 
-		       "addLoc: addr %p, size %d, line %d, file %s",
+		       "addLoc: addr %#lx, size %d, line %d, file %s",
 		       this,size,lineno,filename);
 
    addLoc ( di, &loc );
@@ -383,7 +383,7 @@
          if (VG_(clo_verbosity) > 1) {
             VG_(message)(
                Vg_DebugMsg,
-               "warning: DiCfSI %p .. %p outside segment %p .. %p",
+               "warning: DiCfSI %#lx .. %#lx outside segment %#lx .. %#lx",
                cfsi->base, 
                cfsi->base + cfsi->len - 1,
                di->text_avma,
@@ -531,7 +531,7 @@
    const Addr* key = (const Addr*)keyV;
    const DiAddrRange* elem = (const DiAddrRange*)elemV;
    if (0)
-      VG_(printf)("cmp_for_DiAddrRange_range: %p vs %p\n",
+      VG_(printf)("cmp_for_DiAddrRange_range: %#lx vs %#lx\n",
                   *key, elem->aMin);
    if ((*key) < elem->aMin) return -1;
    if ((*key) > elem->aMax) return 1;
@@ -547,7 +547,7 @@
    while (True) {
       range = VG_(OSetGen_Next)( scope );
       if (!range) break;
-      VG_(printf)("   %p .. %p: %lu vars\n", range->aMin, range->aMax,
+      VG_(printf)("   %#lx .. %#lx: %lu vars\n", range->aMin, range->aMax,
                   range->vars ? VG_(sizeXA)(range->vars) : 0);
    }
    VG_(printf)("}\n");
@@ -574,7 +574,7 @@
 
    vg_assert(aMin <= aMax);
 
-   if (0) VG_(printf)("add_var_to_arange: %p .. %p\n", aMin, aMax);
+   if (0) VG_(printf)("add_var_to_arange: %#lx .. %#lx\n", aMin, aMax);
    if (0) show_scope( scope, "add_var_to_arange(1)" );
 
    /* See if the lower end of the range (aMin) falls exactly on an
@@ -680,7 +680,7 @@
       if (!range) break;
       if (range->aMin > aMax) break;
       xxIters++;
-      if (0) VG_(printf)("have range %p %p\n", 
+      if (0) VG_(printf)("have range %#lx %#lx\n",
                          range->aMin, range->aMax);
 
       /* Sanity checks */
@@ -724,7 +724,7 @@
    Bool       all;
 
    if (0) {
-      VG_(printf)("  ML_(addVar): level %d  %p-%p  %s :: ",
+      VG_(printf)("  ML_(addVar): level %d  %#lx-%#lx  %s :: ",
                   level, aMin, aMax, name );
       ML_(pp_Type_C_ishly)( type );
       VG_(printf)("\n  Var=");
@@ -767,8 +767,8 @@
            || aMin >= di->rx_map_avma + di->rx_map_size)) {
       if (VG_(clo_verbosity) >= 0) {
          VG_(message)(Vg_DebugMsg, 
-            "warning: addVar: in range %p .. %p outside "
-            "segment %p .. %p (%s)",
+            "warning: addVar: in range %#lx .. %#lx outside "
+            "segment %#lx .. %#lx (%s)",
             aMin, aMax,
             di->text_avma, di->text_avma + di->text_size -1,
             name
@@ -1023,12 +1023,12 @@
    vg_assert(0);
   out:
    if (preferA && !preferB) {
-      TRACE_SYMTAB("sym at %p: prefer '%s' to '%s'\n",
+      TRACE_SYMTAB("sym at %#lx: prefer '%s' to '%s'\n",
                    a->addr, a->name, b->name );
       return a;
    }
    if (preferB && !preferA) {
-      TRACE_SYMTAB("sym at %p: prefer '%s' to '%s'\n",
+      TRACE_SYMTAB("sym at %#lx: prefer '%s' to '%s'\n",
                    b->addr, b->name, a->name );
       return b;
    }
@@ -1273,7 +1273,7 @@
    }
 
    if (di->trace_cfi)
-      VG_(printf)("canonicaliseCfiSI: %d entries, %p .. %p\n", 
+      VG_(printf)("canonicaliseCfiSI: %d entries, %#lx .. %#lx\n",
                   di->cfsi_used,
 	          di->cfsi_minavma, di->cfsi_maxavma);
 
diff --git a/coregrind/m_debuginfo/tytypes.c b/coregrind/m_debuginfo/tytypes.c
index e43e0c1..73a7212 100644
--- a/coregrind/m_debuginfo/tytypes.c
+++ b/coregrind/m_debuginfo/tytypes.c
@@ -160,7 +160,7 @@
    VG_(printf)("{");
    for (i = 0; i < VG_(sizeXA)(xa); i++) {
       void* ptr = *(void**) VG_(indexXA)(xa, i);
-      VG_(printf)("0x%05lx", ptr);
+      VG_(printf)("0x%05lx", (unsigned long)(ptr));
       if (i+1 < VG_(sizeXA)(xa))
          VG_(printf)(",");
    }
@@ -174,7 +174,7 @@
 }
 void ML_(pp_TyField) ( TyField* field ) {
    VG_(printf)("TyField(0x%05lx,%p,\"%s\")",
-               field->typeR, field->loc,
+               (unsigned long)(field->typeR), field->loc,
                field->name ? field->name : (UChar*)"");
 }
 void ML_(pp_TyBounds) ( TyBounds* bounds ) {
@@ -221,9 +221,9 @@
          break;
       case Ty_PorR:
          VG_(printf)("Ty_PorR(%d,%c,0x%05lx)",
-                     ty->Ty.PorR.szB, 
+                     ty->Ty.PorR.szB,
                      ty->Ty.PorR.isPtr ? 'P' : 'R',
-                     ty->Ty.PorR.typeR);
+                     (unsigned long)(ty->Ty.PorR.typeR));
          break;
       case Ty_Enum:
          VG_(printf)("Ty_Enum(%d,%p,\"%s\")",
@@ -235,7 +235,7 @@
          break;
       case Ty_StOrUn:
          if (ty->Ty.StOrUn.complete) {
-            VG_(printf)("Ty_StOrUn(%d,%c,%p,\"%s\")",
+            VG_(printf)("Ty_StOrUn(%ld,%c,%p,\"%s\")",
                         ty->Ty.StOrUn.szB, 
                         ty->Ty.StOrUn.isStruct ? 'S' : 'U',
                         ty->Ty.StOrUn.fields,
@@ -250,13 +250,13 @@
          break;
       case Ty_Array:
          VG_(printf)("Ty_Array(0x%05lx,%p)",
-                     ty->Ty.Array.typeR, ty->Ty.Array.bounds);
+                     (unsigned long)(ty->Ty.Array.typeR), ty->Ty.Array.bounds);
          if (ty->Ty.Array.bounds)
             pp_XArray_of_pointersOrRefs( ty->Ty.Array.bounds );
          break;
       case Ty_TyDef:
          VG_(printf)("Ty_TyDef(0x%05lx,\"%s\")",
-                     ty->Ty.TyDef.typeR,
+                     (unsigned long)(ty->Ty.TyDef.typeR),
                      ty->Ty.TyDef.name ? ty->Ty.TyDef.name
                                          : (UChar*)"" );
          break;
@@ -265,7 +265,7 @@
          break;
       case Ty_Qual:
          VG_(printf)("Ty_Qual(%c,0x%05lx)", ty->Ty.Qual.qual,
-                     ty->Ty.Qual.typeR);
+                     (unsigned long)(ty->Ty.Qual.typeR));
          break;
       case Ty_Void:
          VG_(printf)("Ty_Void%s",
diff --git a/coregrind/m_debuglog.c b/coregrind/m_debuglog.c
index 93ea987..5efb1b7 100644
--- a/coregrind/m_debuglog.c
+++ b/coregrind/m_debuglog.c
@@ -446,7 +446,7 @@
 #define VG_MSG_LJUSTIFY  4 /* Must justify on the left. */
 #define VG_MSG_PAREN     8 /* Parenthesize if present (for %y) */
 #define VG_MSG_COMMA    16 /* Add commas to numbers (for %d, %u) */
-
+#define VG_MSG_ALTFORMAT 32 /* Convert the value to alternate format */
 
 /* Copy a string into the buffer. */
 static 
@@ -647,25 +647,34 @@
       flags = 0;
       n_ls  = 0;
       width = 0; /* length of the field. */
-      if (format[i] == '(') {
-         flags |= VG_MSG_PAREN;
+      while (1) {
+         switch (format[i]) {
+         case '(':
+            flags |= VG_MSG_PAREN;
+            break;
+         case ',':
+         case '\'':
+            /* If ',' or '\'' follows '%', commas will be inserted. */
+            flags |= VG_MSG_COMMA;
+            break;
+         case '-':
+            /* If '-' follows '%', justify on the left. */
+            flags |= VG_MSG_LJUSTIFY;
+            break;
+         case '0':
+            /* If '0' follows '%', pads will be inserted. */
+            flags |= VG_MSG_ZJUSTIFY;
+            break;
+         case '#':
+            /* If '#' follows '%', alternative format will be used. */
+            flags |= VG_MSG_ALTFORMAT;
+            break;
+         default:
+            goto parse_fieldwidth;
+         }
          i++;
       }
-      /* If ',' follows '%', commas will be inserted. */
-      if (format[i] == ',') {
-         flags |= VG_MSG_COMMA;
-         i++;
-      }
-      /* If '-' follows '%', justify on the left. */
-      if (format[i] == '-') {
-         flags |= VG_MSG_LJUSTIFY;
-         i++;
-      }
-      /* If '0' follows '%', pads will be inserted. */
-      if (format[i] == '0') {
-         flags |= VG_MSG_ZJUSTIFY;
-         i++;
-      }
+     parse_fieldwidth:
       /* Compute the field length. */
       while (format[i] >= '0' && format[i] <= '9') {
          width *= 10;
@@ -711,6 +720,11 @@
          case 'x': /* %x */
          case 'X': /* %X */
             caps = toBool(format[i] == 'X');
+            if (flags & VG_MSG_ALTFORMAT) {
+               ret += 2;
+               send('0',send_arg2);
+               send('x',send_arg2);
+            }
             if (is_long)
                ret += myvprintf_int64(send, send_arg2, flags, 16, width, caps,
                                       (ULong)(va_arg (vargs, ULong)));
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c
index 9a71a09..475e008 100644
--- a/coregrind/m_errormgr.c
+++ b/coregrind/m_errormgr.c
@@ -709,12 +709,12 @@
          continue;
       any_supp = True;
       if (VG_(clo_xml)) {
-         VG_(message)(Vg_DebugMsg, 
-                      "  <pair>\n"
-                      "    <count>%d</count>\n"
-                      "    <name>%t</name>\n"
-                      "  </pair>", 
-                      su->count, su->sname);
+         VG_(message_no_f_c)(Vg_DebugMsg,
+                             "  <pair>\n"
+                             "    <count>%d</count>\n"
+                             "    <name>%t</name>\n"
+                             "  </pair>",
+                             su->count, su->sname);
       } else {
          VG_(message)(Vg_DebugMsg, "supp: %6d %s", su->count, su->sname);
       }
@@ -1221,11 +1221,11 @@
 void VG_(print_errormgr_stats) ( void )
 {
    VG_(message)(Vg_DebugMsg, 
-      " errormgr: %,lu supplist searches, %,lu comparisons during search",
+      " errormgr: %'lu supplist searches, %'lu comparisons during search",
       em_supplist_searches, em_supplist_cmps
    );
    VG_(message)(Vg_DebugMsg, 
-      " errormgr: %,lu errlist searches, %,lu comparisons during search",
+      " errormgr: %'lu errlist searches, %'lu comparisons during search",
       em_errlist_searches, em_errlist_cmps
    );
 }
diff --git a/coregrind/m_execontext.c b/coregrind/m_execontext.c
index b52cbfc..c701820 100644
--- a/coregrind/m_execontext.c
+++ b/coregrind/m_execontext.c
@@ -149,18 +149,18 @@
 {
    init_ExeContext_storage();
    VG_(message)(Vg_DebugMsg, 
-      "   exectx: %,lu lists, %,llu contexts (avg %,llu per list)",
+      "   exectx: %'lu lists, %'llu contexts (avg %'llu per list)",
       ec_htab_size, ec_totstored, ec_totstored / ec_htab_size
    );
    VG_(message)(Vg_DebugMsg, 
-      "   exectx: %,llu searches, %,llu full compares (%,llu per 1000)",
+      "   exectx: %'llu searches, %'llu full compares (%'llu per 1000)",
       ec_searchreqs, ec_searchcmps, 
       ec_searchreqs == 0 
          ? 0L 
          : ( (ec_searchcmps * 1000) / ec_searchreqs ) 
    );
    VG_(message)(Vg_DebugMsg, 
-      "   exectx: %,llu cmp2, %,llu cmp4, %,llu cmpAll",
+      "   exectx: %'llu cmp2, %'llu cmp4, %'llu cmpAll",
       ec_cmp2s, ec_cmp4s, ec_cmpAlls 
    );
 }
diff --git a/coregrind/m_initimg/initimg-linux.c b/coregrind/m_initimg/initimg-linux.c
index bad4941..a97bea9 100644
--- a/coregrind/m_initimg/initimg-linux.c
+++ b/coregrind/m_initimg/initimg-linux.c
@@ -568,7 +568,7 @@
 #    endif
 
      if (0)
-        VG_(printf)("%p 0x%x  %p 0x%x\n", 
+        VG_(printf)("%#lx 0x%lx  %#lx 0x%lx\n",
                     resvn_start, resvn_size, anon_start, anon_size);
 
      /* Create a shrinkable reservation followed by an anonymous
@@ -762,7 +762,7 @@
 
    /* client_SP is pointing at client's argc/argv */
 
-   if (0) VG_(printf)("startup SP = %p\n", client_SP);
+   if (0) VG_(printf)("startup SP = %#lx\n", client_SP);
    return client_SP;
 }
 
diff --git a/coregrind/m_libcprint.c b/coregrind/m_libcprint.c
index 487d11d..58e56c3 100644
--- a/coregrind/m_libcprint.c
+++ b/coregrind/m_libcprint.c
@@ -365,6 +365,17 @@
    return count;
 }
 
+/* Send a simple single-part XML message. */
+UInt VG_(message_no_f_c) ( VgMsgKind kind, const HChar* format, ... )
+{
+   UInt count;
+   va_list vargs;
+   va_start(vargs,format);
+   count = VG_(vmessage) ( kind, format, vargs );
+   va_end(vargs);
+   return count;
+}
+
 /* Send a simple single-part message. */
 UInt VG_(message) ( VgMsgKind kind, const HChar* format, ... )
 {
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index e637f7a..9773b47 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -747,9 +747,10 @@
                   i++;
                }
 
-	       VG_(message)(Vg_UserMsg, "<logfilequalifier> <var>%t</var> "
-			    "<value>%t</value> </logfilequalifier>",
-			    qualname,qual);
+	       VG_(message_no_f_c)(Vg_UserMsg,
+                                   "<logfilequalifier> <var>%t</var> "
+                                   "<value>%t</value> </logfilequalifier>",
+                                   qualname,qual);
 	       format[i] = '}';
 	       i++;
 	    }
@@ -853,7 +854,7 @@
       VG_(message)(Vg_UserMsg, "");
       VG_(message)(Vg_UserMsg, "<pid>%d</pid>", VG_(getpid)());
       VG_(message)(Vg_UserMsg, "<ppid>%d</ppid>", VG_(getppid)());
-      VG_(message)(Vg_UserMsg, "<tool>%t</tool>", toolname);
+      VG_(message_no_f_c)(Vg_UserMsg, "<tool>%t</tool>", toolname);
       if (VG_(clo_log_name))
          print_file_vars(VG_(clo_log_name));
       if (VG_(clo_xml_user_comment)) {
@@ -868,26 +869,26 @@
 
       VG_(message)(Vg_UserMsg, "  <vargv>");
       if (VG_(name_of_launcher))
-         VG_(message)(Vg_UserMsg, "    <exe>%t</exe>", 
-                                  VG_(name_of_launcher));
+         VG_(message_no_f_c)(Vg_UserMsg, "    <exe>%t</exe>",
+                             VG_(name_of_launcher));
       else
-         VG_(message)(Vg_UserMsg, "    <exe>%t</exe>",
-                                  "(launcher name unknown)");
+         VG_(message_no_f_c)(Vg_UserMsg, "    <exe>%t</exe>",
+                             "(launcher name unknown)");
       for (i = 0; i < VG_(sizeXA)( VG_(args_for_valgrind) ); i++) {
-         VG_(message)(Vg_UserMsg, 
-                      "    <arg>%t</arg>", 
-                      * (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i ));
+         VG_(message_no_f_c)(Vg_UserMsg,
+                             "    <arg>%t</arg>",
+                             * (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i ));
       }
       VG_(message)(Vg_UserMsg, "  </vargv>");
 
       VG_(message)(Vg_UserMsg, "  <argv>");
       if (VG_(args_the_exename))
-         VG_(message)(Vg_UserMsg, "    <exe>%t</exe>", 
-                                  VG_(args_the_exename));
+         VG_(message_no_f_c)(Vg_UserMsg, "    <exe>%t</exe>",
+                             VG_(args_the_exename));
       for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
-         VG_(message)(Vg_UserMsg,
-                      "    <arg>%t</arg>", 
-                      * (HChar**) VG_(indexXA)( VG_(args_for_client), i ));
+         VG_(message_no_f_c)(Vg_UserMsg,
+                             "    <arg>%t</arg>",
+                             * (HChar**) VG_(indexXA)( VG_(args_for_client), i ));
       }
       VG_(message)(Vg_UserMsg, "  </argv>");
 
@@ -1934,11 +1935,12 @@
    if (VG_(clo_xml)) {
       HChar buf[50];
       VG_(elapsed_wallclock_time)(buf);
-      VG_(message)(Vg_UserMsg, "<status>\n"
-                               "  <state>RUNNING</state>\n"
-                               "  <time>%t</time>\n"
-                               "</status>", 
-                               buf);
+      VG_(message_no_f_c)(Vg_UserMsg,
+                          "<status>\n"
+                          "  <state>RUNNING</state>\n"
+                          "  <time>%t</time>\n"
+                          "</status>",
+                          buf);
       VG_(message)(Vg_UserMsg, "");
    }
 
@@ -2045,11 +2047,12 @@
          VG_(message)(Vg_UserMsg, "");
       }
       VG_(elapsed_wallclock_time)(buf);
-      VG_(message)(Vg_UserMsg, "<status>\n"
-                               "  <state>FINISHED</state>\n"
-                               "  <time>%t</time>\n"
-                               "</status>", 
-                               buf);
+      VG_(message_no_f_c)(Vg_UserMsg,
+                          "<status>\n"
+                          "  <state>FINISHED</state>\n"
+                          "  <time>%t</time>\n"
+                          "</status>",
+                          buf);
       VG_(message)(Vg_UserMsg, "");
    }
 
diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c
index 3ac2a62..66f64c5 100644
--- a/coregrind/m_mallocfree.c
+++ b/coregrind/m_mallocfree.c
@@ -442,7 +442,7 @@
    for (i = 0; i < VG_N_ARENAS; i++) {
       Arena* a = arenaId_to_ArenaP(i);
       VG_(message)(Vg_DebugMsg,
-         "%8s: %8d mmap'd, %8d/%8d max/curr",
+         "%8s: %8ld mmap'd, %8ld/%8ld max/curr",
          a->name, a->bytes_mmaped, a->bytes_on_loan_max, a->bytes_on_loan 
       );
    }
@@ -982,7 +982,7 @@
    if (VG_(clo_verbosity) > 2) 
       VG_(message)(Vg_DebugMsg,
                    "%8s: %2d sbs, %5d bs, %2d/%-2d free bs, "
-                   "%7d mmap, %7d loan", 
+                   "%7ld mmap, %7ld loan",
                    a->name,
                    superblockctr,
                    blockctr_sb, blockctr_sb_free, blockctr_li, 
diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c
index 6cc9571..6d6e593 100644
--- a/coregrind/m_scheduler/scheduler.c
+++ b/coregrind/m_scheduler/scheduler.c
@@ -125,9 +125,9 @@
 void VG_(print_scheduler_stats)(void)
 {
    VG_(message)(Vg_DebugMsg,
-      "scheduler: %,llu jumps (bb entries).", bbs_done );
+      "scheduler: %'llu jumps (bb entries).", bbs_done );
    VG_(message)(Vg_DebugMsg,
-      "scheduler: %,llu/%,llu major/minor sched events.", 
+      "scheduler: %'llu/%'llu major/minor sched events.",
       n_scheduling_events_MAJOR, n_scheduling_events_MINOR);
    VG_(message)(Vg_DebugMsg, 
                 "   sanity: %d cheap, %d expensive checks.",
@@ -1105,7 +1105,7 @@
 
       case VEX_TRC_JMP_NODECODE:
    VG_(message)(Vg_UserMsg,
-      "valgrind: Unrecognised instruction at address %p.", VG_(get_IP)(tid));
+      "valgrind: Unrecognised instruction at address %#lx.", VG_(get_IP)(tid));
 #define M(a) VG_(message)(Vg_UserMsg, a);
    M("Your program just tried to execute an instruction that Valgrind" );
    M("did not recognise.  There are two possible reasons for this."    );
@@ -1424,7 +1424,7 @@
                if (c1 == 0) c1 = '_';
                if (c2 == 0) c2 = '_';
 	       VG_(message)(Vg_UserMsg, "Warning:\n"
-                   "  unhandled client request: 0x%x (%c%c+0x%x).  Perhaps\n" 
+                   "  unhandled client request: 0x%lx (%c%c+0x%lx).  Perhaps\n"
 		   "  VG_(needs).client_requests should be set?",
 			    arg[0], c1, c2, arg[0] & 0xffff);
 	       whined = True;
@@ -1543,7 +1543,7 @@
             = VG_(am_get_VgStack_unused_szB)(stack);
 	 if (remains < VKI_PAGE_SIZE)
 	    VG_(message)(Vg_DebugMsg, 
-                         "WARNING: Thread %d is within %d bytes "
+                         "WARNING: Thread %d is within %ld bytes "
                          "of running out of stack!",
 		         tid, remains);
       }
diff --git a/coregrind/m_sigframe/sigframe-amd64-linux.c b/coregrind/m_sigframe/sigframe-amd64-linux.c
index 0aed329..0b3610f 100644
--- a/coregrind/m_sigframe/sigframe-amd64-linux.c
+++ b/coregrind/m_sigframe/sigframe-amd64-linux.c
@@ -381,14 +381,14 @@
    if (VG_(extend_stack)(addr, tst->client_stack_szB)) {
       stackseg = VG_(am_find_nsegment)(addr);
       if (0 && stackseg)
-	 VG_(printf)("frame=%p seg=%p-%p\n",
+	 VG_(printf)("frame=%#lx seg=%#lx-%#lx\n",
 		     addr, stackseg->start, stackseg->end);
    }
 
    if (stackseg == NULL || !stackseg->hasR || !stackseg->hasW) {
       VG_(message)(
          Vg_UserMsg,
-         "Can't extend stack to %p during signal delivery for thread %d:",
+         "Can't extend stack to %#lx during signal delivery for thread %d:",
          addr, tid);
       if (stackseg == NULL)
          VG_(message)(Vg_UserMsg, "  no stack segment");
@@ -522,8 +522,8 @@
       caller to do. */
 
    if (0)
-      VG_(printf)("pushed signal frame; %%RSP now = %p, "
-                  "next %%RIP = %p, status=%d\n", 
+      VG_(printf)("pushed signal frame; %%RSP now = %#lx, "
+                  "next %%RIP = %#llx, status=%d\n",
 		  rsp, tst->arch.vex.guest_RIP, tst->status);
 }
 
@@ -624,7 +624,7 @@
    if (VG_(clo_trace_signals))
       VG_(message)(
          Vg_DebugMsg, 
-         "VG_(signal_return) (thread %d): isRT=%d valid magic; RIP=%p", 
+         "VG_(signal_return) (thread %d): isRT=%d valid magic; RIP=%#llx",
          tid, isRT, tst->arch.vex.guest_RIP);
 
    /* tell the tools */
diff --git a/coregrind/m_sigframe/sigframe-ppc32-linux.c b/coregrind/m_sigframe/sigframe-ppc32-linux.c
index 261a305..aed41d6 100644
--- a/coregrind/m_sigframe/sigframe-ppc32-linux.c
+++ b/coregrind/m_sigframe/sigframe-ppc32-linux.c
@@ -511,14 +511,14 @@
    if (VG_(extend_stack)(addr, tst->client_stack_szB)) {
       stackseg = VG_(am_find_nsegment)(addr);
       if (0 && stackseg)
-	 VG_(printf)("frame=%p seg=%p-%p\n",
+	 VG_(printf)("frame=%#lx seg=%#lx-%#lx\n",
 		     addr, stackseg->start, stackseg->end);
    }
 
    if (stackseg == NULL || !stackseg->hasR || !stackseg->hasW) {
       VG_(message)(
          Vg_UserMsg,
-         "Can't extend stack to %p during signal delivery for thread %d:",
+         "Can't extend stack to %#lx during signal delivery for thread %d:",
          addr, tid);
       if (stackseg == NULL)
          VG_(message)(Vg_UserMsg, "  no stack segment");
@@ -789,8 +789,8 @@
 //..       caller to do. */
 
    if (0)
-      VG_(printf)("pushed signal frame; %R1 now = %p, "
-                  "next %%CIA = %p, status=%d\n", 
+      VG_(printf)("pushed signal frame; %%R1 now = %#lx, "
+                  "next %%CIA = %#x, status=%d\n",
 		  sp, tst->arch.vex.guest_CIA, tst->status);
 }
 
@@ -940,7 +940,7 @@
 
    if (VG_(clo_trace_signals))
       VG_(message)(Vg_DebugMsg,
-                   "vg_pop_signal_frame (thread %d): isRT=%d valid magic; EIP=%p",
+                   "vg_pop_signal_frame (thread %d): isRT=%d valid magic; EIP=%#x",
                    tid, has_siginfo, tst->arch.vex.guest_CIA);
 
    /* tell the tools */
diff --git a/coregrind/m_sigframe/sigframe-ppc64-linux.c b/coregrind/m_sigframe/sigframe-ppc64-linux.c
index bf99e31..1fd055e 100644
--- a/coregrind/m_sigframe/sigframe-ppc64-linux.c
+++ b/coregrind/m_sigframe/sigframe-ppc64-linux.c
@@ -141,14 +141,14 @@
    if (VG_(extend_stack)(addr, tst->client_stack_szB)) {
       stackseg = VG_(am_find_nsegment)(addr);
       if (0 && stackseg)
-	 VG_(printf)("frame=%p seg=%p-%p\n",
+	 VG_(printf)("frame=%#lx seg=%#lx-%#lx\n",
 		     addr, stackseg->start, stackseg->end);
    }
 
    if (stackseg == NULL || !stackseg->hasR || !stackseg->hasW) {
       VG_(message)(
          Vg_UserMsg,
-         "Can't extend stack to %p during signal delivery for thread %d:",
+         "Can't extend stack to %#lx during signal delivery for thread %d:",
          addr, tid);
       if (stackseg == NULL)
          VG_(message)(Vg_UserMsg, "  no stack segment");
@@ -307,8 +307,8 @@
    priv->vex_shadow2   = tst->arch.vex_shadow2;
 
    if (0)
-      VG_(printf)("pushed signal frame; %R1 now = %p, "
-                  "next %%CIA = %p, status=%d\n", 
+      VG_(printf)("pushed signal frame; %%R1 now = %#lx, "
+                  "next %%CIA = %#llx, status=%d\n",
 		  sp, tst->arch.vex.guest_CIA, tst->status);
 }
 
@@ -375,7 +375,7 @@
 
    if (VG_(clo_trace_signals))
       VG_(message)(Vg_DebugMsg,
-                   "vg_pop_signal_frame (thread %d): isRT=%d valid magic; EIP=%p",
+                   "vg_pop_signal_frame (thread %d): isRT=%d valid magic; EIP=%#llx",
                    tid, has_siginfo, tst->arch.vex.guest_CIA);
 
    /* tell the tools */
diff --git a/coregrind/m_sigframe/sigframe-x86-linux.c b/coregrind/m_sigframe/sigframe-x86-linux.c
index 1fa345c..450a1c3 100644
--- a/coregrind/m_sigframe/sigframe-x86-linux.c
+++ b/coregrind/m_sigframe/sigframe-x86-linux.c
@@ -402,14 +402,14 @@
    if (VG_(extend_stack)(addr, tst->client_stack_szB)) {
       stackseg = VG_(am_find_nsegment)(addr);
       if (0 && stackseg)
-	 VG_(printf)("frame=%p seg=%p-%p\n",
+	 VG_(printf)("frame=%#lx seg=%#lx-%#lx\n",
 		     addr, stackseg->start, stackseg->end);
    }
 
    if (stackseg == NULL || !stackseg->hasR || !stackseg->hasW) {
       VG_(message)(
          Vg_UserMsg,
-         "Can't extend stack to %p during signal delivery for thread %d:",
+         "Can't extend stack to %#lx during signal delivery for thread %d:",
          addr, tid);
       if (stackseg == NULL)
          VG_(message)(Vg_UserMsg, "  no stack segment");
@@ -607,8 +607,8 @@
       caller to do. */
 
    if (0)
-      VG_(printf)("pushed signal frame; %%ESP now = %p, "
-                  "next %%EIP = %p, status=%d\n", 
+      VG_(printf)("pushed signal frame; %%ESP now = %#lx, "
+                  "next %%EIP = %#x, status=%d\n",
 		  esp, tst->arch.vex.guest_EIP, tst->status);
 }
 
@@ -715,7 +715,7 @@
    if (VG_(clo_trace_signals))
       VG_(message)(
          Vg_DebugMsg, 
-         "VG_(signal_return) (thread %d): isRT=%d valid magic; EIP=%p", 
+         "VG_(signal_return) (thread %d): isRT=%d valid magic; EIP=%#x",
          tid, isRT, tst->arch.vex.guest_EIP);
 
    /* tell the tools */
diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c
index dd9cd84..3e80492 100644
--- a/coregrind/m_signals.c
+++ b/coregrind/m_signals.c
@@ -658,8 +658,8 @@
 
       if (VG_(clo_trace_signals) && VG_(clo_verbosity) > 2)
          VG_(message)(Vg_DebugMsg, 
-            "setting ksig %d to: hdlr 0x%x, flags 0x%x, "
-            "mask(63..0) 0x%x 0x%x",
+            "setting ksig %d to: hdlr %p, flags 0x%lx, "
+            "mask(63..0) 0x%lx 0x%lx",
             sig, ksa.ksa_handler,
             ksa.sa_flags,
             ksa.sa_mask.sig[1], 
@@ -765,7 +765,7 @@
    if (VG_(clo_trace_signals))
       VG_(message)(Vg_DebugExtraMsg, 
          "sys_sigaction: sigNo %d, "
-         "new %p, old %p, new flags 0x%llx",
+         "new %#lx, old %#lx, new flags 0x%llx",
          signo, (UWord)new_act, (UWord)old_act,
          (ULong)(new_act ? new_act->sa_flags : 0) );
 
@@ -1029,11 +1029,11 @@
          = (Addr)(tst->altstack.ss_sp) + tst->altstack.ss_size;
       if (VG_(clo_trace_signals))
          VG_(message)(Vg_DebugMsg,
-		      "delivering signal %d (%s) to thread %d: on ALT STACK (%p-%p; %d bytes)", 
+		      "delivering signal %d (%s) to thread %d: on ALT STACK (%p-%p; %ld bytes)",
 		      sigNo, signame(sigNo), tid, 
 		      tst->altstack.ss_sp,
 		      (UChar *)tst->altstack.ss_sp + tst->altstack.ss_size,
-		      tst->altstack.ss_size );
+		      (unsigned long)tst->altstack.ss_size );
 
       /* Signal delivery to tools */
       VG_TRACK( pre_deliver_signal, tid, sigNo, /*alt_stack*/True );
@@ -1813,7 +1813,7 @@
 
    if (VG_(clo_trace_signals)) {
       VG_(message)(Vg_DebugMsg, "signal %d arrived ... si_code=%d, "
-                                "EIP=%p, eip=%p",
+                                "EIP=%#lx, eip=%#lx",
                    sigNo, info->si_code, VG_(get_IP)(tid), 
 		   VG_UCONTEXT_INSTR_PTR(uc) );
    }
@@ -1847,13 +1847,13 @@
       if (VG_(clo_trace_signals)) {
 	 if (seg == NULL)
 	    VG_(message)(Vg_DebugMsg,
-			 "SIGSEGV: si_code=%d faultaddr=%p tid=%d ESP=%p "
+			 "SIGSEGV: si_code=%d faultaddr=%#lx tid=%d ESP=%#lx "
                          "seg=NULL",
 			 info->si_code, fault, tid, esp);
 	 else
 	    VG_(message)(Vg_DebugMsg,
-			 "SIGSEGV: si_code=%d faultaddr=%p tid=%d ESP=%p "
-                          "seg=%p-%p",
+			 "SIGSEGV: si_code=%d faultaddr=%#lx tid=%d ESP=%#lx "
+                          "seg=%#lx-%#lx",
 			 info->si_code, fault, tid, esp, seg->start, seg->end);
       }
       if (info->si_code == VKI_SEGV_MAPERR
@@ -1873,13 +1873,13 @@
 	 if (VG_(extend_stack)(base, VG_(threads)[tid].client_stack_szB)) {
 	    if (VG_(clo_trace_signals))
 	       VG_(message)(Vg_DebugMsg, 
-			    "       -> extended stack base to %p", 
+			    "       -> extended stack base to %#lx",
                             VG_PGROUNDDN(fault));
             return; // extension succeeded, restart host (hence guest)
                     // instruction
 	 } else
 	    VG_(message)(Vg_UserMsg, 
-                         "Stack overflow in thread %d: can't grow stack to %p", 
+                         "Stack overflow in thread %d: can't grow stack to %#lx",
 			 tid, fault);
       }
       /* Fall into normal signal handling for all other cases */
@@ -1914,7 +1914,7 @@
 		   sigNo, signame(sigNo));
 
       VG_(message)(Vg_DebugMsg, 
-		   "si_code=%x;  Faulting address: %p;  sp: %p",
+		   "si_code=%x;  Faulting address: %p;  sp: %#lx",
 		   info->si_code, info->VKI_SIGINFO_si_addr,
                    VG_UCONTEXT_STACK_PTR(uc));
 
diff --git a/coregrind/m_stacks.c b/coregrind/m_stacks.c
index 10cafdf..1cba31a 100644
--- a/coregrind/m_stacks.c
+++ b/coregrind/m_stacks.c
@@ -305,7 +305,7 @@
          moans--;
          VG_(message)(Vg_UserMsg,
             "Warning: client switching stacks?  "
-            "SP change: %p --> %p", old_SP, new_SP);
+            "SP change: 0x%lx --> 0x%lx", old_SP, new_SP);
          VG_(message)(Vg_UserMsg,
             "         to suppress, use: --max-stackframe=%ld or greater",
             (delta < 0 ? -delta : delta));
diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c
index ae6aa3d..79de72c 100644
--- a/coregrind/m_stacktrace.c
+++ b/coregrind/m_stacktrace.c
@@ -94,8 +94,8 @@
       fp_max -= sizeof(Addr);
 
    if (debug)
-      VG_(printf)("n_ips=%d fp_min=%p fp_max_orig=%p, "
-                  "fp_max=%p ip=%p fp=%p\n",
+      VG_(printf)("n_ips=%d fp_min=0x%lx fp_max_orig=0x%lx, "
+                  "fp_max=0x%lx ip=0x%lx fp=0x%lx\n",
 		  n_ips, fp_min, fp_max_orig, fp_max, ip, fp);
 
    /* Assertion broken before main() is reached in pthreaded programs;  the
@@ -238,7 +238,7 @@
          if (fps) fps[i] = fp;
          ips[i++] = ip;
          if (debug)
-            VG_(printf)("     ipsC[%d]=%08p\n", i-1, ips[i-1]);
+            VG_(printf)("     ipsC[%d]=%#08lx\n", i-1, ips[i-1]);
          ip = ip - 1;
          continue;
       }
@@ -261,7 +261,7 @@
          if (fps) fps[i] = fp;
          ips[i++] = ip;
          if (debug)
-            VG_(printf)("     ipsF[%d]=%08p\n", i-1, ips[i-1]);
+            VG_(printf)("     ipsF[%d]=%#08lx\n", i-1, ips[i-1]);
          ip = ip - 1;
          continue;
       }
@@ -284,7 +284,7 @@
          if (fps) fps[i] = fp;
          ips[i++] = ip;
          if (debug)
-            VG_(printf)("     ipsH[%d]=%08p\n", i-1, ips[i-1]);
+            VG_(printf)("     ipsH[%d]=%#08lx\n", i-1, ips[i-1]);
          ip = ip - 1;
          sp += 8;
          continue;
@@ -407,7 +407,7 @@
             if (fps) fps[i] = fp;
             ips[i++] = ip;
             if (debug)
-               VG_(printf)("     ipsF[%d]=%08p\n", i-1, ips[i-1]);
+               VG_(printf)("     ipsF[%d]=%#08lx\n", i-1, ips[i-1]);
             continue;
          }
 
diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
index 40920dd..72a7da9 100644
--- a/coregrind/m_syswrap/syswrap-amd64-linux.c
+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
@@ -262,10 +262,10 @@
       VG_(register_stack)(seg->start, ctst->client_stack_highest_word);
 
       if (debug)
-	 VG_(printf)("tid %d: guessed client stack range %p-%p\n",
+	 VG_(printf)("tid %d: guessed client stack range %#lx-%#lx\n",
 		     ctid, seg->start, VG_PGROUNDUP(rsp));
    } else {
-      VG_(message)(Vg_UserMsg, "!? New thread %d starts with RSP(%p) unmapped\n",
+      VG_(message)(Vg_UserMsg, "!? New thread %d starts with RSP(%#lx) unmapped\n",
 		   ctid, rsp);
       ctst->client_stack_szB  = 0;
    }
@@ -278,7 +278,7 @@
 
    if (flags & VKI_CLONE_SETTLS) {
       if (debug)
-	 VG_(printf)("clone child has SETTLS: tls at %p\n", tlsaddr);
+	 VG_(printf)("clone child has SETTLS: tls at %#lx\n", tlsaddr);
       ctst->arch.vex.guest_FS_ZERO = tlsaddr;
    }
 
@@ -382,7 +382,7 @@
 {
    ULong cloneflags;
 
-   PRINT("sys_clone ( %x, %p, %p, %p, %p )",ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_clone ( %lx, %#lx, %#lx, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5);
    PRE_REG_READ5(int, "clone",
                  unsigned long, flags,
                  void *, child_stack,
@@ -440,7 +440,7 @@
 
    default:
       /* should we just ENOSYS? */
-      VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%x", ARG1);
+      VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%lx", ARG1);
       VG_(message)(Vg_UserMsg, "");
       VG_(message)(Vg_UserMsg, "The only supported clone() uses are:");
       VG_(message)(Vg_UserMsg, " - via a threads library (LinuxThreads or NPTL)");
@@ -506,7 +506,7 @@
 PRE(sys_arch_prctl)
 {
    ThreadState* tst;
-   PRINT( "arch_prctl ( %d, %llx )", ARG1, ARG2 );
+   PRINT( "arch_prctl ( %ld, %lx )", ARG1, ARG2 );
 
    vg_assert(VG_(is_valid_tid)(tid));
    vg_assert(tid >= 1 && tid < VG_N_THREADS);
@@ -547,7 +547,7 @@
 // space, and we should therefore not check anything it points to.
 PRE(sys_ptrace)
 {
-   PRINT("sys_ptrace ( %d, %d, %p, %p )", ARG1,ARG2,ARG3,ARG4);
+   PRINT("sys_ptrace ( %ld, %ld, %#lx, %#lx )", ARG1,ARG2,ARG3,ARG4);
    PRE_REG_READ4(int, "ptrace", 
                  long, request, long, pid, long, addr, long, data);
    switch (ARG1) {
@@ -617,7 +617,7 @@
 
 PRE(sys_socket)
 {
-   PRINT("sys_socket ( %d, %d, %d )",ARG1,ARG2,ARG3);
+   PRINT("sys_socket ( %ld, %ld, %ld )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "socket", int, domain, int, type, int, protocol);
 }
 POST(sys_socket)
@@ -630,7 +630,7 @@
 
 PRE(sys_setsockopt)
 {
-   PRINT("sys_setsockopt ( %d, %d, %d, %p, %d )",ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_setsockopt ( %ld, %ld, %ld, %#lx, %ld )",ARG1,ARG2,ARG3,ARG4,ARG5);
    PRE_REG_READ5(long, "setsockopt",
                  int, s, int, level, int, optname,
                  const void *, optval, int, optlen);
@@ -639,7 +639,7 @@
 
 PRE(sys_getsockopt)
 {
-   PRINT("sys_getsockopt ( %d, %d, %d, %p, %p )",ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_getsockopt ( %ld, %ld, %ld, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5);
    PRE_REG_READ5(long, "getsockopt",
                  int, s, int, level, int, optname,
                  void *, optval, int, *optlen);
@@ -655,7 +655,7 @@
 PRE(sys_connect)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_connect ( %d, %p, %d )",ARG1,ARG2,ARG3);
+   PRINT("sys_connect ( %ld, %#lx, %ld )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "connect",
                  int, sockfd, struct sockaddr *, serv_addr, int, addrlen);
    ML_(generic_PRE_sys_connect)(tid, ARG1,ARG2,ARG3);
@@ -664,7 +664,7 @@
 PRE(sys_accept)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_accept ( %d, %p, %d )",ARG1,ARG2,ARG3);
+   PRINT("sys_accept ( %ld, %#lx, %ld )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "accept",
                  int, s, struct sockaddr *, addr, int, *addrlen);
    ML_(generic_PRE_sys_accept)(tid, ARG1,ARG2,ARG3);
@@ -681,7 +681,7 @@
 PRE(sys_sendto)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_sendto ( %d, %p, %d, %u, %p, %d )",ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
+   PRINT("sys_sendto ( %ld, %#lx, %ld, %lu, %#lx, %ld )",ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
    PRE_REG_READ6(long, "sendto",
                  int, s, const void *, msg, int, len, 
                  unsigned int, flags, 
@@ -692,7 +692,7 @@
 PRE(sys_recvfrom)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_recvfrom ( %d, %p, %d, %u, %p, %p )",ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
+   PRINT("sys_recvfrom ( %ld, %#lx, %ld, %lu, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
    PRE_REG_READ6(long, "recvfrom",
                  int, s, void *, buf, int, len, unsigned int, flags,
                  struct sockaddr *, from, int *, fromlen);
@@ -708,7 +708,7 @@
 PRE(sys_sendmsg)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_sendmsg ( %d, %p, %d )",ARG1,ARG2,ARG3);
+   PRINT("sys_sendmsg ( %ld, %#lx, %ld )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "sendmsg",
                  int, s, const struct msghdr *, msg, int, flags);
    ML_(generic_PRE_sys_sendmsg)(tid, ARG1,ARG2);
@@ -717,7 +717,7 @@
 PRE(sys_recvmsg)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_recvmsg ( %d, %p, %d )",ARG1,ARG2,ARG3);
+   PRINT("sys_recvmsg ( %ld, %#lx, %ld )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "recvmsg", int, s, struct msghdr *, msg, int, flags);
    ML_(generic_PRE_sys_recvmsg)(tid, ARG1,ARG2);
 }
@@ -729,13 +729,13 @@
 PRE(sys_shutdown)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_shutdown ( %d, %d )",ARG1,ARG2);
+   PRINT("sys_shutdown ( %ld, %ld )",ARG1,ARG2);
    PRE_REG_READ2(int, "shutdown", int, s, int, how);
 }
 
 PRE(sys_bind)
 {
-   PRINT("sys_bind ( %d, %p, %d )",ARG1,ARG2,ARG3);
+   PRINT("sys_bind ( %ld, %#lx, %ld )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "bind",
                  int, sockfd, struct sockaddr *, my_addr, int, addrlen);
    ML_(generic_PRE_sys_bind)(tid, ARG1,ARG2,ARG3);
@@ -743,13 +743,13 @@
 
 PRE(sys_listen)
 {
-   PRINT("sys_listen ( %d, %d )",ARG1,ARG2);
+   PRINT("sys_listen ( %ld, %ld )",ARG1,ARG2);
    PRE_REG_READ2(long, "listen", int, s, int, backlog);
 }
 
 PRE(sys_getsockname)
 {
-   PRINT("sys_getsockname ( %d, %p, %p )",ARG1,ARG2,ARG3);
+   PRINT("sys_getsockname ( %ld, %#lx, %#lx )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "getsockname",
                  int, s, struct sockaddr *, name, int *, namelen);
    ML_(generic_PRE_sys_getsockname)(tid, ARG1,ARG2,ARG3);
@@ -763,7 +763,7 @@
 
 PRE(sys_getpeername)
 {
-   PRINT("sys_getpeername ( %d, %p, %p )",ARG1,ARG2,ARG3);
+   PRINT("sys_getpeername ( %ld, %#lx, %#lx )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "getpeername",
                  int, s, struct sockaddr *, name, int *, namelen);
    ML_(generic_PRE_sys_getpeername)(tid, ARG1,ARG2,ARG3);
@@ -777,7 +777,7 @@
 
 PRE(sys_socketpair)
 {
-   PRINT("sys_socketpair ( %d, %d, %d, %p )",ARG1,ARG2,ARG3,ARG4);
+   PRINT("sys_socketpair ( %ld, %ld, %ld, %#lx )",ARG1,ARG2,ARG3,ARG4);
    PRE_REG_READ4(long, "socketpair",
                  int, d, int, type, int, protocol, int [2], sv);
    ML_(generic_PRE_sys_socketpair)(tid, ARG1,ARG2,ARG3,ARG4);
@@ -791,14 +791,14 @@
 
 PRE(sys_semget)
 {
-   PRINT("sys_semget ( %d, %d, %d )",ARG1,ARG2,ARG3);
+   PRINT("sys_semget ( %ld, %ld, %ld )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "semget", vki_key_t, key, int, nsems, int, semflg);
 }
 
 PRE(sys_semop)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_semop ( %d, %p, %u )",ARG1,ARG2,ARG3);
+   PRINT("sys_semop ( %ld, %#lx, %lu )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "semop",
                  int, semid, struct sembuf *, sops, unsigned, nsoops);
    ML_(generic_PRE_sys_semop)(tid, ARG1,ARG2,ARG3);
@@ -807,7 +807,7 @@
 PRE(sys_semtimedop)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_semtimedop ( %d, %p, %u, %p )",ARG1,ARG2,ARG3,ARG4);
+   PRINT("sys_semtimedop ( %ld, %#lx, %lu, %#lx )",ARG1,ARG2,ARG3,ARG4);
    PRE_REG_READ4(long, "semtimedop",
                  int, semid, struct sembuf *, sops, unsigned, nsoops,
                  struct timespec *, timeout);
@@ -819,25 +819,25 @@
    switch (ARG3 & ~VKI_IPC_64) {
    case VKI_IPC_INFO:
    case VKI_SEM_INFO:
-      PRINT("sys_semctl ( %d, %d, %d, %p )",ARG1,ARG2,ARG3,ARG4);
+      PRINT("sys_semctl ( %ld, %ld, %ld, %#lx )",ARG1,ARG2,ARG3,ARG4);
       PRE_REG_READ4(long, "semctl",
                     int, semid, int, semnum, int, cmd, struct seminfo *, arg);
       break;
    case VKI_IPC_STAT:
    case VKI_SEM_STAT:
    case VKI_IPC_SET:
-      PRINT("sys_semctl ( %d, %d, %d, %p )",ARG1,ARG2,ARG3,ARG4);
+      PRINT("sys_semctl ( %ld, %ld, %ld, %#lx )",ARG1,ARG2,ARG3,ARG4);
       PRE_REG_READ4(long, "semctl",
                     int, semid, int, semnum, int, cmd, struct semid_ds *, arg);
       break;
    case VKI_GETALL:
    case VKI_SETALL:
-      PRINT("sys_semctl ( %d, %d, %d, %p )",ARG1,ARG2,ARG3,ARG4);
+      PRINT("sys_semctl ( %ld, %ld, %ld, %#lx )",ARG1,ARG2,ARG3,ARG4);
       PRE_REG_READ4(long, "semctl",
                     int, semid, int, semnum, int, cmd, unsigned short *, arg);
       break;
    default:
-      PRINT("sys_semctl ( %d, %d, %d )",ARG1,ARG2,ARG3);
+      PRINT("sys_semctl ( %ld, %ld, %ld )",ARG1,ARG2,ARG3);
       PRE_REG_READ3(long, "semctl",
                     int, semid, int, semnum, int, cmd);
       break;
@@ -851,13 +851,13 @@
 
 PRE(sys_msgget)
 {
-   PRINT("sys_msgget ( %d, %d )",ARG1,ARG2);
+   PRINT("sys_msgget ( %ld, %ld )",ARG1,ARG2);
    PRE_REG_READ2(long, "msgget", vki_key_t, key, int, msgflg);
 }
 
 PRE(sys_msgsnd)
 {
-   PRINT("sys_msgsnd ( %d, %p, %d, %d )",ARG1,ARG2,ARG3,ARG4);
+   PRINT("sys_msgsnd ( %ld, %#lx, %ld, %ld )",ARG1,ARG2,ARG3,ARG4);
    PRE_REG_READ4(long, "msgsnd",
                  int, msqid, struct msgbuf *, msgp, vki_size_t, msgsz, int, msgflg);
    ML_(linux_PRE_sys_msgsnd)(tid, ARG1,ARG2,ARG3,ARG4);
@@ -867,7 +867,7 @@
 
 PRE(sys_msgrcv)
 {
-   PRINT("sys_msgrcv ( %d, %p, %d, %d, %d )",ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_msgrcv ( %ld, %#lx, %ld, %ld, %ld )",ARG1,ARG2,ARG3,ARG4,ARG5);
    PRE_REG_READ5(long, "msgrcv",
                  int, msqid, struct msgbuf *, msgp, vki_size_t, msgsz,
                  long, msgytp, int, msgflg);
@@ -882,7 +882,7 @@
 
 PRE(sys_msgctl)
 {
-   PRINT("sys_msgctl ( %d, %d, %p )",ARG1,ARG2,ARG3);
+   PRINT("sys_msgctl ( %ld, %ld, %#lx )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "msgctl",
                  int, msqid, int, cmd, struct msqid_ds *, buf);
    ML_(linux_PRE_sys_msgctl)(tid, ARG1,ARG2,ARG3);
@@ -894,14 +894,14 @@
 
 PRE(sys_shmget)
 {
-   PRINT("sys_shmget ( %d, %d, %d )",ARG1,ARG2,ARG3);
+   PRINT("sys_shmget ( %ld, %ld, %ld )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "shmget", vki_key_t, key, vki_size_t, size, int, shmflg);
 }
 
 PRE(wrap_sys_shmat)
 {
    UWord arg2tmp;
-   PRINT("wrap_sys_shmat ( %d, %p, %d )",ARG1,ARG2,ARG3);
+   PRINT("wrap_sys_shmat ( %ld, %#lx, %ld )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "shmat",
                  int, shmid, const void *, shmaddr, int, shmflg);
    arg2tmp = ML_(generic_PRE_sys_shmat)(tid, ARG1,ARG2,ARG3);
@@ -917,7 +917,7 @@
 
 PRE(sys_shmdt)
 {
-   PRINT("sys_shmdt ( %p )",ARG1);
+   PRINT("sys_shmdt ( %#lx )",ARG1);
    PRE_REG_READ1(long, "shmdt", const void *, shmaddr);
    if (!ML_(generic_PRE_sys_shmdt)(tid, ARG1))
       SET_STATUS_Failure( VKI_EINVAL );
@@ -929,7 +929,7 @@
 
 PRE(sys_shmctl)
 {
-   PRINT("sys_shmctl ( %d, %d, %p )",ARG1,ARG2,ARG3);
+   PRINT("sys_shmctl ( %ld, %ld, %#lx )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "shmctl",
                  int, shmid, int, cmd, struct shmid_ds *, buf);
    ML_(generic_PRE_sys_shmctl)(tid, ARG1,ARG2,ARG3);
@@ -942,7 +942,7 @@
 PRE(sys_pread64)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_pread64 ( %d, %p, %llu, %lld )",
+   PRINT("sys_pread64 ( %ld, %#lx, %llu, %ld )",
          ARG1, ARG2, (ULong)ARG3, ARG4);
    PRE_REG_READ4(ssize_t, "pread64",
                  unsigned int, fd, char *, buf,
@@ -960,7 +960,7 @@
 PRE(sys_pwrite64)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_pwrite64 ( %d, %p, %llu, %lld )",
+   PRINT("sys_pwrite64 ( %ld, %#lx, %llu, %ld )",
          ARG1, ARG2, (ULong)ARG3, ARG4);
    PRE_REG_READ4(ssize_t, "pwrite64",
                  unsigned int, fd, const char *, buf,
@@ -970,7 +970,7 @@
 
 PRE(sys_fadvise64)
 {
-   PRINT("sys_fadvise64 ( %d, %lld, %llu, %d )", ARG1,ARG2,ARG3,ARG4);
+   PRINT("sys_fadvise64 ( %ld, %ld, %lu, %ld )", ARG1,ARG2,ARG3,ARG4);
    PRE_REG_READ4(long, "fadvise64",
                  int, fd, vki_loff_t, offset, vki_size_t, len, int, advice);
 }
@@ -979,7 +979,7 @@
 {
    SysRes r;
 
-   PRINT("sys_mmap ( %p, %llu, %d, %d, %d, %d )",
+   PRINT("sys_mmap ( %#lx, %llu, %ld, %ld, %ld, %ld )",
          ARG1, (ULong)ARG2, ARG3, ARG4, ARG5, ARG6 );
    PRE_REG_READ6(long, "mmap",
                  unsigned long, start, unsigned long, length,
diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c
index 4a57613..ffd64e3 100644
--- a/coregrind/m_syswrap/syswrap-generic.c
+++ b/coregrind/m_syswrap/syswrap-generic.c
@@ -84,13 +84,13 @@
             (start,size,VKI_PROT_NONE);
 
    if (0)
-      VG_(printf)("%s: test=%p-%p ret=%d\n",
+      VG_(printf)("%s: test=%#lx-%#lx ret=%d\n",
 		  syscallname, start, start+size-1, (Int)ret);
 
    if (!ret && syscallname != NULL) {
       VG_(message)(Vg_UserMsg, "Warning: client syscall %s tried "
-                               "to modify addresses %p-%p",
-                               syscallname, (void*)start, (void*)(start+size-1));
+                               "to modify addresses %#lx-%#lx",
+                               syscallname, start, start+size-1);
       if (VG_(clo_verbosity) > 1) {
          VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size));
       }
@@ -212,7 +212,7 @@
    Bool      f_maymove = toBool(flags & VKI_MREMAP_MAYMOVE);
 
    if (0)
-      VG_(printf)("do_remap (old %p %d) (new %p %d) %s %s\n",
+      VG_(printf)("do_remap (old %#lx %ld) (new %#lx %ld) %s %s\n",
                   old_addr,old_len,new_addr,new_len, 
                   flags & VKI_MREMAP_MAYMOVE ? "MAYMOVE" : "",
                   flags & VKI_MREMAP_FIXED ? "FIXED" : "");
@@ -984,7 +984,7 @@
    Bool debug = False;
 
    if (debug)
-      VG_(printf)("\ndo_brk: brk_base=%p brk_limit=%p newbrk=%p\n",
+      VG_(printf)("\ndo_brk: brk_base=%#lx brk_limit=%#lx newbrk=%#lx\n",
 		  VG_(brk_base), VG_(brk_limit), newbrk);
 
 #  if 0
@@ -2014,7 +2014,7 @@
 {
    ThreadState* tst;
    /* simple; just make this thread exit */
-   PRINT("exit( %d )", ARG1);
+   PRINT("exit( %ld )", ARG1);
    PRE_REG_READ1(void, "exit", int, exitcode);
    tst = VG_(get_ThreadState)(tid);
    /* Set the thread's status to be exiting, then claim that the
@@ -2033,7 +2033,7 @@
 
 PRE(sys_iopl)
 {
-   PRINT("sys_iopl ( %d )", ARG1);
+   PRINT("sys_iopl ( %ld )", ARG1);
    PRE_REG_READ1(long, "iopl", unsigned long, level);
 }
 
@@ -2041,7 +2041,7 @@
 #if defined(VGP_x86_linux)
 PRE(sys_lookup_dcookie)
 {
-   PRINT("sys_lookup_dcookie (0x%llx, %p, %d)", LOHI64(ARG1,ARG2), ARG3, ARG4);
+   PRINT("sys_lookup_dcookie (0x%llx, %#lx, %ld)", LOHI64(ARG1,ARG2), ARG3, ARG4);
    PRE_REG_READ4(long, "lookup_dcookie",
                  vki_u32, cookie_low32, vki_u32, cookie_high32,
                  char *, buf, vki_size_t, len);
@@ -2058,21 +2058,21 @@
 PRE(sys_fsync)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_fsync ( %d )", ARG1);
+   PRINT("sys_fsync ( %ld )", ARG1);
    PRE_REG_READ1(long, "fsync", unsigned int, fd);
 }
 
 PRE(sys_fdatasync)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_fdatasync ( %d )", ARG1);
+   PRINT("sys_fdatasync ( %ld )", ARG1);
    PRE_REG_READ1(long, "fdatasync", unsigned int, fd);
 }
 
 PRE(sys_msync)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_msync ( %p, %llu, %d )", ARG1,(ULong)ARG2,ARG3);
+   PRINT("sys_msync ( %#lx, %llu, %ld )", ARG1,(ULong)ARG2,ARG3);
    PRE_REG_READ3(long, "msync",
                  unsigned long, start, vki_size_t, length, int, flags);
    PRE_MEM_READ( "msync(start)", ARG1, ARG2 );
@@ -2093,7 +2093,7 @@
    struct vki_pmsg_strbuf *ctrl;
    struct vki_pmsg_strbuf *data;
    *flags |= SfMayBlock;
-   PRINT("sys_getpmsg ( %d, %p, %p, %p, %p )", ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_getpmsg ( %ld, %#lx, %#lx, %#lx, %#lx )", ARG1,ARG2,ARG3,ARG4,ARG5);
    PRE_REG_READ5(int, "getpmsg",
                  int, fd, struct strbuf *, ctrl, struct strbuf *, data, 
                  int *, bandp, int *, flagsp);
@@ -2129,7 +2129,7 @@
    struct vki_pmsg_strbuf *ctrl;
    struct vki_pmsg_strbuf *data;
    *flags |= SfMayBlock;
-   PRINT("sys_putpmsg ( %d, %p, %p, %d, %d )", ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_putpmsg ( %ld, %#lx, %#lx, %ld, %ld )", ARG1,ARG2,ARG3,ARG4,ARG5);
    PRE_REG_READ5(int, "putpmsg",
                  int, fd, struct strbuf *, ctrl, struct strbuf *, data, 
                  int, band, int, flags);
@@ -2143,7 +2143,7 @@
 
 PRE(sys_getitimer)
 {
-   PRINT("sys_getitimer ( %d, %p )", ARG1, ARG2);
+   PRINT("sys_getitimer ( %ld, %#lx )", ARG1, ARG2);
    PRE_REG_READ2(long, "getitimer", int, which, struct itimerval *, value);
    PRE_MEM_WRITE( "getitimer(value)", ARG2, sizeof(struct vki_itimerval) );
 }
@@ -2156,7 +2156,7 @@
 
 PRE(sys_setitimer)
 {
-   PRINT("sys_setitimer ( %d, %p, %p )", ARG1,ARG2,ARG3);
+   PRINT("sys_setitimer ( %ld, %#lx, %#lx )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "setitimer", 
                  int, which,
                  struct itimerval *, value, struct itimerval *, ovalue);
@@ -2175,7 +2175,7 @@
 
 PRE(sys_chroot)
 {
-   PRINT("sys_chroot ( %p )", ARG1);
+   PRINT("sys_chroot ( %#lx )", ARG1);
    PRE_REG_READ1(long, "chroot", const char *, path);
    PRE_MEM_RASCIIZ( "chroot(path)", ARG1 );
 }
@@ -2183,7 +2183,7 @@
 PRE(sys_madvise)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_madvise ( %p, %llu, %d )", ARG1,(ULong)ARG2,ARG3);
+   PRINT("sys_madvise ( %#lx, %llu, %ld )", ARG1,(ULong)ARG2,ARG3);
    PRE_REG_READ3(long, "madvise",
                  unsigned long, start, vki_size_t, length, int, advice);
 }
@@ -2193,14 +2193,14 @@
    // Nb: this is different to the glibc version described in the man pages,
    // which lacks the fifth 'new_address' argument.
    if (ARG4 & VKI_MREMAP_FIXED) {
-      PRINT("sys_mremap ( %p, %llu, %d, 0x%x, %p )", 
+      PRINT("sys_mremap ( %#lx, %llu, %ld, 0x%lx, %#lx )",
             ARG1, (ULong)ARG2, ARG3, ARG4, ARG5);
       PRE_REG_READ5(unsigned long, "mremap",
                     unsigned long, old_addr, unsigned long, old_size,
                     unsigned long, new_size, unsigned long, flags,
                     unsigned long, new_addr);
    } else {
-      PRINT("sys_mremap ( %p, %llu, %d, 0x%x )", 
+      PRINT("sys_mremap ( %#lx, %llu, %ld, 0x%lx )",
             ARG1, (ULong)ARG2, ARG3, ARG4);
       PRE_REG_READ4(unsigned long, "mremap",
                     unsigned long, old_addr, unsigned long, old_size,
@@ -2213,40 +2213,40 @@
 
 PRE(sys_nice)
 {
-   PRINT("sys_nice ( %d )", ARG1);
+   PRINT("sys_nice ( %ld )", ARG1);
    PRE_REG_READ1(long, "nice", int, inc);
 }
 
 PRE(sys_mlock)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_mlock ( %p, %llu )", ARG1, (ULong)ARG2);
+   PRINT("sys_mlock ( %#lx, %llu )", ARG1, (ULong)ARG2);
    PRE_REG_READ2(long, "mlock", unsigned long, addr, vki_size_t, len);
 }
 
 PRE(sys_munlock)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_munlock ( %p, %llu )", ARG1, (ULong)ARG2);
+   PRINT("sys_munlock ( %#lx, %llu )", ARG1, (ULong)ARG2);
    PRE_REG_READ2(long, "munlock", unsigned long, addr, vki_size_t, len);
 }
 
 PRE(sys_mlockall)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_mlockall ( %x )", ARG1);
+   PRINT("sys_mlockall ( %lx )", ARG1);
    PRE_REG_READ1(long, "mlockall", int, flags);
 }
 
 PRE(sys_setpriority)
 {
-   PRINT("sys_setpriority ( %d, %d, %d )", ARG1, ARG2, ARG3);
+   PRINT("sys_setpriority ( %ld, %ld, %ld )", ARG1, ARG2, ARG3);
    PRE_REG_READ3(long, "setpriority", int, which, int, who, int, prio);
 }
 
 PRE(sys_getpriority)
 {
-   PRINT("sys_getpriority ( %d, %d )", ARG1, ARG2);
+   PRINT("sys_getpriority ( %ld, %ld )", ARG1, ARG2);
    PRE_REG_READ2(long, "getpriority", int, which, int, who);
 }
 
@@ -2258,7 +2258,7 @@
 PRE(sys_pwrite64)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_pwrite64 ( %d, %p, %llu, %lld )",
+   PRINT("sys_pwrite64 ( %ld, %#lx, %llu, %lld )",
          ARG1, ARG2, (ULong)ARG3, LOHI64(ARG4,ARG5));
    PRE_REG_READ5(ssize_t, "pwrite64",
                  unsigned int, fd, const char *, buf, vki_size_t, count,
@@ -2275,7 +2275,7 @@
 
 PRE(sys_fstatfs)
 {
-   PRINT("sys_fstatfs ( %d, %p )",ARG1,ARG2);
+   PRINT("sys_fstatfs ( %ld, %#lx )",ARG1,ARG2);
    PRE_REG_READ2(long, "fstatfs",
                  unsigned int, fd, struct statfs *, buf);
    PRE_MEM_WRITE( "fstatfs(buf)", ARG2, sizeof(struct vki_statfs) );
@@ -2288,7 +2288,7 @@
 
 PRE(sys_fstatfs64)
 {
-   PRINT("sys_fstatfs64 ( %d, %llu, %p )",ARG1,(ULong)ARG2,ARG3);
+   PRINT("sys_fstatfs64 ( %ld, %llu, %#lx )",ARG1,(ULong)ARG2,ARG3);
    PRE_REG_READ3(long, "fstatfs64",
                  unsigned int, fd, vki_size_t, size, struct statfs64 *, buf);
    PRE_MEM_WRITE( "fstatfs64(buf)", ARG3, ARG2 );
@@ -2300,7 +2300,7 @@
 
 PRE(sys_getsid)
 {
-   PRINT("sys_getsid ( %d )", ARG1);
+   PRINT("sys_getsid ( %ld )", ARG1);
    PRE_REG_READ1(long, "getsid", vki_pid_t, pid);
 }
 
@@ -2312,7 +2312,7 @@
 PRE(sys_pread64)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_pread64 ( %d, %p, %llu, %lld )",
+   PRINT("sys_pread64 ( %ld, %#lx, %llu, %lld )",
          ARG1, ARG2, (ULong)ARG3, LOHI64(ARG4,ARG5));
    PRE_REG_READ5(ssize_t, "pread64",
                  unsigned int, fd, char *, buf, vki_size_t, count,
@@ -2329,7 +2329,7 @@
 
 PRE(sys_mknod)
 {
-   PRINT("sys_mknod ( %p(%s), 0x%x, 0x%x )", ARG1, ARG1, ARG2, ARG3 );
+   PRINT("sys_mknod ( %#lx(%s), 0x%lx, 0x%lx )", ARG1, (char*)ARG1, ARG2, ARG3 );
    PRE_REG_READ3(long, "mknod",
                  const char *, pathname, int, mode, unsigned, dev);
    PRE_MEM_RASCIIZ( "mknod(pathname)", ARG1 );
@@ -2338,7 +2338,7 @@
 PRE(sys_flock)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_flock ( %d, %d )", ARG1, ARG2 );
+   PRINT("sys_flock ( %ld, %ld )", ARG1, ARG2 );
    PRE_REG_READ2(long, "flock", unsigned int, fd, unsigned int, operation);
 }
 
@@ -2389,7 +2389,7 @@
    SysRes       res;
    Bool         setuid_allowed;
 
-   PRINT("sys_execve ( %p(%s), %p, %p )", ARG1, ARG1, ARG2, ARG3);
+   PRINT("sys_execve ( %#lx(%s), %#lx, %#lx )", ARG1, (char*)ARG1, ARG2, ARG3);
    PRE_REG_READ3(vki_off_t, "execve",
                  char *, filename, char **, argv, char **, envp);
    PRE_MEM_RASCIIZ( "execve(filename)", ARG1 );
@@ -2597,8 +2597,8 @@
       too much of a mess to continue, so we have to abort. */
   hosed:
    vg_assert(FAILURE);
-   VG_(message)(Vg_UserMsg, "execve(%p(%s), %p, %p) failed, errno %d",
-                ARG1, ARG1, ARG2, ARG3, ERR);
+   VG_(message)(Vg_UserMsg, "execve(%#lx(%s), %#lx, %#lx) failed, errno %ld",
+                ARG1, (char*)ARG1, ARG2, ARG3, ERR);
    VG_(message)(Vg_UserMsg, "EXEC FAILED: I can't recover from "
                             "execve() failing, so I'm dying.");
    VG_(message)(Vg_UserMsg, "Add more stringent tests in PRE(sys_execve), "
@@ -2608,14 +2608,14 @@
 
 PRE(sys_access)
 {
-   PRINT("sys_access ( %p(%s), %d )", ARG1,ARG1,ARG2);
+   PRINT("sys_access ( %#lx(%s), %ld )", ARG1,(char*)ARG1,ARG2);
    PRE_REG_READ2(long, "access", const char *, pathname, int, mode);
    PRE_MEM_RASCIIZ( "access(pathname)", ARG1 );
 }
 
 PRE(sys_alarm)
 {
-   PRINT("sys_alarm ( %d )", ARG1);
+   PRINT("sys_alarm ( %ld )", ARG1);
    PRE_REG_READ1(unsigned long, "alarm", unsigned int, seconds);
 }
 
@@ -2639,7 +2639,7 @@
 
       Both will seg fault if you shrink it back into a text segment.
    */
-   PRINT("sys_brk ( %p )", ARG1);
+   PRINT("sys_brk ( %#lx )", ARG1);
    PRE_REG_READ1(unsigned long, "brk", unsigned long, end_data_segment);
 
    brk_new = do_brk(ARG1);
@@ -2665,21 +2665,21 @@
 
 PRE(sys_chdir)
 {
-   PRINT("sys_chdir ( %p(%s) )", ARG1,ARG1);
+   PRINT("sys_chdir ( %#lx(%s) )", ARG1,(char*)ARG1);
    PRE_REG_READ1(long, "chdir", const char *, path);
    PRE_MEM_RASCIIZ( "chdir(path)", ARG1 );
 }
 
 PRE(sys_chmod)
 {
-   PRINT("sys_chmod ( %p(%s), %d )", ARG1,ARG1,ARG2);
+   PRINT("sys_chmod ( %#lx(%s), %ld )", ARG1,(char*)ARG1,ARG2);
    PRE_REG_READ2(long, "chmod", const char *, path, vki_mode_t, mode);
    PRE_MEM_RASCIIZ( "chmod(path)", ARG1 );
 }
 
 PRE(sys_chown)
 {
-   PRINT("sys_chown ( %p(%s), 0x%x, 0x%x )", ARG1,ARG1,ARG2,ARG3);
+   PRINT("sys_chown ( %#lx(%s), 0x%lx, 0x%lx )", ARG1,(char*)ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "chown",
                  const char *, path, vki_uid_t, owner, vki_gid_t, group);
    PRE_MEM_RASCIIZ( "chown(path)", ARG1 );
@@ -2687,7 +2687,7 @@
 
 PRE(sys_lchown)
 {
-   PRINT("sys_lchown ( %p(%s), 0x%x, 0x%x )", ARG1,ARG1,ARG2,ARG3);
+   PRINT("sys_lchown ( %#lx(%s), 0x%lx, 0x%lx )", ARG1,(char*)ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "lchown",
                  const char *, path, vki_uid_t, owner, vki_gid_t, group);
    PRE_MEM_RASCIIZ( "lchown(path)", ARG1 );
@@ -2695,7 +2695,7 @@
 
 PRE(sys_close)
 {
-   PRINT("sys_close ( %d )", ARG1);
+   PRINT("sys_close ( %ld )", ARG1);
    PRE_REG_READ1(long, "close", unsigned int, fd);
 
    /* Detect and negate attempts by the client to close Valgrind's log fd */
@@ -2713,7 +2713,7 @@
 
 PRE(sys_dup)
 {
-   PRINT("sys_dup ( %d )", ARG1);
+   PRINT("sys_dup ( %ld )", ARG1);
    PRE_REG_READ1(long, "dup", unsigned int, oldfd);
 }
 
@@ -2731,7 +2731,7 @@
 
 PRE(sys_dup2)
 {
-   PRINT("sys_dup2 ( %d, %d )", ARG1,ARG2);
+   PRINT("sys_dup2 ( %ld, %ld )", ARG1,ARG2);
    PRE_REG_READ2(long, "dup2", unsigned int, oldfd, unsigned int, newfd);
    if (!ML_(fd_allowed)(ARG2, "dup2", tid, True))
       SET_STATUS_Failure( VKI_EBADF );
@@ -2746,20 +2746,20 @@
 
 PRE(sys_fchdir)
 {
-   PRINT("sys_fchdir ( %d )", ARG1);
+   PRINT("sys_fchdir ( %ld )", ARG1);
    PRE_REG_READ1(long, "fchdir", unsigned int, fd);
 }
 
 PRE(sys_fchown)
 {
-   PRINT("sys_fchown ( %d, %d, %d )", ARG1,ARG2,ARG3);
+   PRINT("sys_fchown ( %ld, %ld, %ld )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "fchown",
                  unsigned int, fd, vki_uid_t, owner, vki_gid_t, group);
 }
 
 PRE(sys_fchmod)
 {
-   PRINT("sys_fchmod ( %d, %d )", ARG1,ARG2);
+   PRINT("sys_fchmod ( %ld, %ld )", ARG1,ARG2);
    PRE_REG_READ2(long, "fchmod", unsigned int, fildes, vki_mode_t, mode);
 }
 
@@ -2772,7 +2772,7 @@
    case VKI_F_GETOWN:
    case VKI_F_GETSIG:
    case VKI_F_GETLEASE:
-      PRINT("sys_fcntl ( %d, %d )", ARG1,ARG2);
+      PRINT("sys_fcntl ( %ld, %ld )", ARG1,ARG2);
       PRE_REG_READ2(long, "fcntl", unsigned int, fd, unsigned int, cmd);
       break;
 
@@ -2784,7 +2784,7 @@
    case VKI_F_NOTIFY:
    case VKI_F_SETOWN:
    case VKI_F_SETSIG:
-      PRINT("sys_fcntl[ARG3=='arg'] ( %d, %d, %d )", ARG1,ARG2,ARG3);
+      PRINT("sys_fcntl[ARG3=='arg'] ( %ld, %ld, %ld )", ARG1,ARG2,ARG3);
       PRE_REG_READ3(long, "fcntl",
                     unsigned int, fd, unsigned int, cmd, unsigned long, arg);
       break;
@@ -2799,7 +2799,7 @@
    case VKI_F_SETLKW64:
 #  else
 #  endif
-      PRINT("sys_fcntl[ARG3=='lock'] ( %d, %d, %p )", ARG1,ARG2,ARG3);
+      PRINT("sys_fcntl[ARG3=='lock'] ( %ld, %ld, %#lx )", ARG1,ARG2,ARG3);
       PRE_REG_READ3(long, "fcntl",
                     unsigned int, fd, unsigned int, cmd,
                     struct flock64 *, lock);
@@ -2836,7 +2836,7 @@
    case VKI_F_GETSIG:
    case VKI_F_SETSIG:
    case VKI_F_GETLEASE:
-      PRINT("sys_fcntl64 ( %d, %d )", ARG1,ARG2);
+      PRINT("sys_fcntl64 ( %ld, %ld )", ARG1,ARG2);
       PRE_REG_READ2(long, "fcntl64", unsigned int, fd, unsigned int, cmd);
       break;
 
@@ -2846,7 +2846,7 @@
    case VKI_F_SETFL:
    case VKI_F_SETLEASE:
    case VKI_F_NOTIFY:
-      PRINT("sys_fcntl64[ARG3=='arg'] ( %d, %d, %d )", ARG1,ARG2,ARG3);
+      PRINT("sys_fcntl64[ARG3=='arg'] ( %ld, %ld, %ld )", ARG1,ARG2,ARG3);
       PRE_REG_READ3(long, "fcntl64",
                     unsigned int, fd, unsigned int, cmd, unsigned long, arg);
       break;
@@ -2860,7 +2860,7 @@
    case VKI_F_SETLK64:
    case VKI_F_SETLKW64:
 #  endif
-      PRINT("sys_fcntl64[ARG3=='lock'] ( %d, %d, %p )", ARG1,ARG2,ARG3);
+      PRINT("sys_fcntl64[ARG3=='lock'] ( %ld, %ld, %#lx )", ARG1,ARG2,ARG3);
       PRE_REG_READ3(long, "fcntl64",
                     unsigned int, fd, unsigned int, cmd,
                     struct flock64 *, lock);
@@ -2892,7 +2892,7 @@
 
 PRE(sys_newfstat)
 {
-   PRINT("sys_newfstat ( %d, %p )", ARG1,ARG2);
+   PRINT("sys_newfstat ( %ld, %#lx )", ARG1,ARG2);
    PRE_REG_READ2(long, "fstat", unsigned int, fd, struct stat *, buf);
    PRE_MEM_WRITE( "fstat(buf)", ARG2, sizeof(struct vki_stat) );
 }
@@ -2937,7 +2937,7 @@
    else 
    if (SUCCESS && RES > 0) {
       /* parent */
-      PRINT("   fork: process %d created child %d\n", VG_(getpid)(), RES);
+      PRINT("   fork: process %d created child %ld\n", VG_(getpid)(), RES);
 
       /* restore signal mask */
       VG_(sigprocmask)(VKI_SIG_SETMASK, &fork_saved_mask, NULL);
@@ -2947,14 +2947,14 @@
 PRE(sys_ftruncate)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_ftruncate ( %d, %ld )", ARG1,ARG2);
+   PRINT("sys_ftruncate ( %ld, %ld )", ARG1,ARG2);
    PRE_REG_READ2(long, "ftruncate", unsigned int, fd, unsigned long, length);
 }
 
 PRE(sys_truncate)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_truncate ( %p(%s), %d )", ARG1,ARG1,ARG2);
+   PRINT("sys_truncate ( %#lx(%s), %ld )", ARG1,(char*)ARG1,ARG2);
    PRE_REG_READ2(long, "truncate", 
                  const char *, path, unsigned long, length);
    PRE_MEM_RASCIIZ( "truncate(path)", ARG1 );
@@ -2965,7 +2965,7 @@
 PRE(sys_ftruncate64)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_ftruncate64 ( %d, %lld )", ARG1, LOHI64(ARG2,ARG3));
+   PRINT("sys_ftruncate64 ( %ld, %lld )", ARG1, LOHI64(ARG2,ARG3));
    PRE_REG_READ3(long, "ftruncate64",
                  unsigned int, fd,
                  vki_u32, length_low32, vki_u32, length_high32);
@@ -2977,7 +2977,7 @@
 PRE(sys_truncate64)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_truncate64 ( %p, %lld )", ARG1, LOHI64(ARG2, ARG3));
+   PRINT("sys_truncate64 ( %#lx, %lld )", ARG1, LOHI64(ARG2, ARG3));
    PRE_REG_READ3(long, "truncate64",
                  const char *, path,
                  vki_u32, length_low32, vki_u32, length_high32);
@@ -2988,7 +2988,7 @@
 PRE(sys_getdents)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_getdents ( %d, %p, %d )", ARG1,ARG2,ARG3);
+   PRINT("sys_getdents ( %ld, %#lx, %ld )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "getdents",
                  unsigned int, fd, struct linux_dirent *, dirp,
                  unsigned int, count);
@@ -3005,7 +3005,7 @@
 PRE(sys_getdents64)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_getdents64 ( %d, %p, %d )",ARG1,ARG2,ARG3);
+   PRINT("sys_getdents64 ( %ld, %#lx, %ld )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "getdents64",
                  unsigned int, fd, struct linux_dirent64 *, dirp,
                  unsigned int, count);
@@ -3021,7 +3021,7 @@
 
 PRE(sys_getgroups)
 {
-   PRINT("sys_getgroups ( %d, %p )", ARG1, ARG2);
+   PRINT("sys_getgroups ( %ld, %#lx )", ARG1, ARG2);
    PRE_REG_READ2(long, "getgroups", int, size, vki_gid_t *, list);
    if (ARG1 > 0)
       PRE_MEM_WRITE( "getgroups(list)", ARG2, ARG1 * sizeof(vki_gid_t) );
@@ -3042,7 +3042,7 @@
    //   (which includes the ending '\0' character), or a negative error
    //   value.
    // Is this Linux-specific?  If so it should be moved to syswrap-linux.c.
-   PRINT("sys_getcwd ( %p, %llu )", ARG1,(ULong)ARG2);
+   PRINT("sys_getcwd ( %#lx, %llu )", ARG1,(ULong)ARG2);
    PRE_REG_READ2(long, "getcwd", char *, buf, unsigned long, size);
    PRE_MEM_WRITE( "getcwd(buf)", ARG1, ARG2 );
 }
@@ -3080,7 +3080,7 @@
 
 PRE(sys_getpgid)
 {
-   PRINT("sys_getpgid ( %d )", ARG1);
+   PRINT("sys_getpgid ( %ld )", ARG1);
    PRE_REG_READ1(long, "getpgid", vki_pid_t, pid);
 }
 
@@ -3118,7 +3118,7 @@
 
 PRE(sys_old_getrlimit)
 {
-   PRINT("sys_old_getrlimit ( %d, %p )", ARG1,ARG2);
+   PRINT("sys_old_getrlimit ( %ld, %#lx )", ARG1,ARG2);
    PRE_REG_READ2(long, "old_getrlimit",
                  unsigned int, resource, struct rlimit *, rlim);
    PRE_MEM_WRITE( "old_getrlimit(rlim)", ARG2, sizeof(struct vki_rlimit) );
@@ -3131,7 +3131,7 @@
 
 PRE(sys_getrlimit)
 {
-   PRINT("sys_getrlimit ( %d, %p )", ARG1,ARG2);
+   PRINT("sys_getrlimit ( %ld, %#lx )", ARG1,ARG2);
    PRE_REG_READ2(long, "getrlimit",
                  unsigned int, resource, struct rlimit *, rlim);
    PRE_MEM_WRITE( "getrlimit(rlim)", ARG2, sizeof(struct vki_rlimit) );
@@ -3144,7 +3144,7 @@
 
 PRE(sys_getrusage)
 {
-   PRINT("sys_getrusage ( %d, %p )", ARG1,ARG2);
+   PRINT("sys_getrusage ( %ld, %#lx )", ARG1,ARG2);
    PRE_REG_READ2(long, "getrusage", int, who, struct rusage *, usage);
    PRE_MEM_WRITE( "getrusage(usage)", ARG2, sizeof(struct vki_rusage) );
 }
@@ -3158,7 +3158,7 @@
 
 PRE(sys_gettimeofday)
 {
-   PRINT("sys_gettimeofday ( %p, %p )", ARG1,ARG2);
+   PRINT("sys_gettimeofday ( %#lx, %#lx )", ARG1,ARG2);
    PRE_REG_READ2(long, "gettimeofday",
                  struct timeval *, tv, struct timezone *, tz);
    PRE_MEM_WRITE( "gettimeofday(tv)", ARG1, sizeof(struct vki_timeval) );
@@ -3178,7 +3178,7 @@
 
 PRE(sys_settimeofday)
 {
-   PRINT("sys_settimeofday ( %p, %p )", ARG1,ARG2);
+   PRINT("sys_settimeofday ( %#lx, %#lx )", ARG1,ARG2);
    PRE_REG_READ2(long, "settimeofday",
                  struct timeval *, tv, struct timezone *, tz);
    PRE_MEM_READ( "settimeofday(tv)", ARG1, sizeof(struct vki_timeval) );
@@ -3198,7 +3198,7 @@
 PRE(sys_ioctl)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_ioctl ( %d, 0x%x, %p )",ARG1,ARG2,ARG3);
+   PRINT("sys_ioctl ( %ld, 0x%lx, %#lx )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "ioctl",
                  unsigned int, fd, unsigned int, request, unsigned long, arg);
 
@@ -4186,7 +4186,7 @@
 	 if (moans > 0 && !VG_(clo_xml)) {
 	    moans--;
 	    VG_(message)(Vg_UserMsg, 
-			 "Warning: noted but unhandled ioctl 0x%x"
+			 "Warning: noted but unhandled ioctl 0x%lx"
 			 " with no size/direction hints",
 			 ARG2); 
 	    VG_(message)(Vg_UserMsg, 
@@ -4952,7 +4952,7 @@
 
 PRE(sys_kill)
 {
-   PRINT("sys_kill ( %d, %d )", ARG1,ARG2);
+   PRINT("sys_kill ( %ld, %ld )", ARG1,ARG2);
    PRE_REG_READ2(long, "kill", int, pid, int, sig);
    if (!ML_(client_signal_OK)(ARG2)) {
       SET_STATUS_Failure( VKI_EINVAL );
@@ -4967,7 +4967,7 @@
       SET_STATUS_from_SysRes( VG_(do_syscall2)(SYSNO, ARG1, ARG2) );
 
    if (VG_(clo_trace_signals))
-      VG_(message)(Vg_DebugMsg, "kill: sent signal %d to pid %d",
+      VG_(message)(Vg_DebugMsg, "kill: sent signal %ld to pid %ld",
 		   ARG2, ARG1);
 
    /* This kill might have given us a pending signal.  Ask for a check once 
@@ -4978,7 +4978,7 @@
 PRE(sys_link)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_link ( %p(%s), %p(%s) )", ARG1,ARG1,ARG2,ARG2);
+   PRINT("sys_link ( %#lx(%s), %#lx(%s) )", ARG1,(char*)ARG1,ARG2,(char*)ARG2);
    PRE_REG_READ2(long, "link", const char *, oldpath, const char *, newpath);
    PRE_MEM_RASCIIZ( "link(oldpath)", ARG1);
    PRE_MEM_RASCIIZ( "link(newpath)", ARG2);
@@ -4986,7 +4986,7 @@
 
 PRE(sys_newlstat)
 {
-   PRINT("sys_newlstat ( %p(%s), %p )", ARG1,ARG1,ARG2);
+   PRINT("sys_newlstat ( %#lx(%s), %#lx )", ARG1,(char*)ARG1,ARG2);
    PRE_REG_READ2(long, "lstat", char *, file_name, struct stat *, buf);
    PRE_MEM_RASCIIZ( "lstat(file_name)", ARG1 );
    PRE_MEM_WRITE( "lstat(buf)", ARG2, sizeof(struct vki_stat) );
@@ -5003,14 +5003,14 @@
 PRE(sys_mkdir)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_mkdir ( %p(%s), %d )", ARG1,ARG1,ARG2);
+   PRINT("sys_mkdir ( %#lx(%s), %ld )", ARG1,(char*)ARG1,ARG2);
    PRE_REG_READ2(long, "mkdir", const char *, pathname, int, mode);
    PRE_MEM_RASCIIZ( "mkdir(pathname)", ARG1 );
 }
 
 PRE(sys_mprotect)
 {
-   PRINT("sys_mprotect ( %p, %llu, %d )", ARG1,(ULong)ARG2,ARG3);
+   PRINT("sys_mprotect ( %#lx, %llu, %ld )", ARG1,(ULong)ARG2,ARG3);
    PRE_REG_READ3(long, "mprotect",
                  unsigned long, addr, vki_size_t, len, unsigned long, prot);
 
@@ -5091,8 +5091,8 @@
 
 PRE(sys_munmap)
 {
-   if (0) VG_(printf)("  munmap( %p )\n", ARG1);
-   PRINT("sys_munmap ( %p, %llu )", ARG1,(ULong)ARG2);
+   if (0) VG_(printf)("  munmap( %#lx )\n", ARG1);
+   PRINT("sys_munmap ( %#lx, %llu )", ARG1,(ULong)ARG2);
    PRE_REG_READ2(long, "munmap", unsigned long, start, vki_size_t, length);
 
    if (!ML_(valid_client_addr)(ARG1, ARG2, tid, "munmap"))
@@ -5116,7 +5116,7 @@
 
 PRE(sys_mincore)
 {
-   PRINT("sys_mincore ( %p, %llu, %p )", ARG1,(ULong)ARG2,ARG3);
+   PRINT("sys_mincore ( %#lx, %llu, %#lx )", ARG1,(ULong)ARG2,ARG3);
    PRE_REG_READ3(long, "mincore",
                  unsigned long, start, vki_size_t, length,
                  unsigned char *, vec);
@@ -5130,7 +5130,7 @@
 PRE(sys_nanosleep)
 {
    *flags |= SfMayBlock|SfPostOnFail;
-   PRINT("sys_nanosleep ( %p, %p )", ARG1,ARG2);
+   PRINT("sys_nanosleep ( %#lx, %#lx )", ARG1,ARG2);
    PRE_REG_READ2(long, "nanosleep", 
                  struct timespec *, req, struct timespec *, rem);
    PRE_MEM_READ( "nanosleep(req)", ARG1, sizeof(struct vki_timespec) );
@@ -5152,12 +5152,12 @@
 
    if (ARG2 & VKI_O_CREAT) {
       // 3-arg version
-      PRINT("sys_open ( %p(%s), %d, %d )",ARG1,ARG1,ARG2,ARG3);
+      PRINT("sys_open ( %#lx(%s), %ld, %ld )",ARG1,(char*)ARG1,ARG2,ARG3);
       PRE_REG_READ3(long, "open",
                     const char *, filename, int, flags, int, mode);
    } else {
       // 2-arg version
-      PRINT("sys_open ( %p(%s), %d )",ARG1,ARG1,ARG2);
+      PRINT("sys_open ( %#lx(%s), %ld )",ARG1,(char*)ARG1,ARG2);
       PRE_REG_READ2(long, "open",
                     const char *, filename, int, flags);
    }
@@ -5201,7 +5201,7 @@
 PRE(sys_read)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_read ( %d, %p, %llu )", ARG1, ARG2, (ULong)ARG3);
+   PRINT("sys_read ( %ld, %#lx, %llu )", ARG1, ARG2, (ULong)ARG3);
    PRE_REG_READ3(ssize_t, "read",
                  unsigned int, fd, char *, buf, vki_size_t, count);
 
@@ -5221,7 +5221,7 @@
 {
    Bool ok;
    *flags |= SfMayBlock;
-   PRINT("sys_write ( %d, %p, %llu )", ARG1, ARG2, (ULong)ARG3);
+   PRINT("sys_write ( %ld, %#lx, %llu )", ARG1, ARG2, (ULong)ARG3);
    PRE_REG_READ3(ssize_t, "write",
                  unsigned int, fd, const char *, buf, vki_size_t, count);
    /* check to see if it is allowed.  If not, try for an exemption from
@@ -5239,7 +5239,7 @@
 PRE(sys_creat)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_creat ( %p(%s), %d )", ARG1,ARG1,ARG2);
+   PRINT("sys_creat ( %#lx(%s), %ld )", ARG1,(char*)ARG1,ARG2);
    PRE_REG_READ2(long, "creat", const char *, pathname, int, mode);
    PRE_MEM_RASCIIZ( "creat(pathname)", ARG1 );
 }
@@ -5268,7 +5268,7 @@
    UInt i;
    struct vki_pollfd* ufds = (struct vki_pollfd *)ARG1;
    *flags |= SfMayBlock;
-   PRINT("sys_poll ( %p, %d, %d )\n", ARG1,ARG2,ARG3);
+   PRINT("sys_poll ( %#lx, %ld, %ld )\n", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "poll",
                  struct vki_pollfd *, ufds, unsigned int, nfds, long, timeout);
 
@@ -5297,7 +5297,7 @@
    HChar name[25];
    Word  saved = SYSNO;
 
-   PRINT("sys_readlink ( %p(%s), %p, %llu )", ARG1,ARG1,ARG2,(ULong)ARG3);
+   PRINT("sys_readlink ( %#lx(%s), %#lx, %llu )", ARG1,(char*)ARG1,ARG2,(ULong)ARG3);
    PRE_REG_READ3(long, "readlink",
                  const char *, path, char *, buf, int, bufsiz);
    PRE_MEM_RASCIIZ( "readlink(path)", ARG1 );
@@ -5328,7 +5328,7 @@
    Int i;
    struct vki_iovec * vec;
    *flags |= SfMayBlock;
-   PRINT("sys_readv ( %d, %p, %llu )",ARG1,ARG2,(ULong)ARG3);
+   PRINT("sys_readv ( %ld, %#lx, %llu )",ARG1,ARG2,(ULong)ARG3);
    PRE_REG_READ3(ssize_t, "readv",
                  unsigned long, fd, const struct iovec *, vector,
                  unsigned long, count);
@@ -5368,7 +5368,7 @@
 
 PRE(sys_rename)
 {
-   PRINT("sys_rename ( %p(%s), %p(%s) )", ARG1,ARG1,ARG2,ARG2);
+   PRINT("sys_rename ( %#lx(%s), %#lx(%s) )", ARG1,(char*)ARG1,ARG2,(char*)ARG2);
    PRE_REG_READ2(long, "rename", const char *, oldpath, const char *, newpath);
    PRE_MEM_RASCIIZ( "rename(oldpath)", ARG1 );
    PRE_MEM_RASCIIZ( "rename(newpath)", ARG2 );
@@ -5377,7 +5377,7 @@
 PRE(sys_rmdir)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_rmdir ( %p(%s) )", ARG1,ARG1);
+   PRINT("sys_rmdir ( %#lx(%s) )", ARG1,(char*)ARG1);
    PRE_REG_READ1(long, "rmdir", const char *, pathname);
    PRE_MEM_RASCIIZ( "rmdir(pathname)", ARG1 );
 }
@@ -5385,7 +5385,7 @@
 PRE(sys_select)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_select ( %d, %p, %p, %p, %p )", ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_select ( %ld, %#lx, %#lx, %#lx, %#lx )", ARG1,ARG2,ARG3,ARG4,ARG5);
    PRE_REG_READ5(long, "select",
                  int, n, vki_fd_set *, readfds, vki_fd_set *, writefds,
                  vki_fd_set *, exceptfds, struct vki_timeval *, timeout);
@@ -5405,7 +5405,7 @@
 
 PRE(sys_setgid)
 {
-   PRINT("sys_setgid ( %d )", ARG1);
+   PRINT("sys_setgid ( %ld )", ARG1);
    PRE_REG_READ1(long, "setgid", vki_gid_t, gid);
 }
 
@@ -5417,7 +5417,7 @@
 
 PRE(sys_setgroups)
 {
-   PRINT("setgroups ( %llu, %p )", (ULong)ARG1, ARG2);
+   PRINT("setgroups ( %llu, %#lx )", (ULong)ARG1, ARG2);
    PRE_REG_READ2(long, "setgroups", int, size, vki_gid_t *, list);
    if (ARG1 > 0)
       PRE_MEM_READ( "setgroups(list)", ARG2, ARG1 * sizeof(vki_gid_t) );
@@ -5425,25 +5425,25 @@
 
 PRE(sys_setpgid)
 {
-   PRINT("setpgid ( %d, %d )", ARG1, ARG2);
+   PRINT("setpgid ( %ld, %ld )", ARG1, ARG2);
    PRE_REG_READ2(long, "setpgid", vki_pid_t, pid, vki_pid_t, pgid);
 }
 
 PRE(sys_setregid)
 {
-   PRINT("sys_setregid ( %d, %d )", ARG1, ARG2);
+   PRINT("sys_setregid ( %ld, %ld )", ARG1, ARG2);
    PRE_REG_READ2(long, "setregid", vki_gid_t, rgid, vki_gid_t, egid);
 }
 
 PRE(sys_setreuid)
 {
-   PRINT("sys_setreuid ( 0x%x, 0x%x )", ARG1, ARG2);
+   PRINT("sys_setreuid ( 0x%lx, 0x%lx )", ARG1, ARG2);
    PRE_REG_READ2(long, "setreuid", vki_uid_t, ruid, vki_uid_t, euid);
 }
 
 PRE(sys_setrlimit)
 {
-   PRINT("sys_setrlimit ( %d, %p )", ARG1,ARG2);
+   PRINT("sys_setrlimit ( %ld, %#lx )", ARG1,ARG2);
    PRE_REG_READ2(long, "setrlimit",
                  unsigned int, resource, struct rlimit *, rlim);
    PRE_MEM_READ( "setrlimit(rlim)", ARG2, sizeof(struct vki_rlimit) );
@@ -5483,13 +5483,13 @@
 
 PRE(sys_setuid)
 {
-   PRINT("sys_setuid ( %d )", ARG1);
+   PRINT("sys_setuid ( %ld )", ARG1);
    PRE_REG_READ1(long, "setuid", vki_uid_t, uid);
 }
 
 PRE(sys_newstat)
 {
-   PRINT("sys_newstat ( %p(%s), %p )", ARG1,ARG1,ARG2);
+   PRINT("sys_newstat ( %#lx(%s), %#lx )", ARG1,(char*)ARG1,ARG2);
    PRE_REG_READ2(long, "stat", char *, file_name, struct stat *, buf);
    PRE_MEM_RASCIIZ( "stat(file_name)", ARG1 );
    PRE_MEM_WRITE( "stat(buf)", ARG2, sizeof(struct vki_stat) );
@@ -5502,7 +5502,7 @@
 
 PRE(sys_statfs)
 {
-   PRINT("sys_statfs ( %p(%s), %p )",ARG1,ARG1,ARG2);
+   PRINT("sys_statfs ( %#lx(%s), %#lx )",ARG1,(char*)ARG1,ARG2);
    PRE_REG_READ2(long, "statfs", const char *, path, struct statfs *, buf);
    PRE_MEM_RASCIIZ( "statfs(path)", ARG1 );
    PRE_MEM_WRITE( "statfs(buf)", ARG2, sizeof(struct vki_statfs) );
@@ -5514,7 +5514,7 @@
 
 PRE(sys_statfs64)
 {
-   PRINT("sys_statfs64 ( %p(%s), %llu, %p )",ARG1,ARG1,(ULong)ARG2,ARG3);
+   PRINT("sys_statfs64 ( %#lx(%s), %llu, %#lx )",ARG1,(char*)ARG1,(ULong)ARG2,ARG3);
    PRE_REG_READ3(long, "statfs64",
                  const char *, path, vki_size_t, size, struct statfs64 *, buf);
    PRE_MEM_RASCIIZ( "statfs64(path)", ARG1 );
@@ -5528,7 +5528,7 @@
 PRE(sys_symlink)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_symlink ( %p(%s), %p(%s) )",ARG1,ARG1,ARG2,ARG2);
+   PRINT("sys_symlink ( %#lx(%s), %#lx(%s) )",ARG1,(char*)ARG1,ARG2,(char*)ARG2);
    PRE_REG_READ2(long, "symlink", const char *, oldpath, const char *, newpath);
    PRE_MEM_RASCIIZ( "symlink(oldpath)", ARG1 );
    PRE_MEM_RASCIIZ( "symlink(newpath)", ARG2 );
@@ -5537,7 +5537,7 @@
 PRE(sys_time)
 {
    /* time_t time(time_t *t); */
-   PRINT("sys_time ( %p )",ARG1);
+   PRINT("sys_time ( %#lx )",ARG1);
    PRE_REG_READ1(long, "time", int *, t);
    if (ARG1 != 0) {
       PRE_MEM_WRITE( "time(t)", ARG1, sizeof(vki_time_t) );
@@ -5553,7 +5553,7 @@
 
 PRE(sys_times)
 {
-   PRINT("sys_times ( %p )", ARG1);
+   PRINT("sys_times ( %#lx )", ARG1);
    PRE_REG_READ1(long, "times", struct tms *, buf);
    if (ARG1 != 0) {
       PRE_MEM_WRITE( "times(buf)", ARG1, sizeof(struct vki_tms) );
@@ -5569,21 +5569,21 @@
 
 PRE(sys_umask)
 {
-   PRINT("sys_umask ( %d )", ARG1);
+   PRINT("sys_umask ( %ld )", ARG1);
    PRE_REG_READ1(long, "umask", int, mask);
 }
 
 PRE(sys_unlink)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_unlink ( %p(%s) )", ARG1,ARG1);
+   PRINT("sys_unlink ( %#lx(%s) )", ARG1,(char*)ARG1);
    PRE_REG_READ1(long, "unlink", const char *, pathname);
    PRE_MEM_RASCIIZ( "unlink(pathname)", ARG1 );
 }
 
 PRE(sys_newuname)
 {
-   PRINT("sys_newuname ( %p )", ARG1);
+   PRINT("sys_newuname ( %#lx )", ARG1);
    PRE_REG_READ1(long, "uname", struct new_utsname *, buf);
    PRE_MEM_WRITE( "uname(buf)", ARG1, sizeof(struct vki_new_utsname) );
 }
@@ -5598,7 +5598,7 @@
 PRE(sys_waitpid)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_waitpid ( %d, %p, %d )", ARG1,ARG2,ARG3);
+   PRINT("sys_waitpid ( %ld, %#lx, %ld )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "waitpid", 
                  vki_pid_t, pid, unsigned int *, status, int, options);
 
@@ -5615,7 +5615,7 @@
 PRE(sys_wait4)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_wait4 ( %d, %p, %d, %p )", ARG1,ARG2,ARG3,ARG4);
+   PRINT("sys_wait4 ( %ld, %#lx, %ld, %#lx )", ARG1,ARG2,ARG3,ARG4);
 
    PRE_REG_READ4(long, "wait4", 
                  vki_pid_t, pid, unsigned int *, status, int, options,
@@ -5639,7 +5639,7 @@
    Int i;
    struct vki_iovec * vec;
    *flags |= SfMayBlock;
-   PRINT("sys_writev ( %d, %p, %llu )",ARG1,ARG2,(ULong)ARG3);
+   PRINT("sys_writev ( %ld, %#lx, %llu )",ARG1,ARG2,(ULong)ARG3);
    PRE_REG_READ3(ssize_t, "writev",
                  unsigned long, fd, const struct iovec *, vector,
                  unsigned long, count);
@@ -5660,7 +5660,7 @@
 
 PRE(sys_utimes)
 {
-   PRINT("sys_utimes ( %p(%s), %p )", ARG1,ARG1,ARG2);
+   PRINT("sys_utimes ( %#lx(%s), %#lx )", ARG1,(char*)ARG1,ARG2);
    PRE_REG_READ2(long, "utimes", char *, filename, struct timeval *, tvp);
    PRE_MEM_RASCIIZ( "utimes(filename)", ARG1 );
    if (ARG2 != 0)
@@ -5669,7 +5669,7 @@
 
 PRE(sys_acct)
 {
-   PRINT("sys_acct ( %p(%s) )", ARG1,ARG1);
+   PRINT("sys_acct ( %#lx(%s) )", ARG1,(char*)ARG1);
    PRE_REG_READ1(long, "acct", const char *, filename);
    PRE_MEM_RASCIIZ( "acct(filename)", ARG1 );
 }
@@ -5684,7 +5684,7 @@
 // XXX: x86-specific
 PRE(sys_sigaltstack)
 {
-   PRINT("sigaltstack ( %p, %p )",ARG1,ARG2);
+   PRINT("sigaltstack ( %#lx, %#lx )",ARG1,ARG2);
    PRE_REG_READ2(int, "sigaltstack",
                  const vki_stack_t *, ss, vki_stack_t *, oss);
    if (ARG1 != 0) {
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index ed57e76..f1950dd 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -347,7 +347,7 @@
    if (!res.isError && res.res > 0) {
       /* parent */
       if (VG_(clo_trace_syscalls))
-	  VG_(printf)("   clone(fork): process %d created child %d\n", 
+	  VG_(printf)("   clone(fork): process %d created child %ld\n",
                       VG_(getpid)(), res.res);
 
       /* restore signal mask */
@@ -381,7 +381,7 @@
    // We are conservative and check everything, except the memory pointed to
    // by 'data'.
    *flags |= SfMayBlock;
-   PRINT( "sys_mount( %p, %p, %p, %p, %p )" ,ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT( "sys_mount( %#lx, %#lx, %#lx, %#lx, %#lx )" ,ARG1,ARG2,ARG3,ARG4,ARG5);
    PRE_REG_READ5(long, "mount",
                  char *, source, char *, target, char *, type,
                  unsigned long, flags, void *, data);
@@ -392,14 +392,14 @@
 
 PRE(sys_oldumount)
 {
-   PRINT("sys_oldumount( %p )", ARG1);
+   PRINT("sys_oldumount( %#lx )", ARG1);
    PRE_REG_READ1(long, "umount", char *, path);
    PRE_MEM_RASCIIZ( "umount(path)", ARG1);
 }
 
 PRE(sys_umount)
 {
-   PRINT("sys_umount( %p, %d )", ARG1, ARG2);
+   PRINT("sys_umount( %#lx, %ld )", ARG1, ARG2);
    PRE_REG_READ2(long, "umount2", char *, path, int, flags);
    PRE_MEM_RASCIIZ( "umount2(path)", ARG1);
 }
@@ -410,45 +410,45 @@
 
 PRE(sys_setfsuid16)
 {
-   PRINT("sys_setfsuid16 ( %d )", ARG1);
+   PRINT("sys_setfsuid16 ( %ld )", ARG1);
    PRE_REG_READ1(long, "setfsuid16", vki_old_uid_t, uid);
 }
 
 PRE(sys_setfsuid)
 {
-   PRINT("sys_setfsuid ( %d )", ARG1);
+   PRINT("sys_setfsuid ( %ld )", ARG1);
    PRE_REG_READ1(long, "setfsuid", vki_uid_t, uid);
 }
 
 PRE(sys_setfsgid16)
 {
-   PRINT("sys_setfsgid16 ( %d )", ARG1);
+   PRINT("sys_setfsgid16 ( %ld )", ARG1);
    PRE_REG_READ1(long, "setfsgid16", vki_old_gid_t, gid);
 }
 
 PRE(sys_setfsgid)
 {
-   PRINT("sys_setfsgid ( %d )", ARG1);
+   PRINT("sys_setfsgid ( %ld )", ARG1);
    PRE_REG_READ1(long, "setfsgid", vki_gid_t, gid);
 }
 
 PRE(sys_setresuid16)
 {
-   PRINT("sys_setresuid16 ( %d, %d, %d )", ARG1, ARG2, ARG3);
+   PRINT("sys_setresuid16 ( %ld, %ld, %ld )", ARG1, ARG2, ARG3);
    PRE_REG_READ3(long, "setresuid16",
                  vki_old_uid_t, ruid, vki_old_uid_t, euid, vki_old_uid_t, suid);
 }
 
 PRE(sys_setresuid)
 {
-   PRINT("sys_setresuid ( %d, %d, %d )", ARG1, ARG2, ARG3);
+   PRINT("sys_setresuid ( %ld, %ld, %ld )", ARG1, ARG2, ARG3);
    PRE_REG_READ3(long, "setresuid",
                  vki_uid_t, ruid, vki_uid_t, euid, vki_uid_t, suid);
 }
 
 PRE(sys_getresuid16)
 {
-   PRINT("sys_getresuid16 ( %p, %p, %p )", ARG1,ARG2,ARG3);
+   PRINT("sys_getresuid16 ( %#lx, %#lx, %#lx )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "getresuid16",
                  vki_old_uid_t *, ruid, vki_old_uid_t *, euid,
                  vki_old_uid_t *, suid);
@@ -468,7 +468,7 @@
 
 PRE(sys_getresuid)
 {
-   PRINT("sys_getresuid ( %p, %p, %p )", ARG1,ARG2,ARG3);
+   PRINT("sys_getresuid ( %#lx, %#lx, %#lx )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "getresuid", 
                  vki_uid_t *, ruid, vki_uid_t *, euid, vki_uid_t *, suid);
    PRE_MEM_WRITE( "getresuid(ruid)", ARG1, sizeof(vki_uid_t) );
@@ -487,7 +487,7 @@
 
 PRE(sys_setresgid16)
 {
-   PRINT("sys_setresgid16 ( %d, %d, %d )", ARG1, ARG2, ARG3);
+   PRINT("sys_setresgid16 ( %ld, %ld, %ld )", ARG1, ARG2, ARG3);
    PRE_REG_READ3(long, "setresgid16",
                  vki_old_gid_t, rgid, 
                  vki_old_gid_t, egid, vki_old_gid_t, sgid);
@@ -495,14 +495,14 @@
 
 PRE(sys_setresgid)
 {
-   PRINT("sys_setresgid ( %d, %d, %d )", ARG1, ARG2, ARG3);
+   PRINT("sys_setresgid ( %ld, %ld, %ld )", ARG1, ARG2, ARG3);
    PRE_REG_READ3(long, "setresgid",
                  vki_gid_t, rgid, vki_gid_t, egid, vki_gid_t, sgid);
 }
 
 PRE(sys_getresgid16)
 {
-   PRINT("sys_getresgid16 ( %p, %p, %p )", ARG1,ARG2,ARG3);
+   PRINT("sys_getresgid16 ( %#lx, %#lx, %#lx )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "getresgid16",
                  vki_old_gid_t *, rgid, vki_old_gid_t *, egid,
                  vki_old_gid_t *, sgid);
@@ -522,7 +522,7 @@
 
 PRE(sys_getresgid)
 {
-   PRINT("sys_getresgid ( %p, %p, %p )", ARG1,ARG2,ARG3);
+   PRINT("sys_getresgid ( %#lx, %#lx, %#lx )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "getresgid", 
                  vki_gid_t *, rgid, vki_gid_t *, egid, vki_gid_t *, sgid);
    PRE_MEM_WRITE( "getresgid(rgid)", ARG1, sizeof(vki_gid_t) );
@@ -548,7 +548,7 @@
    ThreadId     t;
    ThreadState* tst;
 
-   PRINT("exit_group( %d )", ARG1);
+   PRINT("exit_group( %ld )", ARG1);
    PRE_REG_READ1(void, "exit_group", int, exit_code);
 
    tst = VG_(get_ThreadState)(tid);
@@ -577,7 +577,7 @@
 
 PRE(sys_llseek)
 {
-   PRINT("sys_llseek ( %d, 0x%x, 0x%x, %p, %d )", ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_llseek ( %ld, 0x%lx, 0x%lx, %#lx, %ld )", ARG1,ARG2,ARG3,ARG4,ARG5);
    PRE_REG_READ5(long, "llseek",
                  unsigned int, fd, unsigned long, offset_high,
                  unsigned long, offset_low, vki_loff_t *, result,
@@ -625,7 +625,7 @@
 
 PRE(sys_ioperm)
 {
-   PRINT("sys_ioperm ( %d, %d, %d )", ARG1, ARG2, ARG3 );
+   PRINT("sys_ioperm ( %ld, %ld, %ld )", ARG1, ARG2, ARG3 );
    PRE_REG_READ3(long, "ioperm",
                  unsigned long, from, unsigned long, num, int, turn_on);
 }
@@ -633,7 +633,7 @@
 PRE(sys_syslog)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_syslog (%d, %p, %d)", ARG1,ARG2,ARG3);
+   PRINT("sys_syslog (%ld, %#lx, %ld)", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "syslog", int, type, char *, bufp, int, len);
    switch (ARG1) {
    // The kernel uses magic numbers here, rather than named constants,
@@ -664,7 +664,7 @@
 
 PRE(sys_sysinfo)
 {
-   PRINT("sys_sysinfo ( %p )",ARG1);
+   PRINT("sys_sysinfo ( %#lx )",ARG1);
    PRE_REG_READ1(long, "sysinfo", struct sysinfo *, info);
    PRE_MEM_WRITE( "sysinfo(info)", ARG1, sizeof(struct vki_sysinfo) );
 }
@@ -682,7 +682,7 @@
 PRE(sys_sysctl)
 {
    struct __vki_sysctl_args *args;
-   PRINT("sys_sysctl ( %p )", ARG1 );
+   PRINT("sys_sysctl ( %#lx )", ARG1 );
    args = (struct __vki_sysctl_args *)ARG1;
    PRE_REG_READ1(long, "sysctl", struct __sysctl_args *, args);
    PRE_MEM_WRITE( "sysctl(args)", ARG1, sizeof(struct __vki_sysctl_args) );
@@ -713,7 +713,7 @@
 PRE(sys_prctl)
 {
    *flags |= SfMayBlock;
-   PRINT( "sys_prctl ( %d, %d, %d, %d, %d )", ARG1, ARG2, ARG3, ARG4, ARG5 );
+   PRINT( "sys_prctl ( %ld, %ld, %ld, %ld, %ld )", ARG1, ARG2, ARG3, ARG4, ARG5 );
    switch (ARG1) {
    case VKI_PR_SET_PDEATHSIG:
       PRE_REG_READ2(int, "prctl", int, option, int, signal);
@@ -810,7 +810,7 @@
 PRE(sys_sendfile)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_sendfile ( %d, %d, %p, %lu )", ARG1,ARG2,ARG3,ARG4);
+   PRINT("sys_sendfile ( %ld, %ld, %#lx, %lu )", ARG1,ARG2,ARG3,ARG4);
    PRE_REG_READ4(ssize_t, "sendfile",
                  int, out_fd, int, in_fd, vki_off_t *, offset,
                  vki_size_t, count);
@@ -827,7 +827,7 @@
 PRE(sys_sendfile64)
 {
    *flags |= SfMayBlock;
-   PRINT("sendfile64 ( %d, %d, %p, %lu )",ARG1,ARG2,ARG3,ARG4);
+   PRINT("sendfile64 ( %ld, %ld, %#lx, %lu )",ARG1,ARG2,ARG3,ARG4);
    PRE_REG_READ4(ssize_t, "sendfile64",
                  int, out_fd, int, in_fd, vki_loff_t *, offset,
                  vki_size_t, count);
@@ -853,7 +853,7 @@
       ARG5 - u32 *uaddr2			REQUEUE,CMP_REQUEUE
       ARG6 - int val3				CMP_REQUEUE
     */
-   PRINT("sys_futex ( %p, %d, %d, %p, %p )", ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_futex ( %#lx, %ld, %ld, %#lx, %#lx )", ARG1,ARG2,ARG3,ARG4,ARG5);
    switch(ARG2) {
    case VKI_FUTEX_CMP_REQUEUE:
    case VKI_FUTEX_CMP_REQUEUE | VKI_FUTEX_PRIVATE_FLAG:
@@ -930,7 +930,7 @@
 
 PRE(sys_set_robust_list)
 {
-   PRINT("sys_set_robust_list ( %p, %d )", ARG1,ARG2);
+   PRINT("sys_set_robust_list ( %#lx, %ld )", ARG1,ARG2);
    PRE_REG_READ2(long, "set_robust_list", 
                  struct vki_robust_list_head *, head, vki_size_t, len);
 
@@ -943,7 +943,7 @@
 
 PRE(sys_get_robust_list)
 {
-   PRINT("sys_get_robust_list ( %d, %p, %d )", ARG1,ARG2,ARG3);
+   PRINT("sys_get_robust_list ( %ld, %#lx, %ld )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "get_robust_list",
                  int, pid,
                  struct vki_robust_list_head **, head_ptr,
@@ -962,7 +962,7 @@
 PRE(sys_pselect6)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_pselect6 ( %d, %p, %p, %p, %p, %p )", ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
+   PRINT("sys_pselect6 ( %ld, %#lx, %#lx, %#lx, %#lx, %#lx )", ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
    PRE_REG_READ6(long, "pselect6",
                  int, n, vki_fd_set *, readfds, vki_fd_set *, writefds,
                  vki_fd_set *, exceptfds, struct vki_timeval *, timeout,
@@ -988,7 +988,7 @@
    UInt i;
    struct vki_pollfd* ufds = (struct vki_pollfd *)ARG1;
    *flags |= SfMayBlock;
-   PRINT("sys_ppoll ( %p, %d, %p, %p, %llu )\n", ARG1,ARG2,ARG3,ARG4,(ULong)ARG5);
+   PRINT("sys_ppoll ( %#lx, %ld, %#lx, %#lx, %llu )\n", ARG1,ARG2,ARG3,ARG4,(ULong)ARG5);
    PRE_REG_READ5(long, "ppoll",
                  struct vki_pollfd *, ufds, unsigned int, nfds,
                  struct vki_timespec *, tsp, vki_sigset_t *, sigmask,
@@ -1026,7 +1026,7 @@
 
 PRE(sys_epoll_create)
 {
-   PRINT("sys_epoll_create ( %d )", ARG1);
+   PRINT("sys_epoll_create ( %ld )", ARG1);
    PRE_REG_READ1(long, "epoll_create", int, size);
 }
 POST(sys_epoll_create)
@@ -1048,7 +1048,7 @@
       "EPOLL_CTL_DEL",
       "EPOLL_CTL_MOD"
    };
-   PRINT("sys_epoll_ctl ( %d, %s, %d, %p )", 
+   PRINT("sys_epoll_ctl ( %ld, %s, %ld, %#lx )",
          ARG1, ( ARG2<3 ? epoll_ctl_s[ARG2] : "?" ), ARG3, ARG4);
    PRE_REG_READ4(long, "epoll_ctl",
                  int, epfd, int, op, int, fd, struct vki_epoll_event *, event);
@@ -1059,7 +1059,7 @@
 PRE(sys_epoll_wait)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_epoll_wait ( %d, %p, %d, %d )", ARG1, ARG2, ARG3, ARG4);
+   PRINT("sys_epoll_wait ( %ld, %#lx, %ld, %ld )", ARG1, ARG2, ARG3, ARG4);
    PRE_REG_READ4(long, "epoll_wait",
                  int, epfd, struct vki_epoll_event *, events,
                  int, maxevents, int, timeout);
@@ -1075,7 +1075,7 @@
 PRE(sys_epoll_pwait)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_epoll_pwait ( %d, %p, %d, %d, %p, %llu )", ARG1,ARG2,ARG3,ARG4,ARG5,(ULong)ARG6);
+   PRINT("sys_epoll_pwait ( %ld, %#lx, %ld, %ld, %#lx, %llu )", ARG1,ARG2,ARG3,ARG4,ARG5,(ULong)ARG6);
    PRE_REG_READ6(long, "epoll_pwait",
                  int, epfd, struct vki_epoll_event *, events,
                  int, maxevents, int, timeout, vki_sigset_t *, sigmask,
@@ -1093,7 +1093,7 @@
 
 PRE(sys_eventfd)
 {
-   PRINT("sys_eventfd ( %u )", ARG1);
+   PRINT("sys_eventfd ( %lu )", ARG1);
    PRE_REG_READ1(long, "sys_eventfd", unsigned int, count);
 }
 POST(sys_eventfd)
@@ -1119,13 +1119,13 @@
 
 PRE(sys_set_tid_address)
 {
-   PRINT("sys_set_tid_address ( %p )", ARG1);
+   PRINT("sys_set_tid_address ( %#lx )", ARG1);
    PRE_REG_READ1(long, "set_tid_address", int *, tidptr);
 }
 
 PRE(sys_tkill)
 {
-   PRINT("sys_tgkill ( %d, %d )", ARG1,ARG2);
+   PRINT("sys_tgkill ( %ld, %ld )", ARG1,ARG2);
    PRE_REG_READ2(long, "tkill", int, tid, int, sig);
    if (!ML_(client_signal_OK)(ARG2)) {
       SET_STATUS_Failure( VKI_EINVAL );
@@ -1136,7 +1136,7 @@
    *flags |= SfPollAfter;
 
    if (VG_(clo_trace_signals))
-      VG_(message)(Vg_DebugMsg, "tkill: sending signal %d to pid %d",
+      VG_(message)(Vg_DebugMsg, "tkill: sending signal %ld to pid %ld",
 		   ARG2, ARG1);
 
    /* If we're sending SIGKILL, check to see if the target is one of
@@ -1160,13 +1160,13 @@
 POST(sys_tkill)
 {
    if (VG_(clo_trace_signals))
-      VG_(message)(Vg_DebugMsg, "tkill: sent signal %d to pid %d",
+      VG_(message)(Vg_DebugMsg, "tkill: sent signal %ld to pid %ld",
                    ARG2, ARG1);
 }
 
 PRE(sys_tgkill)
 {
-   PRINT("sys_tgkill ( %d, %d, %d )", ARG1,ARG2,ARG3);
+   PRINT("sys_tgkill ( %ld, %ld, %ld )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "tgkill", int, tgid, int, tid, int, sig);
    if (!ML_(client_signal_OK)(ARG3)) {
       SET_STATUS_Failure( VKI_EINVAL );
@@ -1177,7 +1177,7 @@
    *flags |= SfPollAfter;
 
    if (VG_(clo_trace_signals))
-      VG_(message)(Vg_DebugMsg, "tgkill: sending signal %d to pid %d/%d",
+      VG_(message)(Vg_DebugMsg, "tgkill: sending signal %ld to pid %ld/%ld",
 		   ARG3, ARG1, ARG2);
 
    /* If we're sending SIGKILL, check to see if the target is one of
@@ -1201,7 +1201,7 @@
 POST(sys_tgkill)
 {
    if (VG_(clo_trace_signals))
-      VG_(message)(Vg_DebugMsg, "tgkill: sent signal %d to pid %d/%d",
+      VG_(message)(Vg_DebugMsg, "tgkill: sent signal %ld to pid %ld/%ld",
                    ARG3, ARG1, ARG2);
 }
 
@@ -1211,7 +1211,7 @@
 
 PRE(sys_fadvise64)
 {
-   PRINT("sys_fadvise64 ( %d, %lld, %lu, %d )",
+   PRINT("sys_fadvise64 ( %ld, %lld, %lu, %ld )",
          ARG1, LOHI64(ARG2,ARG3), ARG4, ARG5);
    PRE_REG_READ5(long, "fadvise64",
                  int, fd, vki_u32, offset_low, vki_u32, offset_high,
@@ -1220,7 +1220,7 @@
 
 PRE(sys_fadvise64_64)
 {
-   PRINT("sys_fadvise64_64 ( %d, %lld, %lld, %d )",
+   PRINT("sys_fadvise64_64 ( %ld, %lld, %lld, %ld )",
          ARG1, LOHI64(ARG2,ARG3), LOHI64(ARG4,ARG5), ARG6);
    PRE_REG_READ6(long, "fadvise64_64",
                  int, fd, vki_u32, offset_low, vki_u32, offset_high,
@@ -1237,7 +1237,7 @@
 
 PRE(sys_io_setup)
 {
-   PRINT("sys_io_setup ( %u, %p )", ARG1,ARG2);
+   PRINT("sys_io_setup ( %lu, %#lx )", ARG1,ARG2);
    PRE_REG_READ2(long, "io_setup",
                  unsigned, nr_events, vki_aio_context_t *, ctxp);
    PRE_MEM_WRITE( "io_setup(ctxp)", ARG2, sizeof(vki_aio_context_t) );
@@ -1297,7 +1297,7 @@
 PRE(sys_io_getevents)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_io_getevents ( %llu, %lld, %lld, %p, %p )",
+   PRINT("sys_io_getevents ( %llu, %lld, %lld, %#lx, %#lx )",
          (ULong)ARG1,(Long)ARG2,(Long)ARG3,ARG4,ARG5);
    PRE_REG_READ5(long, "io_getevents",
                  vki_aio_context_t, ctx_id, long, min_nr, long, nr,
@@ -1343,7 +1343,7 @@
 {
    Int i;
 
-   PRINT("sys_io_submit ( %llu, %ld, %p )", (ULong)ARG1,ARG2,ARG3);
+   PRINT("sys_io_submit ( %llu, %ld, %#lx )", (ULong)ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "io_submit",
                  vki_aio_context_t, ctx_id, long, nr,
                  struct iocb **, iocbpp);
@@ -1372,7 +1372,7 @@
 
 PRE(sys_io_cancel)
 {
-   PRINT("sys_io_cancel ( %llu, %p, %p )", (ULong)ARG1,ARG2,ARG3);
+   PRINT("sys_io_cancel ( %llu, %#lx, %#lx )", (ULong)ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "io_cancel",
                  vki_aio_context_t, ctx_id, struct iocb *, iocb,
                  struct io_event *, result);
@@ -1390,7 +1390,7 @@
 
 PRE(sys_mbind)
 {
-   PRINT("sys_mbind ( %p, %lu, %d, %p, %lu, %u )", ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
+   PRINT("sys_mbind ( %#lx, %lu, %ld, %#lx, %lu, %lu )", ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
    PRE_REG_READ6(long, "mbind",
                  unsigned long, start, unsigned long, len,
                  unsigned long, policy, unsigned long *, nodemask,
@@ -1402,7 +1402,7 @@
 
 PRE(sys_set_mempolicy)
 {
-   PRINT("sys_set_mempolicy ( %d, %p, %d )", ARG1,ARG2,ARG3);
+   PRINT("sys_set_mempolicy ( %ld, %#lx, %ld )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "set_mempolicy",
                  int, policy, unsigned long *, nodemask,
                  unsigned long, maxnode);
@@ -1412,7 +1412,7 @@
 
 PRE(sys_get_mempolicy)
 {
-   PRINT("sys_get_mempolicy ( %p, %p, %d, %p, %x )", ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_get_mempolicy ( %#lx, %#lx, %ld, %#lx, %lx )", ARG1,ARG2,ARG3,ARG4,ARG5);
    PRE_REG_READ5(long, "get_mempolicy",
                  int *, policy, unsigned long *, nodemask,
                  unsigned long, maxnode, unsigned long, addr,
@@ -1454,14 +1454,14 @@
 
 PRE(sys_inotify_add_watch)
 {
-   PRINT( "sys_inotify_add_watch ( %d, %p, %x )", ARG1,ARG2,ARG3);
+   PRINT( "sys_inotify_add_watch ( %ld, %#lx, %lx )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "inotify_add_watch", int, fd, char *, path, int, mask);
    PRE_MEM_RASCIIZ( "inotify_add_watch(path)", ARG2 );
 }
 
 PRE(sys_inotify_rm_watch)
 {
-   PRINT( "sys_inotify_rm_watch ( %d, %x )", ARG1,ARG2);
+   PRINT( "sys_inotify_rm_watch ( %ld, %lx )", ARG1,ARG2);
    PRE_REG_READ2(long, "inotify_rm_watch", int, fd, int, wd);
 }
 
@@ -1471,8 +1471,8 @@
 
 PRE(sys_mq_open)
 {
-   PRINT("sys_mq_open( %p(%s), %d, %lld, %p )",
-         ARG1,ARG1,ARG2,(ULong)ARG3,ARG4);
+   PRINT("sys_mq_open( %#lx(%s), %ld, %lld, %#lx )",
+         ARG1,(char*)ARG1,ARG2,(ULong)ARG3,ARG4);
    PRE_REG_READ4(long, "mq_open",
                  const char *, name, int, oflag, vki_mode_t, mode,
                  struct mq_attr *, attr);
@@ -1499,7 +1499,7 @@
 
 PRE(sys_mq_unlink)
 {
-   PRINT("sys_mq_unlink ( %p(%s) )", ARG1,ARG1);
+   PRINT("sys_mq_unlink ( %#lx(%s) )", ARG1,(char*)ARG1);
    PRE_REG_READ1(long, "mq_unlink", const char *, name);
    PRE_MEM_RASCIIZ( "mq_unlink(name)", ARG1 );
 }
@@ -1507,7 +1507,7 @@
 PRE(sys_mq_timedsend)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_mq_timedsend ( %d, %p, %llu, %d, %p )",
+   PRINT("sys_mq_timedsend ( %ld, %#lx, %llu, %ld, %#lx )",
          ARG1,ARG2,(ULong)ARG3,ARG4,ARG5);
    PRE_REG_READ5(long, "mq_timedsend",
                  vki_mqd_t, mqdes, const char *, msg_ptr, vki_size_t, msg_len,
@@ -1525,7 +1525,7 @@
 PRE(sys_mq_timedreceive)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_mq_timedreceive( %d, %p, %llu, %p, %p )",
+   PRINT("sys_mq_timedreceive( %ld, %#lx, %llu, %#lx, %#lx )",
          ARG1,ARG2,(ULong)ARG3,ARG4,ARG5);
    PRE_REG_READ5(ssize_t, "mq_timedreceive",
                  vki_mqd_t, mqdes, char *, msg_ptr, vki_size_t, msg_len,
@@ -1552,7 +1552,7 @@
 
 PRE(sys_mq_notify)
 {
-   PRINT("sys_mq_notify( %d, %p )", ARG1,ARG2 );
+   PRINT("sys_mq_notify( %ld, %#lx )", ARG1,ARG2 );
    PRE_REG_READ2(long, "mq_notify",
                  vki_mqd_t, mqdes, const struct sigevent *, notification);
    if (!ML_(fd_allowed)(ARG1, "mq_notify", tid, False))
@@ -1564,7 +1564,7 @@
 
 PRE(sys_mq_getsetattr)
 {
-   PRINT("sys_mq_getsetattr( %d, %p, %p )", ARG1,ARG2,ARG3 );
+   PRINT("sys_mq_getsetattr( %ld, %#lx, %#lx )", ARG1,ARG2,ARG3 );
    PRE_REG_READ3(long, "mq_getsetattr",
                  vki_mqd_t, mqdes, const struct mq_attr *, mqstat,
                  struct mq_attr *, omqstat);
@@ -1593,7 +1593,7 @@
 
 PRE(sys_clock_settime)
 {
-   PRINT("sys_clock_settime( %d, %p )", ARG1,ARG2);
+   PRINT("sys_clock_settime( %ld, %#lx )", ARG1,ARG2);
    PRE_REG_READ2(long, "clock_settime", 
                  vki_clockid_t, clk_id, const struct timespec *, tp);
    PRE_MEM_READ( "clock_settime(tp)", ARG2, sizeof(struct vki_timespec) );
@@ -1601,7 +1601,7 @@
 
 PRE(sys_clock_gettime)
 {
-   PRINT("sys_clock_gettime( %d, %p )" , ARG1,ARG2);
+   PRINT("sys_clock_gettime( %ld, %#lx )" , ARG1,ARG2);
    PRE_REG_READ2(long, "clock_gettime", 
                  vki_clockid_t, clk_id, struct timespec *, tp);
    PRE_MEM_WRITE( "clock_gettime(tp)", ARG2, sizeof(struct vki_timespec) );
@@ -1613,7 +1613,7 @@
 
 PRE(sys_clock_getres)
 {
-   PRINT("sys_clock_getres( %d, %p )" , ARG1,ARG2);
+   PRINT("sys_clock_getres( %ld, %#lx )" , ARG1,ARG2);
    // Nb: we can't use "RES" as the param name because that's a macro
    // defined above!
    PRE_REG_READ2(long, "clock_getres", 
@@ -1630,7 +1630,7 @@
 PRE(sys_clock_nanosleep)
 {
    *flags |= SfMayBlock|SfPostOnFail;
-   PRINT("sys_clock_nanosleep( %d, %d, %p, %p )", ARG1,ARG2,ARG3,ARG4);
+   PRINT("sys_clock_nanosleep( %ld, %ld, %#lx, %#lx )", ARG1,ARG2,ARG3,ARG4);
    PRE_REG_READ4(int32_t, "clock_nanosleep",
                  vki_clockid_t, clkid, int, flags,
                  const struct timespec *, rqtp, struct timespec *, rmtp);
@@ -1650,7 +1650,7 @@
 
 PRE(sys_timer_create)
 {
-   PRINT("sys_timer_create( %d, %p, %p )", ARG1,ARG2,ARG3);
+   PRINT("sys_timer_create( %ld, %#lx, %#lx )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "timer_create",
                  vki_clockid_t, clockid, struct sigevent *, evp,
                  vki_timer_t *, timerid);
@@ -1665,7 +1665,7 @@
 
 PRE(sys_timer_settime)
 {
-   PRINT("sys_timer_settime( %lld, %d, %p, %p )", (ULong)ARG1,ARG2,ARG3,ARG4);
+   PRINT("sys_timer_settime( %lld, %ld, %#lx, %#lx )", (ULong)ARG1,ARG2,ARG3,ARG4);
    PRE_REG_READ4(long, "timer_settime", 
                  vki_timer_t, timerid, int, flags,
                  const struct itimerspec *, value,
@@ -1684,7 +1684,7 @@
 
 PRE(sys_timer_gettime)
 {
-   PRINT("sys_timer_gettime( %lld, %p )", (ULong)ARG1,ARG2);
+   PRINT("sys_timer_gettime( %lld, %#lx )", (ULong)ARG1,ARG2);
    PRE_REG_READ2(long, "timer_gettime", 
                  vki_timer_t, timerid, struct itimerspec *, value);
    PRE_MEM_WRITE( "timer_gettime(value)", ARG2,
@@ -1697,13 +1697,13 @@
 
 PRE(sys_timer_getoverrun)
 {
-   PRINT("sys_timer_getoverrun( %p )", ARG1);
+   PRINT("sys_timer_getoverrun( %#lx )", ARG1);
    PRE_REG_READ1(long, "timer_getoverrun", vki_timer_t, timerid);
 }
 
 PRE(sys_timer_delete)
 {
-   PRINT("sys_timer_delete( %p )", ARG1);
+   PRINT("sys_timer_delete( %#lx )", ARG1);
    PRE_REG_READ1(long, "timer_delete", vki_timer_t, timerid);
 }
 
@@ -1743,7 +1743,7 @@
 {
    if (linux_kernel_2_6_22()) {
       /* 2.6.22 kernel: timerfd system call. */
-      PRINT("sys_timerfd ( %ld, %ld, %p )", ARG1, ARG2, ARG3);
+      PRINT("sys_timerfd ( %ld, %ld, %#lx )", ARG1, ARG2, ARG3);
       PRE_REG_READ3(long, "sys_timerfd",
                     int, fd, int, clockid, const struct itimerspec *, tmr);
       PRE_MEM_READ("timerfd(tmr)", ARG3,
@@ -1784,7 +1784,7 @@
 
 PRE(sys_timerfd_gettime)
 {
-   PRINT("sys_timerfd_gettime ( %d, %p )", ARG1, ARG2);
+   PRINT("sys_timerfd_gettime ( %ld, %#lx )", ARG1, ARG2);
    PRE_REG_READ2(long, "timerfd_gettime",
                  int, ufd,
                  struct vki_itimerspec*, otmr);
@@ -1802,7 +1802,7 @@
 
 PRE(sys_timerfd_settime)
 {
-   PRINT("sys_timerfd_settime ( %d, %d, %p, %p )", ARG1, ARG2, ARG3, ARG4);
+   PRINT("sys_timerfd_settime ( %ld, %ld, %#lx, %#lx )", ARG1, ARG2, ARG3, ARG4);
    PRE_REG_READ4(long, "timerfd_settime",
                  int, ufd,
                  int, flags,
@@ -1833,7 +1833,7 @@
 
 PRE(sys_capget)
 {
-   PRINT("sys_capget ( %p, %p )", ARG1, ARG2 );
+   PRINT("sys_capget ( %#lx, %#lx )", ARG1, ARG2 );
    PRE_REG_READ2(long, "capget", 
                  vki_cap_user_header_t, header, vki_cap_user_data_t, data);
    PRE_MEM_READ( "capget(header)", ARG1, 
@@ -1849,7 +1849,7 @@
 
 PRE(sys_capset)
 {
-   PRINT("sys_capset ( %p, %p )", ARG1, ARG2 );
+   PRINT("sys_capset ( %#lx, %#lx )", ARG1, ARG2 );
    PRE_REG_READ2(long, "capset", 
                  vki_cap_user_header_t, header,
                  const vki_cap_user_data_t, data);
@@ -1871,7 +1871,7 @@
 
 PRE(sys_setuid16)
 {
-   PRINT("sys_setuid16 ( %d )", ARG1);
+   PRINT("sys_setuid16 ( %ld )", ARG1);
    PRE_REG_READ1(long, "setuid16", vki_old_uid_t, uid);
 }
 
@@ -1883,7 +1883,7 @@
 
 PRE(sys_setgid16)
 {
-   PRINT("sys_setgid16 ( %d )", ARG1);
+   PRINT("sys_setgid16 ( %ld )", ARG1);
    PRE_REG_READ1(long, "setgid16", vki_old_gid_t, gid);
 }
 
@@ -1901,19 +1901,19 @@
 
 PRE(sys_setreuid16)
 {
-   PRINT("setreuid16 ( 0x%x, 0x%x )", ARG1, ARG2);
+   PRINT("setreuid16 ( 0x%lx, 0x%lx )", ARG1, ARG2);
    PRE_REG_READ2(long, "setreuid16", vki_old_uid_t, ruid, vki_old_uid_t, euid);
 }
 
 PRE(sys_setregid16)
 {
-   PRINT("sys_setregid16 ( %d, %d )", ARG1, ARG2);
+   PRINT("sys_setregid16 ( %ld, %ld )", ARG1, ARG2);
    PRE_REG_READ2(long, "setregid16", vki_old_gid_t, rgid, vki_old_gid_t, egid);
 }
 
 PRE(sys_getgroups16)
 {
-   PRINT("sys_getgroups16 ( %d, %p )", ARG1, ARG2);
+   PRINT("sys_getgroups16 ( %ld, %#lx )", ARG1, ARG2);
    PRE_REG_READ2(long, "getgroups16", int, size, vki_old_gid_t *, list);
    if (ARG1 > 0)
       PRE_MEM_WRITE( "getgroups16(list)", ARG2, ARG1 * sizeof(vki_old_gid_t) );
@@ -1927,7 +1927,7 @@
 
 PRE(sys_setgroups16)
 {
-   PRINT("sys_setgroups16 ( %llu, %p )", (ULong)ARG1, ARG2);
+   PRINT("sys_setgroups16 ( %llu, %#lx )", (ULong)ARG1, ARG2);
    PRE_REG_READ2(long, "setgroups16", int, size, vki_old_gid_t *, list);
    if (ARG1 > 0)
       PRE_MEM_READ( "setgroups16(list)", ARG2, ARG1 * sizeof(vki_old_gid_t) );
@@ -1939,7 +1939,7 @@
 
 PRE(sys_chown16)
 {
-   PRINT("sys_chown16 ( %p, 0x%x, 0x%x )", ARG1,ARG2,ARG3);
+   PRINT("sys_chown16 ( %#lx, 0x%lx, 0x%lx )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "chown16",
                  const char *, path,
                  vki_old_uid_t, owner, vki_old_gid_t, group);
@@ -1948,7 +1948,7 @@
 
 PRE(sys_fchown16)
 {
-   PRINT("sys_fchown16 ( %d, %d, %d )", ARG1,ARG2,ARG3);
+   PRINT("sys_fchown16 ( %ld, %ld, %ld )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "fchown16",
                  unsigned int, fd, vki_old_uid_t, owner, vki_old_gid_t, group);
 }
@@ -1960,7 +1960,7 @@
 PRE(sys_setxattr)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_setxattr ( %p, %p, %p, %llu, %d )",
+   PRINT("sys_setxattr ( %#lx, %#lx, %#lx, %llu, %ld )",
          ARG1, ARG2, ARG3, (ULong)ARG4, ARG5);
    PRE_REG_READ5(long, "setxattr",
                  char *, path, char *, name,
@@ -1973,7 +1973,7 @@
 PRE(sys_lsetxattr)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_lsetxattr ( %p, %p, %p, %llu, %d )",
+   PRINT("sys_lsetxattr ( %#lx, %#lx, %#lx, %llu, %ld )",
          ARG1, ARG2, ARG3, (ULong)ARG4, ARG5);
    PRE_REG_READ5(long, "lsetxattr",
                  char *, path, char *, name,
@@ -1986,7 +1986,7 @@
 PRE(sys_fsetxattr)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_fsetxattr ( %d, %p, %p, %llu, %d )",
+   PRINT("sys_fsetxattr ( %ld, %#lx, %#lx, %llu, %ld )",
          ARG1, ARG2, ARG3, (ULong)ARG4, ARG5);
    PRE_REG_READ5(long, "fsetxattr",
                  int, fd, char *, name, void *, value,
@@ -1998,7 +1998,7 @@
 PRE(sys_getxattr)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_getxattr ( %p, %p, %p, %llu )", ARG1,ARG2,ARG3, (ULong)ARG4);
+   PRINT("sys_getxattr ( %#lx, %#lx, %#lx, %llu )", ARG1,ARG2,ARG3, (ULong)ARG4);
    PRE_REG_READ4(ssize_t, "getxattr",
                  char *, path, char *, name, void *, value, vki_size_t, size);
    PRE_MEM_RASCIIZ( "getxattr(path)", ARG1 );
@@ -2016,7 +2016,7 @@
 PRE(sys_lgetxattr)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_lgetxattr ( %p, %p, %p, %llu )", ARG1,ARG2,ARG3, (ULong)ARG4);
+   PRINT("sys_lgetxattr ( %#lx, %#lx, %#lx, %llu )", ARG1,ARG2,ARG3, (ULong)ARG4);
    PRE_REG_READ4(ssize_t, "lgetxattr",
                  char *, path, char *, name, void *, value, vki_size_t, size);
    PRE_MEM_RASCIIZ( "lgetxattr(path)", ARG1 );
@@ -2034,7 +2034,7 @@
 PRE(sys_fgetxattr)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_fgetxattr ( %d, %p, %p, %llu )", ARG1, ARG2, ARG3, (ULong)ARG4);
+   PRINT("sys_fgetxattr ( %ld, %#lx, %#lx, %llu )", ARG1, ARG2, ARG3, (ULong)ARG4);
    PRE_REG_READ4(ssize_t, "fgetxattr",
                  int, fd, char *, name, void *, value, vki_size_t, size);
    PRE_MEM_RASCIIZ( "fgetxattr(name)", ARG2 );
@@ -2049,7 +2049,7 @@
 PRE(sys_listxattr)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_listxattr ( %p, %p, %llu )", ARG1, ARG2, (ULong)ARG3);
+   PRINT("sys_listxattr ( %#lx, %#lx, %llu )", ARG1, ARG2, (ULong)ARG3);
    PRE_REG_READ3(ssize_t, "listxattr",
                  char *, path, char *, list, vki_size_t, size);
    PRE_MEM_RASCIIZ( "listxattr(path)", ARG1 );
@@ -2064,7 +2064,7 @@
 PRE(sys_llistxattr)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_llistxattr ( %p, %p, %llu )", ARG1, ARG2, (ULong)ARG3);
+   PRINT("sys_llistxattr ( %#lx, %#lx, %llu )", ARG1, ARG2, (ULong)ARG3);
    PRE_REG_READ3(ssize_t, "llistxattr",
                  char *, path, char *, list, vki_size_t, size);
    PRE_MEM_RASCIIZ( "llistxattr(path)", ARG1 );
@@ -2079,7 +2079,7 @@
 PRE(sys_flistxattr)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_flistxattr ( %d, %p, %llu )", ARG1, ARG2, (ULong)ARG3);
+   PRINT("sys_flistxattr ( %ld, %#lx, %llu )", ARG1, ARG2, (ULong)ARG3);
    PRE_REG_READ3(ssize_t, "flistxattr",
                  int, fd, char *, list, vki_size_t, size);
    PRE_MEM_WRITE( "flistxattr(list)", ARG2, ARG3 );
@@ -2093,7 +2093,7 @@
 PRE(sys_removexattr)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_removexattr ( %p, %p )", ARG1, ARG2);
+   PRINT("sys_removexattr ( %#lx, %#lx )", ARG1, ARG2);
    PRE_REG_READ2(long, "removexattr", char *, path, char *, name);
    PRE_MEM_RASCIIZ( "removexattr(path)", ARG1 );
    PRE_MEM_RASCIIZ( "removexattr(name)", ARG2 );
@@ -2102,7 +2102,7 @@
 PRE(sys_lremovexattr)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_lremovexattr ( %p, %p )", ARG1, ARG2);
+   PRINT("sys_lremovexattr ( %#lx, %#lx )", ARG1, ARG2);
    PRE_REG_READ2(long, "lremovexattr", char *, path, char *, name);
    PRE_MEM_RASCIIZ( "lremovexattr(path)", ARG1 );
    PRE_MEM_RASCIIZ( "lremovexattr(name)", ARG2 );
@@ -2111,7 +2111,7 @@
 PRE(sys_fremovexattr)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_fremovexattr ( %d, %p )", ARG1, ARG2);
+   PRINT("sys_fremovexattr ( %ld, %#lx )", ARG1, ARG2);
    PRE_REG_READ2(long, "fremovexattr", int, fd, char *, name);
    PRE_MEM_RASCIIZ( "fremovexattr(name)", ARG2 );
 }
@@ -2122,7 +2122,7 @@
 
 PRE(sys_sched_setparam)
 {
-   PRINT("sched_setparam ( %d, %p )", ARG1, ARG2 );
+   PRINT("sched_setparam ( %ld, %#lx )", ARG1, ARG2 );
    PRE_REG_READ2(long, "sched_setparam", 
                  vki_pid_t, pid, struct sched_param *, p);
    PRE_MEM_READ( "sched_setparam(p)", ARG2, sizeof(struct vki_sched_param) );
@@ -2134,7 +2134,7 @@
 
 PRE(sys_sched_getparam)
 {
-   PRINT("sched_getparam ( %d, %p )", ARG1, ARG2 );
+   PRINT("sched_getparam ( %ld, %#lx )", ARG1, ARG2 );
    PRE_REG_READ2(long, "sched_getparam", 
                  vki_pid_t, pid, struct sched_param *, p);
    PRE_MEM_WRITE( "sched_getparam(p)", ARG2, sizeof(struct vki_sched_param) );
@@ -2146,13 +2146,13 @@
 
 PRE(sys_sched_getscheduler)
 {
-   PRINT("sys_sched_getscheduler ( %d )", ARG1);
+   PRINT("sys_sched_getscheduler ( %ld )", ARG1);
    PRE_REG_READ1(long, "sched_getscheduler", vki_pid_t, pid);
 }
 
 PRE(sys_sched_setscheduler)
 {
-   PRINT("sys_sched_setscheduler ( %d, %d, %p )", ARG1,ARG2,ARG3);
+   PRINT("sys_sched_setscheduler ( %ld, %ld, %#lx )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "sched_setscheduler", 
                  vki_pid_t, pid, int, policy, struct sched_param *, p);
    if (ARG3 != 0)
@@ -2169,19 +2169,19 @@
 
 PRE(sys_sched_get_priority_max)
 {
-   PRINT("sched_get_priority_max ( %d )", ARG1);
+   PRINT("sched_get_priority_max ( %ld )", ARG1);
    PRE_REG_READ1(long, "sched_get_priority_max", int, policy);
 }
 
 PRE(sys_sched_get_priority_min)
 {
-   PRINT("sched_get_priority_min ( %d )", ARG1);
+   PRINT("sched_get_priority_min ( %ld )", ARG1);
    PRE_REG_READ1(long, "sched_get_priority_min", int, policy);
 }
 
 PRE(sys_sched_setaffinity)
 {
-   PRINT("sched_setaffinity ( %d, %d, %p )", ARG1, ARG2, ARG3);
+   PRINT("sched_setaffinity ( %ld, %ld, %#lx )", ARG1, ARG2, ARG3);
    PRE_REG_READ3(long, "sched_setaffinity", 
                  vki_pid_t, pid, unsigned int, len, unsigned long *, mask);
    PRE_MEM_READ( "sched_setaffinity(mask)", ARG3, ARG2);
@@ -2189,7 +2189,7 @@
 
 PRE(sys_sched_getaffinity)
 {
-   PRINT("sched_getaffinity ( %d, %d, %p )", ARG1, ARG2, ARG3);
+   PRINT("sched_getaffinity ( %ld, %ld, %#lx )", ARG1, ARG2, ARG3);
    PRE_REG_READ3(long, "sched_getaffinity", 
                  vki_pid_t, pid, unsigned int, len, unsigned long *, mask);
    PRE_MEM_WRITE( "sched_getaffinity(mask)", ARG3, ARG2);
@@ -2224,7 +2224,7 @@
 // AMD64.
 PRE(sys_pipe)
 {
-   PRINT("sys_pipe ( %p )", ARG1);
+   PRINT("sys_pipe ( %#lx )", ARG1);
    PRE_REG_READ1(int, "pipe", int *, filedes);
    PRE_MEM_WRITE( "pipe(filedes)", ARG1, 2*sizeof(int) );
 }
@@ -2248,7 +2248,7 @@
 
 PRE(sys_quotactl)
 {
-   PRINT("sys_quotactl (0x%x, %p, 0x%x, 0x%x )", ARG1,ARG2,ARG3, ARG4);
+   PRINT("sys_quotactl (0x%lx, %#lx, 0x%lx, 0x%lx )", ARG1,ARG2,ARG3, ARG4);
    PRE_REG_READ4(long, "quotactl",
                  unsigned int, cmd, const char *, special, vki_qid_t, id,
                  void *, addr);
@@ -2258,7 +2258,7 @@
 PRE(sys_waitid)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_waitid( %d, %d, %p, %d, %p )", ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_waitid( %ld, %ld, %#lx, %ld, %#lx )", ARG1,ARG2,ARG3,ARG4,ARG5);
    PRE_REG_READ5(int32_t, "sys_waitid",
                  int, which, vki_pid_t, pid, struct vki_siginfo *, infop,
                  int, options, struct vki_rusage *, ru);
@@ -2276,7 +2276,7 @@
 PRE(sys_sync_file_range)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_sync_file_range ( %d, %lld, %lld, %d )",
+   PRINT("sys_sync_file_range ( %ld, %ld, %ld, %ld )",
          ARG1,ARG2,ARG3,ARG4);
    PRE_REG_READ4(long, "sync_file_range",
                  int, fd, vki_loff_t, offset, vki_loff_t, nbytes,
@@ -2292,7 +2292,7 @@
 PRE(sys_utime)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_utime ( %p, %p )", ARG1,ARG2);
+   PRINT("sys_utime ( %#lx, %#lx )", ARG1,ARG2);
    PRE_REG_READ2(long, "utime", char *, filename, struct utimbuf *, buf);
    PRE_MEM_RASCIIZ( "utime(filename)", ARG1 );
    if (ARG2 != 0)
@@ -2305,7 +2305,7 @@
 
 PRE(sys_lseek)
 {
-   PRINT("sys_lseek ( %d, %d, %d )", ARG1,ARG2,ARG3);
+   PRINT("sys_lseek ( %ld, %ld, %ld )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(vki_off_t, "lseek",
                  unsigned int, fd, vki_off_t, offset, unsigned int, whence);
 }
@@ -2316,7 +2316,7 @@
 
 PRE(sys_sigpending)
 {
-   PRINT( "sys_sigpending ( %p )", ARG1 );
+   PRINT( "sys_sigpending ( %#lx )", ARG1 );
    PRE_REG_READ1(long, "sigpending", vki_old_sigset_t *, set);
    PRE_MEM_WRITE( "sigpending(set)", ARG1, sizeof(vki_old_sigset_t));
 }
@@ -2338,7 +2338,7 @@
    vki_sigset_t bigger_set;
    vki_sigset_t bigger_oldset;
 
-   PRINT("sys_sigprocmask ( %d, %p, %p )",ARG1,ARG2,ARG3);
+   PRINT("sys_sigprocmask ( %ld, %#lx, %#lx )",ARG1,ARG2,ARG3);
    PRE_REG_READ3(long, "sigprocmask", 
                  int, how, vki_old_sigset_t *, set, vki_old_sigset_t *, oldset);
    if (ARG2 != 0)
@@ -2378,7 +2378,7 @@
 
 PRE(sys_signalfd)
 {
-   PRINT("sys_signalfd ( %d, %p, %llu )", (Int)ARG1, ARG2, (ULong) ARG3);
+   PRINT("sys_signalfd ( %d, %#lx, %llu )", (Int)ARG1, ARG2, (ULong) ARG3);
    PRE_REG_READ3(long, "sys_signalfd",
                  int, fd, vki_sigset_t *, sigmask, vki_size_t, sigsetsize);
    PRE_MEM_READ( "signalfd(sigmask)", ARG2, sizeof(vki_sigset_t) );
@@ -2403,7 +2403,7 @@
 
 PRE(sys_rt_sigaction)
 {
-   PRINT("sys_rt_sigaction ( %d, %p, %p, %d )", ARG1,ARG2,ARG3,ARG4);
+   PRINT("sys_rt_sigaction ( %ld, %#lx, %#lx, %ld )", ARG1,ARG2,ARG3,ARG4);
    PRE_REG_READ4(long, "rt_sigaction",
                  int, signum, const struct sigaction *, act,
                  struct sigaction *, oldact, vki_size_t, sigsetsize);
@@ -2437,7 +2437,7 @@
 
 PRE(sys_rt_sigprocmask)
 {
-   PRINT("sys_rt_sigprocmask ( %d, %p, %p, %llu )",ARG1,ARG2,ARG3,(ULong)ARG4);
+   PRINT("sys_rt_sigprocmask ( %ld, %#lx, %#lx, %llu )",ARG1,ARG2,ARG3,(ULong)ARG4);
    PRE_REG_READ4(long, "rt_sigprocmask", 
                  int, how, vki_sigset_t *, set, vki_sigset_t *, oldset,
                  vki_size_t, sigsetsize);
@@ -2469,7 +2469,7 @@
 
 PRE(sys_rt_sigpending)
 {
-   PRINT( "sys_rt_sigpending ( %p )", ARG1 );
+   PRINT( "sys_rt_sigpending ( %#lx )", ARG1 );
    PRE_REG_READ2(long, "rt_sigpending", 
                  vki_sigset_t *, set, vki_size_t, sigsetsize);
    PRE_MEM_WRITE( "rt_sigpending(set)", ARG1, sizeof(vki_sigset_t));
@@ -2482,7 +2482,7 @@
 PRE(sys_rt_sigtimedwait)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_rt_sigtimedwait ( %p, %p, %p, %lld )",
+   PRINT("sys_rt_sigtimedwait ( %#lx, %#lx, %#lx, %lld )",
          ARG1,ARG2,ARG3,(ULong)ARG4);
    PRE_REG_READ4(long, "rt_sigtimedwait", 
                  const vki_sigset_t *, set, vki_siginfo_t *, info,
@@ -2503,7 +2503,7 @@
 
 PRE(sys_rt_sigqueueinfo)
 {
-   PRINT("sys_rt_sigqueueinfo(%d, %d, %p)", ARG1, ARG2, ARG3);
+   PRINT("sys_rt_sigqueueinfo(%ld, %ld, %#lx)", ARG1, ARG2, ARG3);
    PRE_REG_READ3(long, "rt_sigqueueinfo", 
                  int, pid, int, sig, vki_siginfo_t *, uinfo);
    if (ARG2 != 0)
@@ -2526,7 +2526,7 @@
       return EINVAL if it isn't.
     */
    *flags |= SfMayBlock;
-   PRINT("sys_rt_sigsuspend ( %p, %d )", ARG1,ARG2 );
+   PRINT("sys_rt_sigsuspend ( %#lx, %ld )", ARG1,ARG2 );
    PRE_REG_READ2(int, "rt_sigsuspend", vki_sigset_t *, mask, vki_size_t, size)
    if (ARG1 != (Addr)NULL) {
       PRE_MEM_READ( "rt_sigsuspend(mask)", ARG1, sizeof(vki_sigset_t) );
@@ -2636,12 +2636,12 @@
 
    if (ARG3 & VKI_O_CREAT) {
       // 4-arg version
-      PRINT("sys_openat ( %d, %p(%s), %d, %d )",ARG1,ARG2,ARG2,ARG3,ARG4);
+      PRINT("sys_openat ( %ld, %#lx(%s), %ld, %ld )",ARG1,ARG2,(char*)ARG2,ARG3,ARG4);
       PRE_REG_READ4(long, "openat",
                     int, dfd, const char *, filename, int, flags, int, mode);
    } else {
       // 3-arg version
-      PRINT("sys_openat ( %d, %p(%s), %d )",ARG1,ARG2,ARG2,ARG3);
+      PRINT("sys_openat ( %ld, %#lx(%s), %ld )",ARG1,ARG2,(char*)ARG2,ARG3);
       PRE_REG_READ3(long, "openat",
                     int, dfd, const char *, filename, int, flags);
    }
@@ -2689,7 +2689,7 @@
 PRE(sys_mkdirat)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_mkdirat ( %d, %p(%s), %d )", ARG1,ARG2,ARG2,ARG3);
+   PRINT("sys_mkdirat ( %ld, %#lx(%s), %ld )", ARG1,ARG2,(char*)ARG2,ARG3);
    PRE_REG_READ3(long, "mkdirat",
                  int, dfd, const char *, pathname, int, mode);
    PRE_MEM_RASCIIZ( "mkdirat(pathname)", ARG2 );
@@ -2697,7 +2697,7 @@
 
 PRE(sys_mknodat)
 {
-   PRINT("sys_mknodat ( %d, %p(%s), 0x%x, 0x%x )", ARG1,ARG2,ARG2,ARG3,ARG4 );
+  PRINT("sys_mknodat ( %ld, %#lx(%s), 0x%lx, 0x%lx )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4 );
    PRE_REG_READ4(long, "mknodat",
                  int, dfd, const char *, pathname, int, mode, unsigned, dev);
    PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 );
@@ -2705,7 +2705,7 @@
 
 PRE(sys_fchownat)
 {
-   PRINT("sys_fchownat ( %d, %p(%s), 0x%x, 0x%x )", ARG1,ARG2,ARG2,ARG3,ARG4);
+   PRINT("sys_fchownat ( %ld, %#lx(%s), 0x%lx, 0x%lx )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4);
    PRE_REG_READ4(long, "fchownat",
                  int, dfd, const char *, path,
                  vki_uid_t, owner, vki_gid_t, group);
@@ -2714,7 +2714,7 @@
 
 PRE(sys_futimesat)
 {
-   PRINT("sys_futimesat ( %d, %p(%s), %p )", ARG1,ARG2,ARG2,ARG3);
+   PRINT("sys_futimesat ( %ld, %#lx(%s), %#lx )", ARG1,ARG2,(char*)ARG2,ARG3);
    PRE_REG_READ3(long, "futimesat",
                  int, dfd, char *, filename, struct timeval *, tvp);
    if (ARG2 != 0)
@@ -2725,7 +2725,7 @@
 
 PRE(sys_utimensat)
 {
-   PRINT("sys_utimensat ( %d, %p(%s), %p, 0x%x )", ARG1,ARG2,ARG2,ARG3,ARG4);
+   PRINT("sys_utimensat ( %ld, %#lx(%s), %#lx, 0x%lx )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4);
    PRE_REG_READ4(long, "utimensat",
                  int, dfd, char *, filename, struct timespec *, utimes, int, flags);
    if (ARG2 != 0)
@@ -2736,7 +2736,7 @@
 
 PRE(sys_newfstatat)
 {
-   PRINT("sys_newfstatat ( %d, %p(%s), %p )", ARG1,ARG2,ARG2,ARG3);
+   PRINT("sys_newfstatat ( %ld, %#lx(%s), %#lx )", ARG1,ARG2,(char*)ARG2,ARG3);
    PRE_REG_READ3(long, "fstatat",
                  int, dfd, char *, file_name, struct stat *, buf);
    PRE_MEM_RASCIIZ( "fstatat(file_name)", ARG2 );
@@ -2751,14 +2751,14 @@
 PRE(sys_unlinkat)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_unlinkat ( %d, %p(%s) )", ARG1,ARG2,ARG2);
+   PRINT("sys_unlinkat ( %ld, %#lx(%s) )", ARG1,ARG2,(char*)ARG2);
    PRE_REG_READ2(long, "unlinkat", int, dfd, const char *, pathname);
    PRE_MEM_RASCIIZ( "unlinkat(pathname)", ARG2 );
 }
 
 PRE(sys_renameat)
 {
-   PRINT("sys_renameat ( %d, %p(%s), %d, %p(%s) )", ARG1,ARG2,ARG2,ARG3,ARG4,ARG4);
+   PRINT("sys_renameat ( %ld, %#lx(%s), %ld, %#lx(%s) )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4,(char*)ARG4);
    PRE_REG_READ4(long, "renameat",
                  int, olddfd, const char *, oldpath,
                  int, newdfd, const char *, newpath);
@@ -2769,7 +2769,7 @@
 PRE(sys_linkat)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_linkat ( %d, %p(%s), %d, %p(%s), %d )",ARG1,ARG2,ARG2,ARG3,ARG4,ARG4,ARG5);
+   PRINT("sys_linkat ( %ld, %#lx(%s), %ld, %#lx(%s), %ld )",ARG1,ARG2,(char*)ARG2,ARG3,ARG4,(char*)ARG4,ARG5);
    PRE_REG_READ5(long, "linkat",
                  int, olddfd, const char *, oldpath,
                  int, newdfd, const char *, newpath,
@@ -2781,7 +2781,7 @@
 PRE(sys_symlinkat)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_symlinkat ( %p(%s), %d, %p(%s) )",ARG1,ARG1,ARG2,ARG3,ARG3);
+   PRINT("sys_symlinkat ( %#lx(%s), %ld, %#lx(%s) )",ARG1,(char*)ARG1,ARG2,ARG3,(char*)ARG3);
    PRE_REG_READ3(long, "symlinkat",
                  const char *, oldpath, int, newdfd, const char *, newpath);
    PRE_MEM_RASCIIZ( "symlinkat(oldpath)", ARG1 );
@@ -2793,7 +2793,7 @@
    HChar name[25];
    Word  saved = SYSNO;
 
-   PRINT("sys_readlinkat ( %d, %p(%s), %p, %llu )", ARG1,ARG2,ARG2,ARG3,(ULong)ARG4);
+   PRINT("sys_readlinkat ( %ld, %#lx(%s), %#lx, %llu )", ARG1,ARG2,(char*)ARG2,ARG3,(ULong)ARG4);
    PRE_REG_READ4(long, "readlinkat",
                  int, dfd, const char *, path, char *, buf, int, bufsiz);
    PRE_MEM_RASCIIZ( "readlinkat(path)", ARG2 );
@@ -2821,7 +2821,7 @@
 
 PRE(sys_fchmodat)
 {
-   PRINT("sys_fchmodat ( %d, %p(%s), %d )", ARG1,ARG2,ARG2,ARG3);
+   PRINT("sys_fchmodat ( %ld, %#lx(%s), %ld )", ARG1,ARG2,(char*)ARG2,ARG3);
    PRE_REG_READ3(long, "fchmodat",
                  int, dfd, const char *, path, vki_mode_t, mode);
    PRE_MEM_RASCIIZ( "fchmodat(path)", ARG2 );
@@ -2829,7 +2829,7 @@
 
 PRE(sys_faccessat)
 {
-   PRINT("sys_faccessat ( %d, %p(%s), %d )", ARG1,ARG2,ARG2,ARG3);
+   PRINT("sys_faccessat ( %ld, %#lx(%s), %ld )", ARG1,ARG2,(char*)ARG2,ARG3);
    PRE_REG_READ3(long, "faccessat",
                  int, dfd, const char *, pathname, int, mode);
    PRE_MEM_RASCIIZ( "faccessat(pathname)", ARG2 );
@@ -2841,8 +2841,8 @@
 
 PRE(sys_request_key)
 {
-   PRINT("sys_request_key ( %p(%s), %p(%s), %p(%s), %d )",
-         ARG1,ARG1,ARG2,ARG2,ARG3,ARG3,ARG4);
+   PRINT("sys_request_key ( %#lx(%s), %#lx(%s), %#lx(%s), %ld )",
+         ARG1,(char*)ARG1,ARG2,(char*)ARG2,ARG3,(char*)ARG3,ARG4);
    PRE_REG_READ4(long, "request_key",
                  const char *, type, const char *, description, 
                  const char *, callout_info, vki_key_serial_t, keyring);
@@ -2854,8 +2854,8 @@
 
 PRE(sys_add_key)
 {
-   PRINT("sys_add_key ( %p(%s), %p(%s), %p, %d, %d )",
-         ARG1,ARG1,ARG2,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_add_key ( %#lx(%s), %#lx(%s), %#lx, %ld, %ld )",
+         ARG1,(char*)ARG1,ARG2,(char*)ARG2,ARG3,ARG4,ARG5);
    PRE_REG_READ5(long, "add_key",
                  const char *, type, const char *, description,
                  const void *, payload, vki_size_t, plen, 
@@ -2870,19 +2870,19 @@
 {
    switch (ARG1 /* option */) {
    case VKI_KEYCTL_GET_KEYRING_ID:
-      PRINT("sys_keyctl ( KEYCTL_GET_KEYRING_ID, %d, %d )", ARG2,ARG3);
+      PRINT("sys_keyctl ( KEYCTL_GET_KEYRING_ID, %ld, %ld )", ARG2,ARG3);
       PRE_REG_READ3(long, "keyctl(KEYCTL_GET_KEYRING_ID)",
                     int, option, vki_key_serial_t, id, int, create);
       break;
    case VKI_KEYCTL_JOIN_SESSION_KEYRING:
-      PRINT("sys_keyctl ( KEYCTL_JOIN_SESSION_KEYRING, %p(%s) )", ARG2,ARG2);
+      PRINT("sys_keyctl ( KEYCTL_JOIN_SESSION_KEYRING, %#lx(%s) )", ARG2,(char*)ARG2);
       PRE_REG_READ2(long, "keyctl(KEYCTL_JOIN_SESSION_KEYRING)",
                     int, option, const char *, name);
       if (ARG2 != (UWord)NULL)
          PRE_MEM_RASCIIZ("keyctl(KEYCTL_JOIN_SESSION_KEYRING, name)", ARG2);
       break;
    case VKI_KEYCTL_UPDATE:
-      PRINT("sys_keyctl ( KEYCTL_UPDATE, %d, %p, %d )", ARG2,ARG3,ARG4);
+      PRINT("sys_keyctl ( KEYCTL_UPDATE, %ld, %#lx, %ld )", ARG2,ARG3,ARG4);
       PRE_REG_READ4(long, "keyctl(KEYCTL_UPDATE)",
                     int, option, vki_key_serial_t, key,
                     const void *, payload, vki_size_t, plen);
@@ -2890,23 +2890,23 @@
          PRE_MEM_READ("keyctl(KEYCTL_UPDATE, payload)", ARG3, ARG4);
       break;
    case VKI_KEYCTL_REVOKE:
-      PRINT("sys_keyctl ( KEYCTL_REVOKE, %d )", ARG2);
+      PRINT("sys_keyctl ( KEYCTL_REVOKE, %ld )", ARG2);
       PRE_REG_READ2(long, "keyctl(KEYCTL_REVOKE)",
                     int, option, vki_key_serial_t, id);
       break;
    case VKI_KEYCTL_CHOWN:
-      PRINT("sys_keyctl ( KEYCTL_CHOWN, %d, %d, %d )", ARG2,ARG3,ARG4);
+      PRINT("sys_keyctl ( KEYCTL_CHOWN, %ld, %ld, %ld )", ARG2,ARG3,ARG4);
       PRE_REG_READ4(long, "keyctl(KEYCTL_CHOWN)",
                     int, option, vki_key_serial_t, id,
                     vki_uid_t, uid, vki_gid_t, gid);
       break;
    case VKI_KEYCTL_SETPERM:
-      PRINT("sys_keyctl ( KEYCTL_SETPERM, %d, %d )", ARG2,ARG3);
+      PRINT("sys_keyctl ( KEYCTL_SETPERM, %ld, %ld )", ARG2,ARG3);
       PRE_REG_READ3(long, "keyctl(KEYCTL_SETPERM)",
                     int, option, vki_key_serial_t, id, vki_key_perm_t, perm);
       break;
    case VKI_KEYCTL_DESCRIBE:
-      PRINT("sys_keyctl ( KEYCTL_DESCRIBE, %d, %p, %d )", ARG2,ARG3,ARG4);
+      PRINT("sys_keyctl ( KEYCTL_DESCRIBE, %ld, %#lx, %ld )", ARG2,ARG3,ARG4);
       PRE_REG_READ4(long, "keyctl(KEYCTL_DESCRIBE)",
                     int, option, vki_key_serial_t, id,
                     char *, buffer, vki_size_t, buflen);
@@ -2914,23 +2914,23 @@
          PRE_MEM_WRITE("keyctl(KEYCTL_DESCRIBE, buffer)", ARG3, ARG4);
       break;
    case VKI_KEYCTL_CLEAR:
-      PRINT("sys_keyctl ( KEYCTL_CLEAR, %d )", ARG2);
+      PRINT("sys_keyctl ( KEYCTL_CLEAR, %ld )", ARG2);
       PRE_REG_READ2(long, "keyctl(KEYCTL_CLEAR)",
                     int, option, vki_key_serial_t, keyring);
       break;
    case VKI_KEYCTL_LINK:
-      PRINT("sys_keyctl ( KEYCTL_LINK, %d, %d )", ARG2,ARG3);
+      PRINT("sys_keyctl ( KEYCTL_LINK, %ld, %ld )", ARG2,ARG3);
       PRE_REG_READ3(long, "keyctl(KEYCTL_LINK)", int, option,
                     vki_key_serial_t, keyring, vki_key_serial_t, key);
       break;
    case VKI_KEYCTL_UNLINK:
-      PRINT("sys_keyctl ( KEYCTL_UNLINK, %d, %d )", ARG2,ARG3);
+      PRINT("sys_keyctl ( KEYCTL_UNLINK, %ld, %ld )", ARG2,ARG3);
       PRE_REG_READ3(long, "keyctl(KEYCTL_UNLINK)", int, option,
                     vki_key_serial_t, keyring, vki_key_serial_t, key);
       break;
    case VKI_KEYCTL_SEARCH:
-      PRINT("sys_keyctl ( KEYCTL_SEARCH, %d, %p(%s), %p(%s), %d )",
-            ARG2,ARG3,ARG3,ARG4,ARG4,ARG5);
+      PRINT("sys_keyctl ( KEYCTL_SEARCH, %ld, %#lx(%s), %#lx(%s), %ld )",
+            ARG2,ARG3,(char*)ARG3,ARG4,(char*)ARG4,ARG5);
       PRE_REG_READ5(long, "keyctl(KEYCTL_SEARCH)",
                     int, option, vki_key_serial_t, keyring, 
                     const char *, type, const char *, description,
@@ -2939,7 +2939,7 @@
       PRE_MEM_RASCIIZ("sys_keyctl(KEYCTL_SEARCH, description)", ARG4);
       break;
    case VKI_KEYCTL_READ:
-      PRINT("sys_keyctl ( KEYCTL_READ, %d, %p, %d )", ARG2,ARG3,ARG4);
+      PRINT("sys_keyctl ( KEYCTL_READ, %ld, %#lx, %ld )", ARG2,ARG3,ARG4);
       PRE_REG_READ4(long, "keyctl(KEYCTL_READ)",
                     int, option, vki_key_serial_t, keyring, 
                     char *, buffer, vki_size_t, buflen);
@@ -2947,7 +2947,7 @@
          PRE_MEM_WRITE("keyctl(KEYCTL_READ, buffer)", ARG3, ARG4);
       break;
    case VKI_KEYCTL_INSTANTIATE:
-      PRINT("sys_keyctl ( KEYCTL_INSTANTIATE, %d, %p, %d, %d )",
+      PRINT("sys_keyctl ( KEYCTL_INSTANTIATE, %ld, %#lx, %ld, %ld )",
             ARG2,ARG3,ARG4,ARG5);
       PRE_REG_READ5(long, "keyctl(KEYCTL_INSTANTIATE)",
                     int, option, vki_key_serial_t, key, 
@@ -2957,28 +2957,28 @@
          PRE_MEM_READ("keyctl(KEYCTL_INSTANTIATE, payload)", ARG3, ARG4);
       break;
    case VKI_KEYCTL_NEGATE:
-      PRINT("sys_keyctl ( KEYCTL_NEGATE, %d, %u, %d )", ARG2,ARG3,ARG4);
+      PRINT("sys_keyctl ( KEYCTL_NEGATE, %ld, %lu, %ld )", ARG2,ARG3,ARG4);
       PRE_REG_READ4(long, "keyctl(KEYCTL_NEGATE)",
                     int, option, vki_key_serial_t, key, 
                     unsigned, timeout, vki_key_serial_t, keyring);
       break;
    case VKI_KEYCTL_SET_REQKEY_KEYRING:
-      PRINT("sys_keyctl ( KEYCTL_SET_REQKEY_KEYRING, %d )", ARG2);
+      PRINT("sys_keyctl ( KEYCTL_SET_REQKEY_KEYRING, %ld )", ARG2);
       PRE_REG_READ2(long, "keyctl(KEYCTL_SET_REQKEY_KEYRING)",
                     int, option, int, reqkey_defl);
       break;
    case VKI_KEYCTL_SET_TIMEOUT:
-      PRINT("sys_keyctl ( KEYCTL_SET_TIMEOUT, %d, %d )", ARG2,ARG3);
+      PRINT("sys_keyctl ( KEYCTL_SET_TIMEOUT, %ld, %ld )", ARG2,ARG3);
       PRE_REG_READ3(long, "keyctl(KEYCTL_SET_TIMEOUT)",
                     int, option, vki_key_serial_t, key, unsigned, timeout);
       break;
    case VKI_KEYCTL_ASSUME_AUTHORITY:
-      PRINT("sys_keyctl ( KEYCTL_ASSUME_AUTHORITY, %d )", ARG2);
+      PRINT("sys_keyctl ( KEYCTL_ASSUME_AUTHORITY, %ld )", ARG2);
       PRE_REG_READ2(long, "keyctl(KEYCTL_ASSUME_AUTHORITY)",
                     int, option, vki_key_serial_t, key);
       break;
    default:
-      PRINT("sys_keyctl ( %d ) ", ARG1);
+      PRINT("sys_keyctl ( %ld ) ", ARG1);
       PRE_REG_READ1(long, "keyctl", int, option);
       break;
    }
@@ -3019,8 +3019,8 @@
 PRE(sys_init_module)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_init_module ( %p, %llu, %p(\"%s\") )",
-         ARG1, (ULong)ARG2, ARG3, ARG3);
+   PRINT("sys_init_module ( %#lx, %llu, %#lx(\"%s\") )",
+         ARG1, (ULong)ARG2, ARG3, (char*)ARG3);
    PRE_REG_READ3(long, "init_module",
                  void *, umod, unsigned long, len, const char *, uargs);
    PRE_MEM_READ( "init_module(umod)", ARG1, ARG2 );
@@ -3030,7 +3030,7 @@
 PRE(sys_delete_module)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_delete_module ( %p(\"%s\"), 0x%x )", ARG1,ARG1, ARG2);
+   PRINT("sys_delete_module ( %#lx(\"%s\"), 0x%lx )", ARG1,(char*)ARG1, ARG2);
    PRE_REG_READ2(long, "delete_module",
                  const char *, name_user, unsigned int, flags);
    PRE_MEM_RASCIIZ("delete_module(name_user)", ARG1);
diff --git a/coregrind/m_syswrap/syswrap-main.c b/coregrind/m_syswrap/syswrap-main.c
index 5f8bc93..9eea1e2 100644
--- a/coregrind/m_syswrap/syswrap-main.c
+++ b/coregrind/m_syswrap/syswrap-main.c
@@ -951,7 +951,7 @@
          getSyscallStatusFromGuestState( &sci->status, &tst->arch.vex );
          vg_assert(sci->status.what == SsComplete);
 
-         PRINT("SYSCALL[%d,%d](%3d) ... [async] --> %s(0x%llx)\n",
+         PRINT("SYSCALL[%d,%d](%3ld) ... [async] --> %s(0x%llx)\n",
                VG_(getpid)(), tid, sysno, 
                sci->status.sres.isError ? "Failure" : "Success",
                sci->status.sres.isError ? (ULong)sci->status.sres.err
@@ -1155,7 +1155,7 @@
       
       if (p[0] != 0xcd || p[1] != 0x80)
          VG_(message)(Vg_DebugMsg,
-                      "?! restarting over syscall at %p %02x %02x\n",
+                      "?! restarting over syscall at %#x %02x %02x\n",
                       arch->vex.guest_EIP, p[0], p[1]); 
 
       vg_assert(p[0] == 0xcd && p[1] == 0x80);
@@ -1174,7 +1174,7 @@
       
       if (p[0] != 0x0F || p[1] != 0x05)
          VG_(message)(Vg_DebugMsg,
-                      "?! restarting over syscall at %p %02x %02x\n",
+                      "?! restarting over syscall at %#llx %02x %02x\n",
                       arch->vex.guest_RIP, p[0], p[1]); 
 
       vg_assert(p[0] == 0x0F && p[1] == 0x05);
@@ -1193,8 +1193,8 @@
 
       if (p[0] != 0x44 || p[1] != 0x0 || p[2] != 0x0 || p[3] != 0x02)
          VG_(message)(Vg_DebugMsg,
-                      "?! restarting over syscall at %p %02x %02x %02x %02x\n",
-                      arch->vex.guest_CIA, p[0], p[1], p[2], p[3]);
+                      "?! restarting over syscall at %#llx %02x %02x %02x %02x\n",
+                      arch->vex.guest_CIA + 0ULL, p[0], p[1], p[2], p[3]);
 
       vg_assert(p[0] == 0x44 && p[1] == 0x0 && p[2] == 0x0 && p[3] == 0x2);
    }
@@ -1219,7 +1219,7 @@
 
       if (p[0] != 0x44 || p[1] != 0x0 || p[2] != 0x0 || p[3] != 0x02)
          VG_(message)(Vg_DebugMsg,
-                      "?! restarting over syscall at %p %02x %02x %02x %02x\n",
+                      "?! restarting over syscall at %#lx %02x %02x %02x %02x\n",
                       arch->vex.guest_CIA, p[0], p[1], p[2], p[3]);
 
       vg_assert(p[0] == 0x44 && p[1] == 0x0 && p[2] == 0x0 && p[3] == 0x2);
@@ -1301,7 +1301,7 @@
       (real) IP at the time of the signal, and act accordingly. */
 
    if (ip < ML_(blksys_setup) || ip >= ML_(blksys_finished)) {
-      VG_(printf)("  not in syscall (%p - %p)\n", 
+      VG_(printf)("  not in syscall (%#lx - %#lx)\n",
                   ML_(blksys_setup), ML_(blksys_finished));
       /* Looks like we weren't in a syscall at all.  Hmm. */
       vg_assert(sci->status.what != SsIdle);
diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c
index 0e4f021..419e11b 100644
--- a/coregrind/m_syswrap/syswrap-ppc32-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c
@@ -308,10 +308,10 @@
       VG_(register_stack)(seg->start, ctst->client_stack_highest_word);
 
       if (debug)
-	 VG_(printf)("\ntid %d: guessed client stack range %p-%p\n",
+	 VG_(printf)("\ntid %d: guessed client stack range %#lx-%#lx\n",
 		     ctid, seg->start, VG_PGROUNDUP(sp));
    } else {
-      VG_(message)(Vg_UserMsg, "!? New thread %d starts with R1(%p) unmapped\n",
+      VG_(message)(Vg_UserMsg, "!? New thread %d starts with R1(%#lx) unmapped\n",
 		   ctid, sp);
       ctst->client_stack_szB  = 0;
    }
@@ -324,7 +324,7 @@
 
    if (flags & VKI_CLONE_SETTLS) {
       if (debug)
-         VG_(printf)("clone child has SETTLS: tls at %p\n", child_tls);
+         VG_(printf)("clone child has SETTLS: tls at %#lx\n", child_tls);
       ctst->arch.vex.guest_GPR2 = child_tls;
    }
 
@@ -417,7 +417,7 @@
 #  define ARG2_5  (((UWord*)ARG2)[5])
 
    *flags |= SfMayBlock;
-   PRINT("sys_socketcall ( %d, %p )",ARG1,ARG2);
+   PRINT("sys_socketcall ( %ld, %#lx )",ARG1,ARG2);
    PRE_REG_READ2(long, "socketcall", int, call, unsigned long *, args);
 
    switch (ARG1 /* request */) {
@@ -549,7 +549,7 @@
    }
 
    default:
-     VG_(message)(Vg_DebugMsg,"Warning: unhandled socketcall 0x%x",ARG1);
+     VG_(message)(Vg_DebugMsg,"Warning: unhandled socketcall 0x%lx",ARG1);
      SET_STATUS_Failure( VKI_EINVAL );
      break;
    }
@@ -652,7 +652,7 @@
     break;
 
   default:
-    VG_(message)(Vg_DebugMsg,"FATAL: unhandled socketcall 0x%x",ARG1);
+    VG_(message)(Vg_DebugMsg,"FATAL: unhandled socketcall 0x%lx",ARG1);
     VG_(core_panic)("... bye!\n");
     break; /*NOTREACHED*/
   }
@@ -668,7 +668,7 @@
 {
    SysRes r;
 
-   PRINT("sys_mmap ( %p, %llu, %d, %d, %d, %d )",
+   PRINT("sys_mmap ( %#lx, %llu, %ld, %ld, %ld, %ld )",
          ARG1, (ULong)ARG2, ARG3, ARG4, ARG5, ARG6 );
    PRE_REG_READ6(long, "mmap",
                  unsigned long, start, unsigned long, length,
@@ -687,7 +687,7 @@
    // Exactly like old_mmap() except:
    //  - the file offset is specified in 4K units rather than bytes,
    //    so that it can be used for files bigger than 2^32 bytes.
-   PRINT("sys_mmap2 ( %p, %llu, %d, %d, %d, %d )",
+   PRINT("sys_mmap2 ( %#lx, %llu, %ld, %ld, %ld, %ld )",
          ARG1, (ULong)ARG2, ARG3, ARG4, ARG5, ARG6 );
    PRE_REG_READ6(long, "mmap2",
                  unsigned long, start, unsigned long, length,
@@ -705,7 +705,7 @@
 // things, eventually, I think.  --njn
 PRE(sys_stat64)
 {
-   PRINT("sys_stat64 ( %p, %p )",ARG1,ARG2);
+   PRINT("sys_stat64 ( %#lx, %#lx )",ARG1,ARG2);
    PRE_REG_READ2(long, "stat64", char *, file_name, struct stat64 *, buf);
    PRE_MEM_RASCIIZ( "stat64(file_name)", ARG1 );
    PRE_MEM_WRITE( "stat64(buf)", ARG2, sizeof(struct vki_stat64) );
@@ -718,7 +718,7 @@
 
 PRE(sys_lstat64)
 {
-   PRINT("sys_lstat64 ( %p(%s), %p )",ARG1,ARG1,ARG2);
+   PRINT("sys_lstat64 ( %#lx(%s), %#lx )",ARG1,(char*)ARG1,ARG2);
    PRE_REG_READ2(long, "lstat64", char *, file_name, struct stat64 *, buf);
    PRE_MEM_RASCIIZ( "lstat64(file_name)", ARG1 );
    PRE_MEM_WRITE( "lstat64(buf)", ARG2, sizeof(struct vki_stat64) );
@@ -734,7 +734,7 @@
 
 PRE(sys_fstatat64)
 {
-   PRINT("sys_fstatat64 ( %d, %p(%s), %p )",ARG1,ARG2,ARG2,ARG3);
+  PRINT("sys_fstatat64 ( %ld, %#lx(%s), %#lx )",ARG1,ARG2,(char*)ARG2,ARG3);
    PRE_REG_READ3(long, "fstatat64",
                  int, dfd, char *, file_name, struct stat64 *, buf);
    PRE_MEM_RASCIIZ( "fstatat64(file_name)", ARG2 );
@@ -748,7 +748,7 @@
 
 PRE(sys_fstat64)
 {
-  PRINT("sys_fstat64 ( %d, %p )",ARG1,ARG2);
+  PRINT("sys_fstat64 ( %ld, %#lx )",ARG1,ARG2);
   PRE_REG_READ2(long, "fstat64", unsigned long, fd, struct stat64 *, buf);
   PRE_MEM_WRITE( "fstat64(buf)", ARG2, sizeof(struct vki_stat64) );
 }
@@ -767,7 +767,7 @@
 
 PRE(sys_ipc)
 {
-  PRINT("sys_ipc ( %d, %d, %d, %d, %p, %d )", ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
+  PRINT("sys_ipc ( %ld, %ld, %ld, %ld, %#lx, %ld )", ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
   // XXX: this is simplistic -- some args are not used in all circumstances.
   PRE_REG_READ6(int, "ipc",
 		vki_uint, call, int, first, int, second, int, third,
@@ -839,7 +839,7 @@
       ML_(generic_PRE_sys_shmctl)( tid, ARG2, ARG3, ARG5 );
       break;
     default:
-      VG_(message)(Vg_DebugMsg, "FATAL: unhandled syscall(ipc) %d", ARG1 );
+      VG_(message)(Vg_DebugMsg, "FATAL: unhandled syscall(ipc) %ld", ARG1 );
       VG_(core_panic)("... bye!\n");
       break; /*NOTREACHED*/
     }
@@ -904,7 +904,7 @@
     break;
   default:
     VG_(message)(Vg_DebugMsg,
-		 "FATAL: unhandled syscall(ipc) %d",
+		 "FATAL: unhandled syscall(ipc) %ld",
 		 ARG1 );
     VG_(core_panic)("... bye!\n");
     break; /*NOTREACHED*/
@@ -951,7 +951,7 @@
 {
    UInt cloneflags;
 
-   PRINT("sys_clone ( %x, %p, %p, %p, %p )",ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_clone ( %lx, %#lx, %#lx, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5);
    PRE_REG_READ5(int, "clone",
                  unsigned long, flags,
                  void *,        child_stack,
@@ -1011,7 +1011,7 @@
 
    default:
       /* should we just ENOSYS? */
-      VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%x", ARG1);
+      VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%lx", ARG1);
       VG_(message)(Vg_UserMsg, "");
       VG_(message)(Vg_UserMsg, "The only supported clone() uses are:");
       VG_(message)(Vg_UserMsg, " - via a threads library (LinuxThreads or NPTL)");
@@ -1380,7 +1380,7 @@
    struct vki_sigaction new, old;
    struct vki_sigaction *newp, *oldp;
 
-   PRINT("sys_sigaction ( %d, %p, %p )", ARG1,ARG2,ARG3);
+   PRINT("sys_sigaction ( %ld, %#lx, %#lx )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(int, "sigaction",
                  int, signum, const struct old_sigaction *, act,
                  struct old_sigaction *, oldact);
@@ -1445,7 +1445,7 @@
       that takes a pointer to the signal mask so supports more signals.
     */
    *flags |= SfMayBlock;
-   PRINT("sys_sigsuspend ( %d )", ARG1 );
+   PRINT("sys_sigsuspend ( %ld )", ARG1 );
    PRE_REG_READ1(int, "sigsuspend", vki_old_sigset_t, mask);
 }
 
diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
index 3a505e6..739b28a 100644
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
@@ -336,10 +336,10 @@
       VG_(register_stack)(seg->start, ctst->client_stack_highest_word);
 
       if (debug)
-	 VG_(printf)("\ntid %d: guessed client stack range %p-%p\n",
+	 VG_(printf)("\ntid %d: guessed client stack range %#lx-%#lx\n",
 		     ctid, seg->start, VG_PGROUNDUP(sp));
    } else {
-      VG_(message)(Vg_UserMsg, "!? New thread %d starts with R1(%p) unmapped\n",
+      VG_(message)(Vg_UserMsg, "!? New thread %d starts with R1(%#lx) unmapped\n",
 		   ctid, sp);
       ctst->client_stack_szB  = 0;
    }
@@ -352,7 +352,7 @@
 
    if (flags & VKI_CLONE_SETTLS) {
       if (debug)
-         VG_(printf)("clone child has SETTLS: tls at %p\n", child_tls);
+         VG_(printf)("clone child has SETTLS: tls at %#lx\n", child_tls);
       ctst->arch.vex.guest_GPR13 = child_tls;
    }
 
@@ -446,7 +446,7 @@
 #  define ARG2_5  (((UWord*)ARG2)[5])
 
    *flags |= SfMayBlock;
-   PRINT("sys_socketcall ( %d, %p )",ARG1,ARG2);
+   PRINT("sys_socketcall ( %ld, %#lx )",ARG1,ARG2);
    PRE_REG_READ2(long, "socketcall", int, call, unsigned long *, args);
 
    switch (ARG1 /* request */) {
@@ -578,7 +578,7 @@
    }
 
    default:
-     VG_(message)(Vg_DebugMsg,"Warning: unhandled socketcall 0x%x",ARG1);
+     VG_(message)(Vg_DebugMsg,"Warning: unhandled socketcall 0x%lx",ARG1);
      SET_STATUS_Failure( VKI_EINVAL );
      break;
    }
@@ -681,7 +681,7 @@
     break;
 
   default:
-    VG_(message)(Vg_DebugMsg,"FATAL: unhandled socketcall 0x%x",ARG1);
+    VG_(message)(Vg_DebugMsg,"FATAL: unhandled socketcall 0x%lx",ARG1);
     VG_(core_panic)("... bye!\n");
     break; /*NOTREACHED*/
   }
@@ -697,7 +697,7 @@
 {
    SysRes r;
 
-   PRINT("sys_mmap ( %p, %llu, %d, %d, %d, %d )",
+   PRINT("sys_mmap ( %#lx, %llu, %ld, %ld, %ld, %ld )",
          ARG1, (ULong)ARG2, ARG3, ARG4, ARG5, ARG6 );
    PRE_REG_READ6(long, "mmap",
                  unsigned long, start, unsigned long, length,
@@ -782,7 +782,7 @@
 
 PRE(sys_ipc)
 {
-  PRINT("sys_ipc ( %d, %d, %d, %d, %p, %d )", ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
+  PRINT("sys_ipc ( %ld, %ld, %ld, %ld, %#lx, %ld )", ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
   // XXX: this is simplistic -- some args are not used in all circumstances.
   PRE_REG_READ6(int, "ipc",
 		vki_uint, call, int, first, int, second, int, third,
@@ -854,7 +854,7 @@
       ML_(generic_PRE_sys_shmctl)( tid, ARG2, ARG3, ARG5 );
       break;
     default:
-      VG_(message)(Vg_DebugMsg, "FATAL: unhandled syscall(ipc) %d", ARG1 );
+      VG_(message)(Vg_DebugMsg, "FATAL: unhandled syscall(ipc) %ld", ARG1 );
       VG_(core_panic)("... bye!\n");
       break; /*NOTREACHED*/
     }
@@ -919,7 +919,7 @@
     break;
   default:
     VG_(message)(Vg_DebugMsg,
-		 "FATAL: unhandled syscall(ipc) %d",
+		 "FATAL: unhandled syscall(ipc) %ld",
 		 ARG1 );
     VG_(core_panic)("... bye!\n");
     break; /*NOTREACHED*/
@@ -930,7 +930,7 @@
 {
    UInt cloneflags;
 
-   PRINT("sys_clone ( %x, %p, %p, %p, %p )",ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_clone ( %lx, %#lx, %#lx, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5);
    PRE_REG_READ5(int, "clone",
                  unsigned long, flags,
                  void *,        child_stack,
@@ -990,7 +990,7 @@
 
    default:
       /* should we just ENOSYS? */
-      VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%x", ARG1);
+      VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%lx", ARG1);
       VG_(message)(Vg_UserMsg, "");
       VG_(message)(Vg_UserMsg, "The only supported clone() uses are:");
       VG_(message)(Vg_UserMsg, " - via a threads library (LinuxThreads or NPTL)");
@@ -1013,7 +1013,7 @@
 
 PRE(sys_fadvise64)
 {
-   PRINT("sys_fadvise64 ( %d, %lld, %llu, %d )", ARG1,ARG2,ARG3,ARG4);
+   PRINT("sys_fadvise64 ( %ld, %ld, %lu, %ld )", ARG1,ARG2,ARG3,ARG4);
    PRE_REG_READ4(long, "fadvise64",
                  int, fd, vki_loff_t, offset, vki_size_t, len, int, advice);
 }
diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
index 1334576..196f07f 100644
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
@@ -273,10 +273,10 @@
       VG_(register_stack)(seg->start, ctst->client_stack_highest_word);
 
       if (debug)
-	 VG_(printf)("tid %d: guessed client stack range %p-%p\n",
+	 VG_(printf)("tid %d: guessed client stack range %#lx-%#lx\n",
 		     ctid, seg->start, VG_PGROUNDUP(esp));
    } else {
-      VG_(message)(Vg_UserMsg, "!? New thread %d starts with ESP(%p) unmapped\n",
+      VG_(message)(Vg_UserMsg, "!? New thread %d starts with ESP(%#lx) unmapped\n",
 		   ctid, esp);
       ctst->client_stack_szB  = 0;
    }
@@ -293,7 +293,7 @@
    if (flags & VKI_CLONE_SETTLS) {
       if (debug)
 	 VG_(printf)("clone child has SETTLS: tls info at %p: idx=%d "
-                     "base=%p limit=%x; esp=%p fs=%x gs=%x\n",
+                     "base=%#lx limit=%x; esp=%#x fs=%x gs=%x\n",
 		     tlsinfo, tlsinfo->entry_number, 
                      tlsinfo->base_addr, tlsinfo->limit,
 		     ptst->arch.vex.guest_ESP,
@@ -402,7 +402,7 @@
    vg_assert(8 == sizeof(VexGuestX86SegDescr));
 
    if (0)
-      VG_(printf)("translate_to_hw_format: base %p, limit %d\n", 
+      VG_(printf)("translate_to_hw_format: base %#lx, limit %d\n",
                   inn->base_addr, inn->limit );
 
    /* Allow LDTs to be cleared by the user. */
@@ -490,7 +490,7 @@
 
    if (0)
       VG_(printf)("deallocate_LGDTs_for_thread: "
-                  "ldt = 0x%x, gdt = 0x%x\n", 
+                  "ldt = 0x%lx, gdt = 0x%lx\n",
                   vex->guest_LDT, vex->guest_GDT );
 
    if (vex->guest_LDT != (HWord)NULL) {
@@ -813,7 +813,7 @@
       a4 = arg_struct[3];
       a5 = arg_struct[4];
 
-      PRINT("old_select ( %d, %p, %p, %p, %p )", a1,a2,a3,a4,a5);
+      PRINT("old_select ( %d, %#x, %#x, %#x, %#x )", a1,a2,a3,a4,a5);
       if (a2 != (Addr)NULL)
          PRE_MEM_READ( "old_select(readfds)",   a2, a1/8 /* __FD_SETSIZE/8 */ );
       if (a3 != (Addr)NULL)
@@ -829,7 +829,7 @@
 {
    UInt cloneflags;
 
-   PRINT("sys_clone ( %x, %p, %p, %p, %p )",ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_clone ( %lx, %#lx, %#lx, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5);
    PRE_REG_READ5(int, "clone",
                  unsigned long, flags,
                  void *, child_stack,
@@ -925,7 +925,7 @@
    reject:
       /* should we just ENOSYS? */
       VG_(message)(Vg_UserMsg, "");
-      VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%x", ARG1);
+      VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%lx", ARG1);
       VG_(message)(Vg_UserMsg, "");
       VG_(message)(Vg_UserMsg, "The only supported clone() uses are:");
       VG_(message)(Vg_UserMsg, " - via a threads library (LinuxThreads or NPTL)");
@@ -1017,7 +1017,7 @@
 
 PRE(sys_modify_ldt)
 {
-   PRINT("sys_modify_ldt ( %d, %p, %d )", ARG1,ARG2,ARG3);
+   PRINT("sys_modify_ldt ( %ld, %#lx, %ld )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(int, "modify_ldt", int, func, void *, ptr,
                  unsigned long, bytecount);
    
@@ -1039,7 +1039,7 @@
 
 PRE(sys_set_thread_area)
 {
-   PRINT("sys_set_thread_area ( %p )", ARG1);
+   PRINT("sys_set_thread_area ( %#lx )", ARG1);
    PRE_REG_READ1(int, "set_thread_area", struct user_desc *, u_info)
    PRE_MEM_READ( "set_thread_area(u_info)", ARG1, sizeof(vki_modify_ldt_t) );
 
@@ -1049,7 +1049,7 @@
 
 PRE(sys_get_thread_area)
 {
-   PRINT("sys_get_thread_area ( %p )", ARG1);
+   PRINT("sys_get_thread_area ( %#lx )", ARG1);
    PRE_REG_READ1(int, "get_thread_area", struct user_desc *, u_info)
    PRE_MEM_WRITE( "get_thread_area(u_info)", ARG1, sizeof(vki_modify_ldt_t) );
 
@@ -1069,7 +1069,7 @@
 // space, and we should therefore not check anything it points to.
 PRE(sys_ptrace)
 {
-   PRINT("sys_ptrace ( %d, %d, %p, %p )", ARG1,ARG2,ARG3,ARG4);
+   PRINT("sys_ptrace ( %ld, %ld, %#lx, %#lx )", ARG1,ARG2,ARG3,ARG4);
    PRE_REG_READ4(int, "ptrace", 
                  long, request, long, pid, long, addr, long, data);
    switch (ARG1) {
@@ -1157,7 +1157,7 @@
  
 PRE(sys_ipc)
 {
-   PRINT("sys_ipc ( %d, %d, %d, %d, %p, %d )", ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
+   PRINT("sys_ipc ( %ld, %ld, %ld, %ld, %#lx, %ld )", ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
    // XXX: this is simplistic -- some args are not used in all circumstances.
    PRE_REG_READ6(int, "ipc",
                  vki_uint, call, int, first, int, second, int, third,
@@ -1229,7 +1229,7 @@
       ML_(generic_PRE_sys_shmctl)( tid, ARG2, ARG3, ARG5 );
       break;
    default:
-      VG_(message)(Vg_DebugMsg, "FATAL: unhandled syscall(ipc) %d", ARG1 );
+      VG_(message)(Vg_DebugMsg, "FATAL: unhandled syscall(ipc) %ld", ARG1 );
       VG_(core_panic)("... bye!\n");
       break; /*NOTREACHED*/
    }   
@@ -1294,7 +1294,7 @@
       break;
    default:
       VG_(message)(Vg_DebugMsg,
-		   "FATAL: unhandled syscall(ipc) %d",
+		   "FATAL: unhandled syscall(ipc) %ld",
 		   ARG1 );
       VG_(core_panic)("... bye!\n");
       break; /*NOTREACHED*/
@@ -1325,7 +1325,7 @@
    a5 = args[5-1];
    a6 = args[6-1];
 
-   PRINT("old_mmap ( %p, %llu, %d, %d, %d, %d )",
+   PRINT("old_mmap ( %#lx, %llu, %ld, %ld, %ld, %ld )",
          a1, (ULong)a2, a3, a4, a5, a6 );
 
    r = ML_(generic_PRE_sys_mmap)( tid, a1, a2, a3, a4, a5, (Off64T)a6 );
@@ -1343,7 +1343,7 @@
    // pagesize or 4K-size units in offset?  For ppc32/64-linux, this is
    // 4K-sized.  Assert that the page size is 4K here for safety.
    vg_assert(VKI_PAGE_SIZE == 4096);
-   PRINT("sys_mmap2 ( %p, %llu, %d, %d, %d, %d )",
+   PRINT("sys_mmap2 ( %#lx, %llu, %ld, %ld, %ld, %ld )",
          ARG1, (ULong)ARG2, ARG3, ARG4, ARG5, ARG6 );
    PRE_REG_READ6(long, "mmap2",
                  unsigned long, start, unsigned long, length,
@@ -1361,7 +1361,7 @@
 // things, eventually, I think.  --njn
 PRE(sys_lstat64)
 {
-   PRINT("sys_lstat64 ( %p(%s), %p )",ARG1,ARG1,ARG2);
+   PRINT("sys_lstat64 ( %#lx(%s), %#lx )",ARG1,(char*)ARG1,ARG2);
    PRE_REG_READ2(long, "lstat64", char *, file_name, struct stat64 *, buf);
    PRE_MEM_RASCIIZ( "lstat64(file_name)", ARG1 );
    PRE_MEM_WRITE( "lstat64(buf)", ARG2, sizeof(struct vki_stat64) );
@@ -1377,7 +1377,7 @@
 
 PRE(sys_stat64)
 {
-   PRINT("sys_stat64 ( %p(%s), %p )",ARG1,ARG1,ARG2);
+   PRINT("sys_stat64 ( %#lx(%s), %#lx )",ARG1,(char*)ARG1,ARG2);
    PRE_REG_READ2(long, "stat64", char *, file_name, struct stat64 *, buf);
    PRE_MEM_RASCIIZ( "stat64(file_name)", ARG1 );
    PRE_MEM_WRITE( "stat64(buf)", ARG2, sizeof(struct vki_stat64) );
@@ -1390,7 +1390,7 @@
 
 PRE(sys_fstatat64)
 {
-   PRINT("sys_fstatat64 ( %d, %p(%s), %p )",ARG1,ARG2,ARG2,ARG3);
+   PRINT("sys_fstatat64 ( %ld, %#lx(%s), %#lx )",ARG1,ARG2,(char*)ARG2,ARG3);
    PRE_REG_READ3(long, "fstatat64",
                  int, dfd, char *, file_name, struct stat64 *, buf);
    PRE_MEM_RASCIIZ( "fstatat64(file_name)", ARG2 );
@@ -1404,7 +1404,7 @@
 
 PRE(sys_fstat64)
 {
-   PRINT("sys_fstat64 ( %d, %p )",ARG1,ARG2);
+   PRINT("sys_fstat64 ( %ld, %#lx )",ARG1,ARG2);
    PRE_REG_READ2(long, "fstat64", unsigned long, fd, struct stat64 *, buf);
    PRE_MEM_WRITE( "fstat64(buf)", ARG2, sizeof(struct vki_stat64) );
 }
@@ -1424,7 +1424,7 @@
 #  define ARG2_5  (((UWord*)ARG2)[5])
 
    *flags |= SfMayBlock;
-   PRINT("sys_socketcall ( %d, %p )",ARG1,ARG2);
+   PRINT("sys_socketcall ( %ld, %#lx )",ARG1,ARG2);
    PRE_REG_READ2(long, "socketcall", int, call, unsigned long *, args);
 
    switch (ARG1 /* request */) {
@@ -1556,7 +1556,7 @@
    }
 
    default:
-      VG_(message)(Vg_DebugMsg,"Warning: unhandled socketcall 0x%x",ARG1);
+      VG_(message)(Vg_DebugMsg,"Warning: unhandled socketcall 0x%lx",ARG1);
       SET_STATUS_Failure( VKI_EINVAL );
       break;
    }
@@ -1659,7 +1659,7 @@
      break;
 
    default:
-      VG_(message)(Vg_DebugMsg,"FATAL: unhandled socketcall 0x%x",ARG1);
+      VG_(message)(Vg_DebugMsg,"FATAL: unhandled socketcall 0x%lx",ARG1);
       VG_(core_panic)("... bye!\n");
       break; /*NOTREACHED*/
    }
@@ -1683,7 +1683,7 @@
    struct vki_sigaction new, old;
    struct vki_sigaction *newp, *oldp;
 
-   PRINT("sys_sigaction ( %d, %p, %p )", ARG1,ARG2,ARG3);
+   PRINT("sys_sigaction ( %ld, %#lx, %#lx )", ARG1,ARG2,ARG3);
    PRE_REG_READ3(int, "sigaction",
                  int, signum, const struct old_sigaction *, act,
                  struct old_sigaction *, oldact);
@@ -1750,7 +1750,7 @@
       that takes a pointer to the signal mask so supports more signals.
     */
    *flags |= SfMayBlock;
-   PRINT("sys_sigsuspend ( %d, %d, %d )", ARG1,ARG2,ARG3 );
+   PRINT("sys_sigsuspend ( %ld, %ld, %ld )", ARG1,ARG2,ARG3 );
    PRE_REG_READ3(int, "sigsuspend",
                  int, history0, int, history1,
                  vki_old_sigset_t, mask);
@@ -1758,7 +1758,7 @@
 
 PRE(sys_vm86old)
 {
-   PRINT("sys_vm86old ( %p )", ARG1);
+   PRINT("sys_vm86old ( %#lx )", ARG1);
    PRE_REG_READ1(int, "vm86old", struct vm86_struct *, info);
    PRE_MEM_WRITE( "vm86old(info)", ARG1, sizeof(struct vki_vm86_struct));
 }
@@ -1770,7 +1770,7 @@
 
 PRE(sys_vm86)
 {
-   PRINT("sys_vm86 ( %d, %p )", ARG1,ARG2);
+   PRINT("sys_vm86 ( %ld, %#lx )", ARG1,ARG2);
    PRE_REG_READ2(int, "vm86", unsigned long, fn, struct vm86plus_struct *, v86);
    if (ARG1 == VKI_VM86_ENTER || ARG1 == VKI_VM86_ENTER_NO_BYPASS)
       PRE_MEM_WRITE( "vm86(v86)", ARG2, sizeof(struct vki_vm86plus_struct));
diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c
index 35744cd..6bb0100 100644
--- a/coregrind/m_translate.c
+++ b/coregrind/m_translate.c
@@ -74,17 +74,17 @@
                                          + n_SP_updates_generic_unknown;
    VG_(percentify)(n_SP_updates_fast, n_SP_updates, 1, 6, buf);
    VG_(message)(Vg_DebugMsg,
-      "translate:            fast SP updates identified: %,u (%s)",
+      "translate:            fast SP updates identified: %'u (%s)",
       n_SP_updates_fast, buf );
 
    VG_(percentify)(n_SP_updates_generic_known, n_SP_updates, 1, 6, buf);
    VG_(message)(Vg_DebugMsg,
-      "translate:   generic_known SP updates identified: %,u (%s)",
+      "translate:   generic_known SP updates identified: %'u (%s)",
       n_SP_updates_generic_known, buf );
 
    VG_(percentify)(n_SP_updates_generic_unknown, n_SP_updates, 1, 6, buf);
    VG_(message)(Vg_DebugMsg,
-      "translate: generic_unknown SP updates identified: %,u (%s)",
+      "translate: generic_unknown SP updates identified: %'u (%s)",
       n_SP_updates_generic_unknown, buf );
 }
 
diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c
index 76359a7..8d0d35b 100644
--- a/coregrind/m_transtab.c
+++ b/coregrind/m_transtab.c
@@ -1532,23 +1532,23 @@
 void VG_(print_tt_tc_stats) ( void )
 {
    VG_(message)(Vg_DebugMsg,
-      "    tt/tc: %,llu tt lookups requiring %,llu probes", 
+      "    tt/tc: %'llu tt lookups requiring %'llu probes",
       n_full_lookups, n_lookup_probes );
    VG_(message)(Vg_DebugMsg,
-      "    tt/tc: %,llu fast-cache updates, %,llu flushes", 
+      "    tt/tc: %'llu fast-cache updates, %'llu flushes",
       n_fast_updates, n_fast_flushes );
 
    VG_(message)(Vg_DebugMsg,
-                " transtab: new        %,lld "
-                "(%,llu -> %,llu; ratio %,llu:10) [%,llu scs]",
+                " transtab: new        %'lld "
+                "(%'llu -> %'llu; ratio %'llu:10) [%'llu scs]",
                 n_in_count, n_in_osize, n_in_tsize,
                 safe_idiv(10*n_in_tsize, n_in_osize),
                 n_in_sc_count);
    VG_(message)(Vg_DebugMsg,
-                " transtab: dumped     %,llu (%,llu -> ?" "?)",
+                " transtab: dumped     %'llu (%'llu -> ?" "?)",
                 n_dump_count, n_dump_osize );
    VG_(message)(Vg_DebugMsg,
-                " transtab: discarded  %,llu (%,llu -> ?" "?)",
+                " transtab: discarded  %'llu (%'llu -> ?" "?)",
                 n_disc_count, n_disc_osize );
 
    if (0) {
diff --git a/drd/Makefile.am b/drd/Makefile.am
index 665e0c8..ca57d0c 100644
--- a/drd/Makefile.am
+++ b/drd/Makefile.am
@@ -29,7 +29,7 @@
 
 DRD_CFLAGS=@FLAG_W_EXTRA@ @FLAG_UNLIMITED_INLINE_UNIT_GROWTH@ \
            -Wformat-nonliteral -Wno-inline -Wno-unused-parameter \
-           -O2 -DCHECK_FORMAT_STRINGS
+           -O2
 
 AM_CFLAGS_X86_LINUX   += $(DRD_CFLAGS)
 AM_CFLAGS_AMD64_LINUX += $(DRD_CFLAGS)
diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c
index cd728e8..4b9be47 100644
--- a/helgrind/hg_main.c
+++ b/helgrind/hg_main.c
@@ -1060,7 +1060,7 @@
       }
       pp_Thread(d+3, t);
    }
-   space(d); VG_(printf)("}\n", n);
+   space(d); VG_(printf)("}\n");
 }
 
 static void pp_map_threads ( Int d )
@@ -1094,7 +1094,7 @@
 
 static void pp_Lock ( Int d, Lock* lk )
 {
-   space(d+0); VG_(printf)("Lock %p (ga %p) {\n", lk, lk->guestaddr);
+   space(d+0); VG_(printf)("Lock %p (ga %#lx) {\n", lk, lk->guestaddr);
    if (sHOW_ADMIN) {
       space(d+3); VG_(printf)("admin  %p\n",   lk->admin);
       space(d+3); VG_(printf)("magic  0x%x\n", (UInt)lk->magic);
@@ -1132,7 +1132,7 @@
       }
       pp_Lock(d+3, lk);
    }
-   space(d); VG_(printf)("}\n", n);
+   space(d); VG_(printf)("}\n");
 }
 
 static void pp_map_locks ( Int d )
@@ -1180,7 +1180,7 @@
       }
       pp_Segment(d+3, s);
    }
-   space(d); VG_(printf)("}\n", n);
+   space(d); VG_(printf)("}\n");
 }
 
 static void pp_map_segments ( Int d )
@@ -1237,7 +1237,7 @@
    if (is_SHVAL_ShM(w32)) {
       WordSetID tset = un_SHVAL_ShM_tset(w32);
       WordSetID lset = del_BHL( un_SHVAL_ShM_lset(w32) );
-      VG_(sprintf)(buf, "ShMod(#Tset=%d,#Lset=%d)", 
+      VG_(sprintf)(buf, "ShMod(#Tset=%ld,#Lset=%ld)",
                    HG_(cardinalityWS)(univ_tsets, tset),
                    HG_(cardinalityWS)(univ_lsets, lset));
    }
@@ -1245,7 +1245,7 @@
    if (is_SHVAL_ShR(w32)) {
       WordSetID tset = un_SHVAL_ShR_tset(w32);
       WordSetID lset = del_BHL( un_SHVAL_ShR_lset(w32) );
-      VG_(sprintf)(buf, "ShRO(#Tset=%d,#Lset=%d)", 
+      VG_(sprintf)(buf, "ShRO(#Tset=%ld,#Lset=%ld)",
                    HG_(cardinalityWS)(univ_tsets, tset),
                    HG_(cardinalityWS)(univ_lsets, lset));
    }
@@ -1282,7 +1282,7 @@
 #endif
    CacheLineZ* lineZ;
    CacheLineF* lineF;
-   space(d+0); VG_(printf)("SecMap %p (ga %p) {\n", sm, (void*)ga);
+   space(d+0); VG_(printf)("SecMap %p (ga %#lx) {\n", sm, ga);
 
    for (i = 0; i < N_SECMAP_ZLINES; i++) {
       get_ZF_by_index( &lineZ, &lineF, sm, i );
@@ -1295,7 +1295,7 @@
       a   = ga + 1 * i;
       if (! (is_SHVAL_ShM(w32) || is_SHVAL_ShR(w32)))
          continue;
-      space(d+3); VG_(printf)("%p -> 0x%08x ", (void*)a, w32);
+      space(d+3); VG_(printf)("%#lx -> 0x%08x ", (void*)a, w32);
       show_shadow_w32(buf, sizeof(buf), w32);
       VG_(printf)("%s\n", buf);
    }
@@ -2212,7 +2212,7 @@
          VG_(printf)("\\n%s", vtsstr);
       }
 
-      VG_(printf)("\" }\n", vtsstr);
+      VG_(printf)("\" }\n");
 
       if (seg->prev)
          VG_(printf)(PFX "edge: { sourcename: \"%p\" targetname: \"%p\""
@@ -2881,7 +2881,7 @@
 
    tl_assert(lset_old != lset_new);
 
-   if (0) VG_(printf)("XX1: %d (card %d) -> %d (card %d) %p\n", 
+   if (0) VG_(printf)("XX1: %d (card %ld) -> %d (card %ld) %#lx\n",
                       (Int)lset_old, 
                       HG_(cardinalityWS)(univ_lsets,lset_old),
                       (Int)lset_new, 
@@ -2925,7 +2925,7 @@
       it's simple. */
 
    lk = (Lock*)HG_(anyElementOfWS)( univ_lsets, lset_old );
-   if (0) VG_(printf)("lossage %d %p\n", 
+   if (0) VG_(printf)("lossage %ld %p\n",
                       HG_(cardinalityWS)( univ_lsets, lset_old), lk );
    if (lk->appeared_at) {
       if (ga_to_lastlock == NULL)
@@ -2978,7 +2978,7 @@
       VG_(message)(Vg_UserMsg, "");
       announce_one_thread( thr_acc );
       VG_(message)(Vg_UserMsg, 
-                   "TRACE: %p %s %d thr#%d :: %s --> %s",
+                   "TRACE: %#lx %s %d thr#%d :: %s --> %s",
                    a, how, szB, thr_acc->errmsg_index, txt_old, txt_new );
       tid = map_threads_maybe_reverse_lookup_SLOW(thr_acc);
       if (tid != VG_INVALID_THREADID) {
@@ -2987,7 +2987,7 @@
    } else {
       /* Just print one line */
       VG_(message)(Vg_UserMsg, 
-                   "TRACE: %p %s %d thr#%d :: %22s --> %22s",
+                   "TRACE: %#lx %s %d thr#%d :: %22s --> %22s",
                    a, how, szB, thr_acc->errmsg_index, txt_old, txt_new );
    }
 }
@@ -3029,7 +3029,7 @@
 
    tl_assert(is_sane_Thread(thr_acc));
 
-   if (0) VG_(printf)("read thr=%p %p\n", thr_acc, a);
+   if (0) VG_(printf)("read thr=%p %#lx\n", thr_acc, a);
 
    /* Exclusive */
    if (LIKELY(is_SHVAL_Excl(wold))) {
@@ -3163,7 +3163,7 @@
 
    tl_assert(is_sane_Thread(thr_acc));
 
-   if (0) VG_(printf)("write32 thr=%p %p\n", thr_acc, a);
+   if (0) VG_(printf)("write32 thr=%p %#lx\n", thr_acc, a);
 
    /* New */
    if (LIKELY(is_SHVAL_New(wold))) {
@@ -3446,7 +3446,7 @@
                                   * sizeof(CacheLineF);
 
    if (0)
-   VG_(printf)("SM %p: expand F array from %d to %d\n", 
+   VG_(printf)("SM %p: expand F array from %d to %ld\n",
                sm, (Int)sm->linesF_size, new_size);
 
    for (i = 0; i < new_size; i++)
@@ -4881,7 +4881,7 @@
    Bool      mbHasLocks;
 
    if (0 && len > 500)
-      VG_(printf)("make NoAccess ( %p, %d )\n", aIN, len );
+      VG_(printf)("make NoAccess ( %#lx, %ld )\n", aIN, len );
 
    if (len == 0) 
       return;
@@ -4936,7 +4936,7 @@
    /* --- Step 4 --- */
 
    if (0) 
-   VG_(printf)("shadow_mem_make_NoAccess(%p, %u, %p): maybe slow case\n",
+   VG_(printf)("shadow_mem_make_NoAccess(%p, %lu, %p): maybe slow case\n",
                (void*)firstA, (UWord)len, (void*)lastA);
    locksToDelete = HG_(emptyWS)( univ_lsets );
    
@@ -4978,7 +4978,7 @@
    /* --- Step 7 --- */
 
    if (0) 
-   VG_(printf)("shadow_mem_make_NoAccess(%p, %u, %p): definitely slow case\n",
+   VG_(printf)("shadow_mem_make_NoAccess(%p, %lu, %p): definitely slow case\n",
                (void*)firstA, (UWord)len, (void*)lastA);
 
    /* Modify all shadow words, by removing locksToDelete from the lockset
@@ -5705,7 +5705,7 @@
                    <= HG_(cardinalityWS)(univ_tsets, tset_old));
 
          if (0) {
-            VG_(printf)("smga %p: old 0x%x new 0x%x   ",
+            VG_(printf)("smga %#lx: old 0x%x new 0x%x   ",
                         ga, tset_old, tset_new);
             HG_(ppWS)( univ_tsets, tset_old );
             VG_(printf)("  -->  ");
@@ -6650,10 +6650,10 @@
       VG_(printf)("   node %p:\n", me);
       HG_(getPayloadWS)( &ws_words, &ws_size, univ_laog, links->inns );
       for (i = 0; i < ws_size; i++)
-         VG_(printf)("      inn %p\n", ws_words[i] );
+         VG_(printf)("      inn %#lx\n", ws_words[i] );
       HG_(getPayloadWS)( &ws_words, &ws_size, univ_laog, links->outs );
       for (i = 0; i < ws_size; i++)
-         VG_(printf)("      out %p\n", ws_words[i] );
+         VG_(printf)("      out %#lx\n", ws_words[i] );
       me = NULL;
       links = NULL;
    }
@@ -6720,7 +6720,7 @@
          points.  Hence, if there is later a violation of this
          ordering, we can show the user the two places in which the
          required src-dst ordering was previously established. */
-      if (0) VG_(printf)("acquire edge %p %p\n", 
+      if (0) VG_(printf)("acquire edge %#lx %#lx\n",
                          src->guestaddr, dst->guestaddr);
       expo.src_ga = src->guestaddr;
       expo.dst_ga = dst->guestaddr;
@@ -7522,7 +7522,7 @@
       /* --- --- User-visible client requests --- --- */
 
       case VG_USERREQ__HG_CLEAN_MEMORY:
-         if (0) VG_(printf)("VG_USERREQ__HG_CLEAN_MEMORY(%p,%d)\n",
+         if (0) VG_(printf)("VG_USERREQ__HG_CLEAN_MEMORY(%#lx,%ld)\n",
                             args[1], args[2]);
          /* Call die_mem to (expensively) tidy up properly, if there
             are any held locks etc in the area */
@@ -8400,7 +8400,7 @@
          announce_threadset( tset_to_announce );
 
          VG_(message)(Vg_UserMsg,
-                      "Possible data race during %s of size %d at %p",
+                      "Possible data race during %s of size %d at %#lx",
                       what, szB, err_ga);
          VG_(pp_ExeContext)( VG_(get_error_where)(err) );
          /* pp_AddrInfo(err_addr, &extra->addrinfo); */
@@ -8430,7 +8430,7 @@
          announce_threadset( tset_to_announce );
 
          VG_(message)(Vg_UserMsg,
-                      "Possible data race during %s of size %d at %p",
+                      "Possible data race during %s of size %d at %#lx",
                       what, szB, err_ga);
          VG_(pp_ExeContext)( VG_(get_error_where)(err) );
          /* pp_AddrInfo(err_addr, &extra->addrinfo); */
@@ -8454,18 +8454,18 @@
                       "consistent locks",
                       thr_acc->errmsg_index);
          if (xe->XE.Race.mb_lastlock) {
-            VG_(message)(Vg_UserMsg, "  Last consistently used lock for %p was "
+            VG_(message)(Vg_UserMsg, "  Last consistently used lock for %#lx was "
                                      "first observed", err_ga);
             VG_(pp_ExeContext)(xe->XE.Race.mb_lastlock);
          } else {
-            VG_(message)(Vg_UserMsg, "  Location %p has never been protected "
+            VG_(message)(Vg_UserMsg, "  Location %#lx has never been protected "
                                      "by any lock", err_ga);
          }
       }
       /* Hmm, unknown transition.  Just print what we do know. */
       else {
          VG_(message)(Vg_UserMsg,
-                      "Possible data race during %s of size %d at %p",
+                      "Possible data race during %s of size %d at %#lx",
                       what, szB, err_ga);
          VG_(pp_ExeContext)( VG_(get_error_where)(err) );
 
@@ -8477,9 +8477,9 @@
 
       /* If we have a better description of the address, show it. */
       if (xe->XE.Race.descr1[0] != 0)
-         VG_(message)(Vg_UserMsg, "  %s", &xe->XE.Race.descr1);
+         VG_(message)(Vg_UserMsg, "  %s", &xe->XE.Race.descr1[0]);
       if (xe->XE.Race.descr2[0] != 0)
-         VG_(message)(Vg_UserMsg, "  %s", &xe->XE.Race.descr2);
+         VG_(message)(Vg_UserMsg, "  %s", &xe->XE.Race.descr2[0]);
 
       break; /* case XE_Race */
    } /* case XE_Race */
@@ -8670,113 +8670,113 @@
       }
 
       VG_(printf)("\n");
-      VG_(printf)(" hbefore: %,10lu queries\n",        stats__hbefore_queries);
-      VG_(printf)(" hbefore: %,10lu cache 0 hits\n",   stats__hbefore_cache0s);
-      VG_(printf)(" hbefore: %,10lu cache > 0 hits\n", stats__hbefore_cacheNs);
-      VG_(printf)(" hbefore: %,10lu graph searches\n", stats__hbefore_gsearches);
-      VG_(printf)(" hbefore: %,10lu   of which slow\n",
+      VG_(printf)(" hbefore: %'10lu queries\n",        stats__hbefore_queries);
+      VG_(printf)(" hbefore: %'10lu cache 0 hits\n",   stats__hbefore_cache0s);
+      VG_(printf)(" hbefore: %'10lu cache > 0 hits\n", stats__hbefore_cacheNs);
+      VG_(printf)(" hbefore: %'10lu graph searches\n", stats__hbefore_gsearches);
+      VG_(printf)(" hbefore: %'10lu   of which slow\n",
                   stats__hbefore_gsearches - stats__hbefore_gsearchFs);
-      VG_(printf)(" hbefore: %,10lu stack high water mark\n",
+      VG_(printf)(" hbefore: %'10lu stack high water mark\n",
                   stats__hbefore_stk_hwm);
-      VG_(printf)(" hbefore: %,10lu cache invals\n",   stats__hbefore_invals);
-      VG_(printf)(" hbefore: %,10lu probes\n",         stats__hbefore_probes);
+      VG_(printf)(" hbefore: %'10lu cache invals\n",   stats__hbefore_invals);
+      VG_(printf)(" hbefore: %'10lu probes\n",         stats__hbefore_probes);
 
       VG_(printf)("\n");
-      VG_(printf)("        segments: %,8lu Segment objects allocated\n", 
+      VG_(printf)("        segments: %'8lu Segment objects allocated\n",
                   stats__mk_Segment);
-      VG_(printf)("        locksets: %,8d unique lock sets\n",
+      VG_(printf)("        locksets: %'8d unique lock sets\n",
                   (Int)HG_(cardinalityWSU)( univ_lsets ));
-      VG_(printf)("      threadsets: %,8d unique thread sets\n",
+      VG_(printf)("      threadsets: %'8d unique thread sets\n",
                   (Int)HG_(cardinalityWSU)( univ_tsets ));
-      VG_(printf)("       univ_laog: %,8d unique lock sets\n",
+      VG_(printf)("       univ_laog: %'8d unique lock sets\n",
                   (Int)HG_(cardinalityWSU)( univ_laog ));
 
-      VG_(printf)("L(ast)L(ock) map: %,8lu inserts (%d map size)\n", 
+      VG_(printf)("L(ast)L(ock) map: %'8lu inserts (%d map size)\n",
                   stats__ga_LL_adds,
                   (Int)(ga_to_lastlock ? HG_(sizeFM)( ga_to_lastlock ) : 0) );
 
-      VG_(printf)("  LockN-to-P map: %,8lu queries (%d map size)\n", 
+      VG_(printf)("  LockN-to-P map: %'8lu queries (%d map size)\n",
                   stats__ga_LockN_to_P_queries,
                   (Int)(yaWFM ? HG_(sizeFM)( yaWFM ) : 0) );
 
-      VG_(printf)("string table map: %,8lu queries (%d map size)\n", 
+      VG_(printf)("string table map: %'8lu queries (%d map size)\n",
                   stats__string_table_queries,
                   (Int)(string_table ? HG_(sizeFM)( string_table ) : 0) );
-      VG_(printf)("            LAOG: %,8d map size\n", 
+      VG_(printf)("            LAOG: %'8d map size\n",
                   (Int)(laog ? HG_(sizeFM)( laog ) : 0));
-      VG_(printf)(" LAOG exposition: %,8d map size\n", 
+      VG_(printf)(" LAOG exposition: %'8d map size\n",
                   (Int)(laog_exposition ? HG_(sizeFM)( laog_exposition ) : 0));
-      VG_(printf)("           locks: %,8lu acquires, "
-                  "%,lu releases\n",
+      VG_(printf)("           locks: %'8lu acquires, "
+                  "%'lu releases\n",
                   stats__lockN_acquires,
                   stats__lockN_releases
                  );
-      VG_(printf)("   sanity checks: %,8lu\n", stats__sanity_checks);
+      VG_(printf)("   sanity checks: %'8lu\n", stats__sanity_checks);
 
       VG_(printf)("\n");
-      VG_(printf)("     msm: %,12lu %,12lu rd/wr_Excl_nochange\n",
+      VG_(printf)("     msm: %'12lu %'12lu rd/wr_Excl_nochange\n",
                   stats__msm_read_Excl_nochange, stats__msm_write_Excl_nochange);
-      VG_(printf)("     msm: %,12lu %,12lu rd/wr_Excl_transfer\n",
+      VG_(printf)("     msm: %'12lu %'12lu rd/wr_Excl_transfer\n",
                   stats__msm_read_Excl_transfer, stats__msm_write_Excl_transfer);
-      VG_(printf)("     msm: %,12lu %,12lu rd/wr_Excl_to_ShR/ShM\n",
+      VG_(printf)("     msm: %'12lu %'12lu rd/wr_Excl_to_ShR/ShM\n",
                   stats__msm_read_Excl_to_ShR,   stats__msm_write_Excl_to_ShM);
-      VG_(printf)("     msm: %,12lu %,12lu rd/wr_ShR_to_ShR/ShM\n",
+      VG_(printf)("     msm: %'12lu %'12lu rd/wr_ShR_to_ShR/ShM\n",
                   stats__msm_read_ShR_to_ShR,    stats__msm_write_ShR_to_ShM);
-      VG_(printf)("     msm: %,12lu %,12lu rd/wr_ShM_to_ShM\n",
+      VG_(printf)("     msm: %'12lu %'12lu rd/wr_ShM_to_ShM\n",
                   stats__msm_read_ShM_to_ShM,    stats__msm_write_ShM_to_ShM);
-      VG_(printf)("     msm: %,12lu %,12lu rd/wr_New_to_Excl\n",
+      VG_(printf)("     msm: %'12lu %'12lu rd/wr_New_to_Excl\n",
                   stats__msm_read_New_to_Excl,   stats__msm_write_New_to_Excl);
-      VG_(printf)("     msm: %,12lu %,12lu rd/wr_NoAccess\n",
+      VG_(printf)("     msm: %'12lu %'12lu rd/wr_NoAccess\n",
                   stats__msm_read_NoAccess,      stats__msm_write_NoAccess);
 
       VG_(printf)("\n");
-      VG_(printf)(" secmaps: %,10lu allocd (%,12lu g-a-range)\n",
+      VG_(printf)(" secmaps: %'10lu allocd (%'12lu g-a-range)\n",
                   stats__secmaps_allocd,
                   stats__secmap_ga_space_covered);
-      VG_(printf)("  linesZ: %,10lu allocd (%,12lu bytes occupied)\n",
+      VG_(printf)("  linesZ: %'10lu allocd (%'12lu bytes occupied)\n",
                   stats__secmap_linesZ_allocd,
                   stats__secmap_linesZ_bytes);
-      VG_(printf)("  linesF: %,10lu allocd (%,12lu bytes occupied)\n",
+      VG_(printf)("  linesF: %'10lu allocd (%'12lu bytes occupied)\n",
                   stats__secmap_linesF_allocd,
                   stats__secmap_linesF_bytes);
-      VG_(printf)(" secmaps: %,10lu iterator steppings\n",
+      VG_(printf)(" secmaps: %'10lu iterator steppings\n",
                   stats__secmap_iterator_steppings);
 
       VG_(printf)("\n");
-      VG_(printf)("   cache: %,lu totrefs (%,lu misses)\n",
+      VG_(printf)("   cache: %'lu totrefs (%'lu misses)\n",
                   stats__cache_totrefs, stats__cache_totmisses );
-      VG_(printf)("   cache: %,12lu Z-fetch, %,12lu F-fetch\n",
+      VG_(printf)("   cache: %'12lu Z-fetch, %'12lu F-fetch\n",
                   stats__cache_Z_fetches, stats__cache_F_fetches );
-      VG_(printf)("   cache: %,12lu Z-wback, %,12lu F-wback\n",
+      VG_(printf)("   cache: %'12lu Z-wback, %'12lu F-wback\n",
                   stats__cache_Z_wbacks, stats__cache_F_wbacks );
-      VG_(printf)("   cache: %,12lu invals,  %,12lu flushes\n",
+      VG_(printf)("   cache: %'12lu invals,  %'12lu flushes\n",
                   stats__cache_invals, stats__cache_flushes );
 
       VG_(printf)("\n");
-      VG_(printf)("   cline: %,10lu normalises\n",
+      VG_(printf)("   cline: %'10lu normalises\n",
                   stats__cline_normalises );
-      VG_(printf)("   cline:  reads 8/4/2/1: %,12lu %,12lu %,12lu %,12lu\n",
+      VG_(printf)("   cline:  reads 8/4/2/1: %'12lu %'12lu %'12lu %'12lu\n",
                   stats__cline_read64s,
                   stats__cline_read32s,
                   stats__cline_read16s,
                   stats__cline_read8s );
-      VG_(printf)("   cline: writes 8/4/2/1: %,12lu %,12lu %,12lu %,12lu\n",
+      VG_(printf)("   cline: writes 8/4/2/1: %'12lu %'12lu %'12lu %'12lu\n",
                   stats__cline_write64s,
                   stats__cline_write32s,
                   stats__cline_write16s,
                   stats__cline_write8s );
-      VG_(printf)("   cline:   sets 8/4/2/1: %,12lu %,12lu %,12lu %,12lu\n",
+      VG_(printf)("   cline:   sets 8/4/2/1: %'12lu %'12lu %'12lu %'12lu\n",
                   stats__cline_set64s,
                   stats__cline_set32s,
                   stats__cline_set16s,
                   stats__cline_set8s );
-      VG_(printf)("   cline: get1s %,lu, copy1s %,lu\n",
+      VG_(printf)("   cline: get1s %'lu, copy1s %'lu\n",
                   stats__cline_get8s, stats__cline_copy8s );
-      VG_(printf)("   cline:    splits: 8to4 %,12lu    4to2 %,12lu    2to1 %,12lu\n",
+      VG_(printf)("   cline:    splits: 8to4 %'12lu    4to2 %'12lu    2to1 %'12lu\n",
                  stats__cline_64to32splits,
                  stats__cline_32to16splits,
                  stats__cline_16to8splits );
-      VG_(printf)("   cline: pulldowns: 8to4 %,12lu    4to2 %,12lu    2to1 %,12lu\n",
+      VG_(printf)("   cline: pulldowns: 8to4 %'12lu    4to2 %'12lu    2to1 %'12lu\n",
                  stats__cline_64to32pulldown,
                  stats__cline_32to16pulldown,
                  stats__cline_16to8pulldown );
diff --git a/helgrind/hg_wordset.c b/helgrind/hg_wordset.c
index a85effc..77e09b0 100644
--- a/helgrind/hg_wordset.c
+++ b/helgrind/hg_wordset.c
@@ -494,21 +494,21 @@
 void HG_(ppWSUstats) ( WordSetU* wsu, HChar* name )
 {
    VG_(printf)("   WordSet \"%s\":\n", name);
-   VG_(printf)("      addTo        %10u (%u uncached)\n",
+   VG_(printf)("      addTo        %10lu (%lu uncached)\n",
                wsu->n_add, wsu->n_add_uncached);
-   VG_(printf)("      delFrom      %10u (%u uncached)\n", 
+   VG_(printf)("      delFrom      %10lu (%lu uncached)\n",
                wsu->n_del, wsu->n_del_uncached);
-   VG_(printf)("      union        %10u\n", wsu->n_union);
-   VG_(printf)("      intersect    %10u (%u uncached) [nb. incl isSubsetOf]\n", 
+   VG_(printf)("      union        %10lu\n", wsu->n_union);
+   VG_(printf)("      intersect    %10lu (%lu uncached) [nb. incl isSubsetOf]\n",
                wsu->n_intersect, wsu->n_intersect_uncached);
-   VG_(printf)("      minus        %10u (%u uncached)\n",
+   VG_(printf)("      minus        %10lu (%lu uncached)\n",
                wsu->n_minus, wsu->n_minus_uncached);
-   VG_(printf)("      elem         %10u\n",   wsu->n_elem);
-   VG_(printf)("      doubleton    %10u\n",   wsu->n_doubleton);
-   VG_(printf)("      isEmpty      %10u\n",   wsu->n_isEmpty);
-   VG_(printf)("      isSingleton  %10u\n",   wsu->n_isSingleton);
-   VG_(printf)("      anyElementOf %10u\n",   wsu->n_anyElementOf);
-   VG_(printf)("      isSubsetOf   %10u\n",   wsu->n_isSubsetOf);
+   VG_(printf)("      elem         %10lu\n",   wsu->n_elem);
+   VG_(printf)("      doubleton    %10lu\n",   wsu->n_doubleton);
+   VG_(printf)("      isEmpty      %10lu\n",   wsu->n_isEmpty);
+   VG_(printf)("      isSingleton  %10lu\n",   wsu->n_isSingleton);
+   VG_(printf)("      anyElementOf %10lu\n",   wsu->n_anyElementOf);
+   VG_(printf)("      isSubsetOf   %10lu\n",   wsu->n_isSubsetOf);
 }
 
 WordSet HG_(addToWS) ( WordSetU* wsu, WordSet ws, UWord w )
diff --git a/include/pub_tool_libcprint.h b/include/pub_tool_libcprint.h
index 8d6770c..d853507 100644
--- a/include/pub_tool_libcprint.h
+++ b/include/pub_tool_libcprint.h
@@ -32,14 +32,13 @@
 #define __PUB_TOOL_LIBCPRINT_H
 
 
-/* Enable compile-time format string checking by gcc if the macro
-   CHECK_FORMAT_STRINGS has been defined before this file has been included.
+/* Enable compile-time format string checking by gcc.
    This feature is supported since at least gcc version 2.95.
    For more information about the format attribute, see also
    http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Function-Attributes.html.
  */
 
-#if defined(__GNUC__) && defined(CHECK_FORMAT_STRINGS)
+#if defined(__GNUC__)
 #define PRINTF_CHECK(x, y) __attribute__((format(__printf__, x, y)))
 #else
 #define PRINTF_CHECK(x, y)
@@ -85,10 +84,22 @@
    }
    VgMsgKind;
 
-/* Send a single-part message.  Appends a newline. */
-extern UInt VG_(message)    ( VgMsgKind kind, const HChar* format, ... ) PRINTF_CHECK(2, 3);
+/* Send a single-part message.  Appends a newline. The format
+   specification may contain any ISO C format specifier or %t.
+   No attempt is made to let the compiler verify consistency of the
+   format string and the argument list. */
+extern UInt VG_(message_no_f_c)( VgMsgKind kind, const HChar* format, ... );
+/* Send a single-part message.  Appends a newline. The format
+   specification may contain any ISO C format specifier. The gcc compiler
+   will verify consistency of the format string and the argument list. */
+extern UInt VG_(message)( VgMsgKind kind, const HChar* format, ... )
+  PRINTF_CHECK(2, 3);
 
-extern UInt VG_(vmessage)   ( VgMsgKind kind, const HChar* format, va_list vargs ) PRINTF_CHECK(2, 0);
+extern UInt VG_(vmessage)( VgMsgKind kind, const HChar* format, va_list vargs )
+  PRINTF_CHECK(2, 0);
+
+
+
 #endif   // __PUB_TOOL_LIBCPRINT_H
 
 /*--------------------------------------------------------------------*/
diff --git a/lackey/lk_main.c b/lackey/lk_main.c
index 38047c3..737e92c 100644
--- a/lackey/lk_main.c
+++ b/lackey/lk_main.c
@@ -374,7 +374,7 @@
                 "   -------------------------------------------");
    for (typeIx = 0; typeIx < N_TYPES; typeIx++) {
       VG_(message)(Vg_UserMsg,
-                   "   %4s %,12llu %,12llu %,12llu", 
+                   "   %4s %'12llu %'12llu %'12llu",
                    nameOfTypeIndex( typeIx ),
                    detailCounts[OpLoad ][typeIx],
                    detailCounts[OpStore][typeIx],
@@ -866,32 +866,32 @@
       ULong taken_Jccs = (n_Jccs - n_Jccs_untaken) + n_IJccs_untaken;
 
       VG_(message)(Vg_UserMsg,
-         "Counted %,llu calls to %s()", n_func_calls, clo_fnname);
+         "Counted %'llu calls to %s()", n_func_calls, clo_fnname);
 
       VG_(message)(Vg_UserMsg, "");
       VG_(message)(Vg_UserMsg, "Jccs:");
-      VG_(message)(Vg_UserMsg, "  total:         %,llu", total_Jccs);
+      VG_(message)(Vg_UserMsg, "  total:         %'llu", total_Jccs);
       VG_(percentify)(taken_Jccs, (total_Jccs ? total_Jccs : 1),
          percentify_decs, percentify_size, percentify_buf);
-      VG_(message)(Vg_UserMsg, "  taken:         %,llu (%s)", 
+      VG_(message)(Vg_UserMsg, "  taken:         %'llu (%s)",
          taken_Jccs, percentify_buf);
       
       VG_(message)(Vg_UserMsg, "");
       VG_(message)(Vg_UserMsg, "Executed:");
-      VG_(message)(Vg_UserMsg, "  SBs entered:   %,llu", n_SBs_entered);
-      VG_(message)(Vg_UserMsg, "  SBs completed: %,llu", n_SBs_completed);
-      VG_(message)(Vg_UserMsg, "  guest instrs:  %,llu", n_guest_instrs);
-      VG_(message)(Vg_UserMsg, "  IRStmts:       %,llu", n_IRStmts);
+      VG_(message)(Vg_UserMsg, "  SBs entered:   %'llu", n_SBs_entered);
+      VG_(message)(Vg_UserMsg, "  SBs completed: %'llu", n_SBs_completed);
+      VG_(message)(Vg_UserMsg, "  guest instrs:  %'llu", n_guest_instrs);
+      VG_(message)(Vg_UserMsg, "  IRStmts:       %'llu", n_IRStmts);
       
       VG_(message)(Vg_UserMsg, "");
       VG_(message)(Vg_UserMsg, "Ratios:");
       tl_assert(n_SBs_entered); // Paranoia time.
-      VG_(message)(Vg_UserMsg, "  guest instrs : SB entered  = %3u : 10",
+      VG_(message)(Vg_UserMsg, "  guest instrs : SB entered  = %3llu : 10",
          10 * n_guest_instrs / n_SBs_entered);
-      VG_(message)(Vg_UserMsg, "       IRStmts : SB entered  = %3u : 10",
+      VG_(message)(Vg_UserMsg, "       IRStmts : SB entered  = %3llu : 10",
          10 * n_IRStmts / n_SBs_entered);
       tl_assert(n_guest_instrs); // Paranoia time.
-      VG_(message)(Vg_UserMsg, "       IRStmts : guest instr = %3u : 10",
+      VG_(message)(Vg_UserMsg, "       IRStmts : guest instr = %3llu : 10",
          10 * n_IRStmts / n_guest_instrs);
    }
 
diff --git a/memcheck/mc_errors.c b/memcheck/mc_errors.c
index 42430b2..52e881e 100644
--- a/memcheck/mc_errors.c
+++ b/memcheck/mc_errors.c
@@ -302,7 +302,7 @@
             relative = "inside";
          }
          VG_(message)(Vg_UserMsg, 
-            "%sAddress 0x%lx is %,lu bytes %s a %s of size %,lu %s%s",
+            "%sAddress 0x%lx is %'lu bytes %s a %s of size %'lu %s%s",
             xpre,
             a, delta, relative, ai->Addr.Block.block_desc,
             block_szB,
@@ -315,14 +315,14 @@
       }
 
       case Addr_DataSym:
-         VG_(message)(Vg_UserMsg, 
-                      "%sAddress 0x%llx is %llu bytes "
-                        "inside data symbol \"%t\"%s", 
-                      xpre, 
-                      (ULong)a, 
-                      (ULong)ai->Addr.DataSym.offset,
-                      ai->Addr.DataSym.name, 
-                      xpost);
+         VG_(message_no_f_c)(Vg_UserMsg,
+                             "%sAddress 0x%llx is %llu bytes "
+                             "inside data symbol \"%t\"%s",
+                             xpre,
+                             (ULong)a,
+                             (ULong)ai->Addr.DataSym.offset,
+                             ai->Addr.DataSym.name,
+                             xpost);
          break;
 
       case Addr_Variable:
@@ -335,13 +335,13 @@
          break;
 
       case Addr_SectKind:
-         VG_(message)(Vg_UserMsg, 
-                      "%sAddress 0x%llx is in the %t segment of %t%s",
-                      xpre, 
-                      (ULong)a, 
-                      VG_(pp_SectKind)(ai->Addr.SectKind.kind),
-                      ai->Addr.SectKind.objname, 
-                      xpost);
+         VG_(message_no_f_c)(Vg_UserMsg,
+                             "%sAddress 0x%llx is in the %t segment of %t%s",
+                             xpre,
+                             (ULong)a,
+                             VG_(pp_SectKind)(ai->Addr.SectKind.kind),
+                             ai->Addr.SectKind.objname,
+                             xpost);
          break;
 
       default:
@@ -568,16 +568,16 @@
          LossRecord* l               = extra->Err.Leak.lossRecord;
 
          if (VG_(clo_xml)) {
-            VG_(message)(Vg_UserMsg, "  <kind>%t</kind>",
-                         xml_leak_kind(l->loss_mode));
+            VG_(message_no_f_c)(Vg_UserMsg, "  <kind>%t</kind>",
+                                xml_leak_kind(l->loss_mode));
          } else {
             VG_(message)(Vg_UserMsg, "");
          }
 
          if (l->indirect_bytes) {
             VG_(message)(Vg_UserMsg, 
-               "%s%,lu (%,lu direct, %,lu indirect) bytes in %,u blocks"
-               " are %s in loss record %,u of %,u%s",
+               "%s%'lu (%'lu direct, %'lu indirect) bytes in %'u blocks"
+               " are %s in loss record %'u of %'u%s",
                xpre,
                l->total_bytes + l->indirect_bytes, 
                l->total_bytes, l->indirect_bytes, l->num_blocks,
@@ -594,14 +594,14 @@
          } else {
             VG_(message)(
                Vg_UserMsg, 
-               "%s%,lu bytes in %,u blocks are %s in loss record %,u of %,u%s",
+               "%s%'lu bytes in %'u blocks are %s in loss record %'u of %'u%s",
                xpre,
                l->total_bytes, l->num_blocks,
                str_leak_lossmode(l->loss_mode), n_this_record, n_total_records,
                xpost
             );
             if (VG_(clo_xml)) {
-               VG_(message)(Vg_UserMsg, "  <leakedbytes>%d</leakedbytes>", 
+               VG_(message)(Vg_UserMsg, "  <leakedbytes>%ld</leakedbytes>",
                                         l->total_bytes);
                VG_(message)(Vg_UserMsg, "  <leakedblocks>%d</leakedblocks>", 
                                         l->num_blocks);
diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c
index a8af9ff..3a7fa65 100644
--- a/memcheck/mc_leakcheck.c
+++ b/memcheck/mc_leakcheck.c
@@ -65,7 +65,7 @@
 void scan_all_valid_memory_catcher ( Int sigNo, Addr addr )
 {
    if (0)
-      VG_(printf)("OUCH! sig=%d addr=%p\n", sigNo, addr);
+      VG_(printf)("OUCH! sig=%d addr=%#lx\n", sigNo, addr);
    if (sigNo == VKI_SIGSEGV || sigNo == VKI_SIGBUS)
       __builtin_longjmp(memscan_jmpbuf, 1);
 }
@@ -234,7 +234,7 @@
    sh_no = find_shadow_for(ptr, lc_shadows, lc_n_shadows);
 
    if (VG_DEBUG_LEAKCHECK)
-      VG_(printf)("ptr=%p -> block %d\n", ptr, sh_no);
+      VG_(printf)("ptr=%#lx -> block %d\n", ptr, sh_no);
 
    if (sh_no == -1)
       return;
@@ -247,7 +247,7 @@
 
    if (lc_markstack[sh_no].state == Unreached) {
       if (0)
-	 VG_(printf)("pushing %p-%p\n", lc_shadows[sh_no]->data, 
+	 VG_(printf)("pushing %#lx-%#lx\n", lc_shadows[sh_no]->data,
 		     lc_shadows[sh_no]->data + lc_shadows[sh_no]->szB);
 
       tl_assert(lc_markstack[sh_no].next == -1);
@@ -259,7 +259,7 @@
 
    if (clique != -1) {
       if (0)
-	 VG_(printf)("mopup: %d: %p is %d\n", 
+	 VG_(printf)("mopup: %d: %#lx is %d\n",
 		     sh_no, lc_shadows[sh_no]->data, lc_markstack[sh_no].state);
 
       /* An unmarked block - add it to the clique.  Add its size to
@@ -277,10 +277,12 @@
 	       if (lc_markstack[sh_no].indirect)
 		  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);
+			      lc_shadows[sh_no]->szB + 0UL,
+                              lc_markstack[sh_no].indirect);
 	       else
 		  VG_(printf)("  %d joining %d adding %lu\n", 
-			      sh_no, clique, lc_shadows[sh_no]->szB);
+			      sh_no, clique,
+                              lc_shadows[sh_no]->szB + 0UL);
 	    }
 
 	    lc_markstack[clique].indirect += lc_shadows[sh_no]->szB;
@@ -327,7 +329,7 @@
    vki_sigset_t sigmask;
 
    if (VG_DEBUG_LEAKCHECK)
-      VG_(printf)("scan %p-%p\n", start, start+len);
+      VG_(printf)("scan %#lx-%#lx\n", start, start+len);
    VG_(sigprocmask)(VKI_SIG_SETMASK, NULL, &sigmask);
    VG_(set_fault_catcher)(scan_all_valid_memory_catcher);
 
@@ -357,7 +359,7 @@
 	    addr = *(Addr *)ptr;
 	    lc_markstack_push_WRK(addr, clique);
 	 } else if (0 && VG_DEBUG_LEAKCHECK)
-	    VG_(printf)("%p not valid\n", ptr);
+	    VG_(printf)("%#lx not valid\n", ptr);
 	 ptr += sizeof(Addr);
       } else {
 	 /* We need to restore the signal mask, because we were
@@ -415,7 +417,7 @@
       pass), then the cliques are merged. */
    for (i = 0; i < lc_n_shadows; i++) {
       if (VG_DEBUG_CLIQUE)
-	 VG_(printf)("cliques: %d at %p -> Loss state %d\n",
+	 VG_(printf)("cliques: %d at %#lx -> Loss state %d\n",
 		     i, lc_shadows[i]->data, lc_markstack[i].state);
       if (lc_markstack[i].state != Unreached)
 	 continue;
@@ -423,7 +425,7 @@
       tl_assert(lc_markstack_top == -1);
 
       if (VG_DEBUG_CLIQUE)
-	 VG_(printf)("%d: gathering clique %p\n", i, lc_shadows[i]->data);
+	 VG_(printf)("%d: gathering clique %#lx\n", i, lc_shadows[i]->data);
       
       lc_markstack_push_WRK(lc_shadows[i]->data, i);
 
@@ -723,7 +725,7 @@
 
    if (VG_(clo_verbosity) > 0 && !VG_(clo_xml))
       VG_(message)(Vg_UserMsg, 
-                   "searching for pointers to %,d not-freed blocks.", 
+                   "searching for pointers to %'d not-freed blocks.",
                    lc_n_shadows );
 
    lc_min_mallocd_addr = lc_shadows[0]->data;
@@ -783,7 +785,7 @@
         }
 
         if (0)
-           VG_(printf)("ACCEPT %2d  %p %p\n", i, seg->start, seg->end);
+           VG_(printf)("ACCEPT %2d  %#lx %#lx\n", i, seg->start, seg->end);
         lc_scan_memory(seg->start, seg->end+1 - seg->start);
      }
    }
@@ -795,7 +797,7 @@
    lc_do_leakcheck(-1);
 
    if (VG_(clo_verbosity) > 0 && !VG_(clo_xml))
-      VG_(message)(Vg_UserMsg, "checked %,lu bytes.", lc_scanned);
+      VG_(message)(Vg_UserMsg, "checked %'lu bytes.", lc_scanned);
 
    blocks_leaked     = MC_(bytes_leaked)     = 0;
    blocks_indirect   = MC_(bytes_indirect)   = 0;
@@ -811,16 +813,16 @@
    if (VG_(clo_verbosity) > 0 && !VG_(clo_xml)) {
       VG_(message)(Vg_UserMsg, "");
       VG_(message)(Vg_UserMsg, "LEAK SUMMARY:");
-      VG_(message)(Vg_UserMsg, "   definitely lost: %,lu bytes in %,lu blocks.",
+      VG_(message)(Vg_UserMsg, "   definitely lost: %'lu bytes in %'lu blocks.",
                                MC_(bytes_leaked), blocks_leaked );
       if (blocks_indirect > 0)
-	 VG_(message)(Vg_UserMsg, "   indirectly lost: %,lu bytes in %,lu blocks.",
+	 VG_(message)(Vg_UserMsg, "   indirectly lost: %'lu bytes in %'lu blocks.",
 		      MC_(bytes_indirect), blocks_indirect );
-      VG_(message)(Vg_UserMsg, "     possibly lost: %,lu bytes in %,lu blocks.",
+      VG_(message)(Vg_UserMsg, "     possibly lost: %'lu bytes in %'lu blocks.",
                                MC_(bytes_dubious), blocks_dubious );
-      VG_(message)(Vg_UserMsg, "   still reachable: %,lu bytes in %,lu blocks.",
+      VG_(message)(Vg_UserMsg, "   still reachable: %'lu bytes in %'lu blocks.",
                                MC_(bytes_reachable), blocks_reachable );
-      VG_(message)(Vg_UserMsg, "        suppressed: %,lu bytes in %,lu blocks.",
+      VG_(message)(Vg_UserMsg, "        suppressed: %'lu bytes in %'lu blocks.",
                                MC_(bytes_suppressed), blocks_suppressed );
       if (mode == LC_Summary 
           && (blocks_leaked + blocks_indirect 
diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c
index a4026ce..3f39f2a 100644
--- a/memcheck/mc_main.c
+++ b/memcheck/mc_main.c
@@ -3230,7 +3230,7 @@
    UInt otag;
    tl_assert(sizeof(UWord) == sizeof(SizeT));
    if (0)
-      VG_(printf)("helperc_MAKE_STACK_UNINIT (%p,%lu,nia=%p)\n",
+      VG_(printf)("helperc_MAKE_STACK_UNINIT (%#lx,%lu,nia=%#lx)\n",
                   base, len, nia );
 
    if (UNLIKELY( MC_(clo_mc_level) == 3 )) {
@@ -3666,7 +3666,7 @@
    // false negative, but it's a grey area -- the behaviour is defined (the
    // padding is zeroed) but it's probably not what the user intended.  And
    // we can't avoid it.
-   DEBUG("mc_new_mem_startup(%p, %llu, rr=%u, ww=%u, xx=%u)\n",
+   DEBUG("mc_new_mem_startup(%#lx, %llu, rr=%u, ww=%u, xx=%u)\n",
          a, (ULong)len, rr, ww, xx);
    MC_(make_mem_defined)(a, len);
 }
@@ -5482,11 +5482,11 @@
 static void print_SM_info(char* type, int n_SMs)
 {
    VG_(message)(Vg_DebugMsg,
-      " memcheck: SMs: %s = %d (%dk, %dM)",
+      " memcheck: SMs: %s = %d (%ldk, %ldM)",
       type,
       n_SMs,
-      n_SMs * sizeof(SecMap) / 1024,
-      n_SMs * sizeof(SecMap) / (1024 * 1024) );
+      n_SMs * sizeof(SecMap) / 1024UL,
+      n_SMs * sizeof(SecMap) / (1024 * 1024UL) );
 }
 
 static void mc_fini ( Int exitcode )
@@ -5522,7 +5522,7 @@
          " memcheck: sanity checks: %d cheap, %d expensive",
          n_sanity_cheap, n_sanity_expensive );
       VG_(message)(Vg_DebugMsg,
-         " memcheck: auxmaps: %d auxmap entries (%dk, %dM) in use",
+         " memcheck: auxmaps: %lld auxmap entries (%lldk, %lldM) in use",
          n_auxmap_L2_nodes, 
          n_auxmap_L2_nodes * 64, 
          n_auxmap_L2_nodes / 16 );
@@ -5554,7 +5554,7 @@
       max_shmem_szB   = sizeof(primary_map) + max_SMs_szB + max_secVBit_szB;
 
       VG_(message)(Vg_DebugMsg,
-         " memcheck: max sec V bit nodes:    %d (%dk, %dM)",
+         " memcheck: max sec V bit nodes:    %d (%ldk, %ldM)",
          max_secVBit_nodes, max_secVBit_szB / 1024,
                             max_secVBit_szB / (1024 * 1024));
       VG_(message)(Vg_DebugMsg,
@@ -5562,39 +5562,39 @@
          sec_vbits_new_nodes + sec_vbits_updates,
          sec_vbits_new_nodes, sec_vbits_updates );
       VG_(message)(Vg_DebugMsg,
-         " memcheck: max shadow mem size:   %dk, %dM",
+         " memcheck: max shadow mem size:   %ldk, %ldM",
          max_shmem_szB / 1024, max_shmem_szB / (1024 * 1024));
 
       if (MC_(clo_mc_level) >= 3) {
          VG_(message)(Vg_DebugMsg,
-                      " ocacheL1: %,12lu refs   %,12lu misses (%,lu lossage)", 
+                      " ocacheL1: %'12lu refs   %'12lu misses (%'lu lossage)",
                       stats_ocacheL1_find, 
                       stats_ocacheL1_misses,
                       stats_ocacheL1_lossage );
          VG_(message)(Vg_DebugMsg,
-                      " ocacheL1: %,12lu at 0   %,12lu at 1", 
+                      " ocacheL1: %'12lu at 0   %'12lu at 1",
                       stats_ocacheL1_find - stats_ocacheL1_misses 
                          - stats_ocacheL1_found_at_1 
                          - stats_ocacheL1_found_at_N,
                       stats_ocacheL1_found_at_1 );
          VG_(message)(Vg_DebugMsg,
-                      " ocacheL1: %,12lu at 2+  %,12lu move-fwds", 
+                      " ocacheL1: %'12lu at 2+  %'12lu move-fwds",
                       stats_ocacheL1_found_at_N,
                       stats_ocacheL1_movefwds );
          VG_(message)(Vg_DebugMsg,
-                      " ocacheL1: %,12lu sizeB  %,12lu useful",
+                      " ocacheL1: %'12lu sizeB  %'12u useful",
                       (UWord)sizeof(OCache),
                       4 * OC_W32S_PER_LINE * OC_LINES_PER_SET * OC_N_SETS );
          VG_(message)(Vg_DebugMsg,
-                      " ocacheL2: %,12lu refs   %,12lu misses", 
+                      " ocacheL2: %'12lu refs   %'12lu misses",
                       stats__ocacheL2_refs, 
                       stats__ocacheL2_misses );
          VG_(message)(Vg_DebugMsg,
-                      " ocacheL2:    %,9lu max nodes %,9lu curr nodes",
+                      " ocacheL2:    %'9lu max nodes %'9lu curr nodes",
                       stats__ocacheL2_n_nodes_max,
                       stats__ocacheL2_n_nodes );
          VG_(message)(Vg_DebugMsg,
-                      " niacache: %,12lu refs   %,12lu misses",
+                      " niacache: %'12lu refs   %'12lu misses",
                       stats__nia_cache_queries, stats__nia_cache_misses);
       } else {
          tl_assert(ocacheL1 == NULL);
diff --git a/memcheck/mc_malloc_wrappers.c b/memcheck/mc_malloc_wrappers.c
index e3287a8..8ccbbc3 100644
--- a/memcheck/mc_malloc_wrappers.c
+++ b/memcheck/mc_malloc_wrappers.c
@@ -461,7 +461,7 @@
    MC_Mempool* mp;
 
    if (VG_(clo_verbosity) > 2) {
-      VG_(message)(Vg_UserMsg, "create_mempool(%p, %d, %d)", 
+      VG_(message)(Vg_UserMsg, "create_mempool(0x%lx, %d, %d)",
                                pool, rzB, is_zeroed);
       VG_(get_and_pp_StackTrace)
          (VG_(get_running_tid)(), MEMPOOL_DEBUG_STACKTRACE_DEPTH);
@@ -496,7 +496,7 @@
    MC_Mempool* mp;
 
    if (VG_(clo_verbosity) > 2) {
-      VG_(message)(Vg_UserMsg, "destroy_mempool(%p)", pool);
+      VG_(message)(Vg_UserMsg, "destroy_mempool(0x%lx)", pool);
       VG_(get_and_pp_StackTrace)
          (VG_(get_running_tid)(), MEMPOOL_DEBUG_STACKTRACE_DEPTH);
    }
@@ -594,10 +594,10 @@
                       n_chunks);
          for (i = 0; i < n_chunks; ++i) {
             VG_(message)(Vg_UserMsg, 
-                         "Mempool chunk %d / %d: %d bytes [%x,%x), allocated:",
+                         "Mempool chunk %d / %d: %ld bytes [%lx,%lx), allocated:",
                          i+1, 
                          n_chunks, 
-                         chunks[i]->szB, 
+                         chunks[i]->szB + 0UL,
                          chunks[i]->data, 
                          chunks[i]->data + chunks[i]->szB);
 
@@ -612,7 +612,7 @@
    MC_Mempool* mp;
 
    if (VG_(clo_verbosity) > 2) {     
-      VG_(message)(Vg_UserMsg, "mempool_alloc(%p, %p, %d)", pool, addr, szB);
+      VG_(message)(Vg_UserMsg, "mempool_alloc(0x%lx, 0x%lx, %ld)", pool, addr, szB);
       VG_(get_and_pp_StackTrace) (tid, MEMPOOL_DEBUG_STACKTRACE_DEPTH);
    }
 
@@ -640,7 +640,7 @@
    }
 
    if (VG_(clo_verbosity) > 2) {
-      VG_(message)(Vg_UserMsg, "mempool_free(%p, %p)", pool, addr);
+      VG_(message)(Vg_UserMsg, "mempool_free(0x%lx, 0x%lx)", pool, addr);
       VG_(get_and_pp_StackTrace) (tid, MEMPOOL_DEBUG_STACKTRACE_DEPTH);
    }
 
@@ -653,8 +653,8 @@
 
    if (VG_(clo_verbosity) > 2) {
       VG_(message)(Vg_UserMsg, 
-		   "mempool_free(%p, %p) freed chunk of %d bytes", 
-		   pool, addr, mc->szB);
+		   "mempool_free(0x%lx, 0x%lx) freed chunk of %ld bytes",
+		   pool, addr, mc->szB + 0UL);
    }
 
    die_and_free_mem ( tid, mc, mp->rzB );
@@ -671,7 +671,7 @@
    VgHashNode** chunks;
 
    if (VG_(clo_verbosity) > 2) {
-      VG_(message)(Vg_UserMsg, "mempool_trim(%p, %p, %d)", pool, addr, szB);
+      VG_(message)(Vg_UserMsg, "mempool_trim(0x%lx, 0x%lx, %ld)", pool, addr, szB);
       VG_(get_and_pp_StackTrace) (tid, MEMPOOL_DEBUG_STACKTRACE_DEPTH);
    }
 
@@ -780,7 +780,7 @@
    MC_Mempool* mp;
 
    if (VG_(clo_verbosity) > 2) {
-      VG_(message)(Vg_UserMsg, "move_mempool(%p, %p)", poolA, poolB);
+      VG_(message)(Vg_UserMsg, "move_mempool(0x%lx, 0x%lx)", poolA, poolB);
       VG_(get_and_pp_StackTrace)
          (VG_(get_running_tid)(), MEMPOOL_DEBUG_STACKTRACE_DEPTH);
    }
@@ -804,7 +804,7 @@
    ThreadId     tid = VG_(get_running_tid)();
 
    if (VG_(clo_verbosity) > 2) {
-      VG_(message)(Vg_UserMsg, "mempool_change(%p, %p, %p, %d)", 
+      VG_(message)(Vg_UserMsg, "mempool_change(0x%lx, 0x%lx, 0x%lx, %ld)",
                    pool, addrA, addrB, szB);
       VG_(get_and_pp_StackTrace) (tid, MEMPOOL_DEBUG_STACKTRACE_DEPTH);
    }
@@ -865,10 +865,10 @@
    }
 
    VG_(message)(Vg_UserMsg, 
-                "malloc/free: in use at exit: %,llu bytes in %,lu blocks.",
+                "malloc/free: in use at exit: %'llu bytes in %'lu blocks.",
                 nbytes, nblocks);
    VG_(message)(Vg_UserMsg, 
-                "malloc/free: %,lu allocs, %,lu frees, %,llu bytes allocated.",
+                "malloc/free: %'lu allocs, %'lu frees, %'llu bytes allocated.",
                 cmalloc_n_mallocs,
                 cmalloc_n_frees, cmalloc_bs_mallocd);
    if (VG_(clo_verbosity) > 1)