aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornjn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9>2009-03-12 00:06:45 +0000
committernjn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9>2009-03-12 00:06:45 +0000
commit6f74a7ef1768dd3925cc22869b4e5e24e9338d08 (patch)
treeea3a4bf343e933133551304092350aadbda5f0d1
parent1061b67c5fa395784ddfc4fb82bf5298b13f700a (diff)
downloadvalgrind-6f74a7ef1768dd3925cc22869b4e5e24e9338d08.tar.gz
Added some shortcuts for VG_(message)(), and used them in a few places (but
certainly not all). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9367 a5019735-40e9-0310-863c-91ae7b9d1cf9
-rw-r--r--cachegrind/cg-x86.c57
-rw-r--r--cachegrind/cg_main.c150
-rw-r--r--coregrind/m_errormgr.c128
-rw-r--r--coregrind/m_libcassert.c37
-rw-r--r--include/pub_tool_libcprint.h4
-rw-r--r--lackey/lk_main.c58
-rw-r--r--massif/ms_main.c20
7 files changed, 200 insertions, 254 deletions
diff --git a/cachegrind/cg-x86.c b/cachegrind/cg-x86.c
index f9fa15ba7..be5eb82ec 100644
--- a/cachegrind/cg-x86.c
+++ b/cachegrind/cg-x86.c
@@ -42,12 +42,10 @@
static void micro_ops_warn(Int actual_size, Int used_size, Int line_size)
{
- VG_(message)(Vg_DebugMsg,
- "warning: Pentium 4 with %d KB micro-op instruction trace cache",
- actual_size);
- VG_(message)(Vg_DebugMsg,
- " Simulating a %d KB I-cache with %d B lines",
- used_size, line_size);
+ VG_DMSG("warning: Pentium 4 with %d KB micro-op instruction trace cache",
+ actual_size);
+ VG_DMSG(" Simulating a %d KB I-cache with %d B lines",
+ used_size, line_size);
}
/* Intel method is truly wretched. We have to do an insane indexing into an
@@ -67,9 +65,7 @@ Int Intel_cache_info(Int level, cache_t* I1c, cache_t* D1c, cache_t* L2c)
Bool L2_found = False;
if (level < 2) {
- VG_(message)(Vg_DebugMsg,
- "warning: CPUID level < 2 for Intel processor (%d)",
- level);
+ VG_DMSG("warning: CPUID level < 2 for Intel processor (%d)", level);
return -1;
}
@@ -85,9 +81,8 @@ Int Intel_cache_info(Int level, cache_t* I1c, cache_t* D1c, cache_t* L2c)
info[0] = 0x0; /* reset AL */
if (0 != trials) {
- VG_(message)(Vg_DebugMsg,
- "warning: non-zero CPUID trials for Intel processor (%d)",
- trials);
+ VG_DMSG("warning: non-zero CPUID trials for Intel processor (%d)",
+ trials);
return -1;
}
@@ -124,8 +119,7 @@ Int Intel_cache_info(Int level, cache_t* I1c, cache_t* D1c, cache_t* L2c)
case 0x22: case 0x23: case 0x25: case 0x29:
case 0x46: case 0x47: case 0x4a: case 0x4b: case 0x4c: case 0x4d:
- VG_(message)(Vg_DebugMsg,
- "warning: L3 cache detected but ignored");
+ VG_DMSG("warning: L3 cache detected but ignored");
break;
/* These are sectored, whatever that means */
@@ -148,8 +142,7 @@ Int Intel_cache_info(Int level, cache_t* I1c, cache_t* D1c, cache_t* L2c)
case 0x49:
if ((family == 15) && (model == 6))
/* On Xeon MP (family F, model 6), this is for L3 */
- VG_(message)(Vg_DebugMsg,
- "warning: L3 cache detected but ignored");
+ VG_DMSG("warning: L3 cache detected but ignored");
else
*L2c = (cache_t) { 4096, 16, 64 }; L2_found = True;
break;
@@ -200,19 +193,17 @@ Int Intel_cache_info(Int level, cache_t* I1c, cache_t* D1c, cache_t* L2c)
/* Ignore prefetch information */
case 0xf0: case 0xf1:
- break;
+ break;
default:
- VG_(message)(Vg_DebugMsg,
- "warning: Unknown Intel cache config value "
- "(0x%x), ignoring", info[i]);
- break;
+ VG_DMSG("warning: Unknown Intel cache config value (0x%x), ignoring",
+ info[i]);
+ break;
}
}
if (!L2_found)
- VG_(message)(Vg_DebugMsg,
- "warning: L2 cache not installed, ignore L2 results.");
+ VG_DMSG("warning: L2 cache not installed, ignore L2 results.");
return 0;
}
@@ -251,9 +242,8 @@ Int AMD_cache_info(cache_t* I1c, cache_t* D1c, cache_t* L2c)
VG_(cpuid)(0x80000000, &ext_level, &dummy, &dummy, &dummy);
if (0 == (ext_level & 0x80000000) || ext_level < 0x80000006) {
- VG_(message)(Vg_UserMsg,
- "warning: ext_level < 0x80000006 for AMD processor (0x%x)",
- ext_level);
+ VG_DMSG("warning: ext_level < 0x80000006 for AMD processor (0x%x)",
+ ext_level);
return -1;
}
@@ -264,8 +254,7 @@ Int AMD_cache_info(cache_t* I1c, cache_t* D1c, cache_t* L2c)
/* Check for Duron bug */
if (model == 0x630) {
- VG_(message)(Vg_UserMsg,
- "Buggy Duron stepping A0. Assuming L2 size=65536 bytes");
+ VG_DMSG("warning: Buggy Duron stepping A0. Assuming L2 size=65536 bytes");
L2i = (64 << 16) | (L2i & 0xffff);
}
@@ -291,7 +280,7 @@ Int get_caches_from_CPUID(cache_t* I1c, cache_t* D1c, cache_t* L2c)
Char vendor_id[13];
if (!VG_(has_cpuid)()) {
- VG_(message)(Vg_DebugMsg, "CPUID instruction not supported");
+ VG_DMSG("CPUID instruction not supported");
return -1;
}
@@ -300,7 +289,7 @@ Int get_caches_from_CPUID(cache_t* I1c, cache_t* D1c, cache_t* L2c)
vendor_id[12] = '\0';
if (0 == level) {
- VG_(message)(Vg_DebugMsg, "CPUID level is 0, early Pentium?");
+ VG_DMSG("CPUID level is 0, early Pentium?");
return -1;
}
@@ -325,8 +314,7 @@ Int get_caches_from_CPUID(cache_t* I1c, cache_t* D1c, cache_t* L2c)
ret = 0;
} else {
- VG_(message)(Vg_DebugMsg, "CPU vendor ID not recognised (%s)",
- vendor_id);
+ VG_DMSG("CPU vendor ID not recognised (%s)", vendor_id);
return -1;
}
@@ -354,9 +342,8 @@ void VG_(configure_caches)(cache_t* I1c, cache_t* D1c, cache_t* L2c,
// Warn if CPUID failed and config not completely specified from cmd line.
if (res != 0 && !all_caches_clo_defined) {
- VG_(message)(Vg_DebugMsg,
- "Warning: Couldn't auto-detect cache config, using one "
- "or more defaults ");
+ VG_DMSG("Warning: Couldn't auto-detect cache config, using one "
+ "or more defaults ");
}
}
diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c
index ec21b4969..cfaf53aef 100644
--- a/cachegrind/cg_main.c
+++ b/cachegrind/cg_main.c
@@ -1161,16 +1161,13 @@ void check_cache(cache_t* cache, Char *name)
/* Simulator requires line size and set count to be powers of two */
if (( cache->size % (cache->line_size * cache->assoc) != 0) ||
(-1 == VG_(log2)(cache->size/cache->line_size/cache->assoc))) {
- VG_(message)(Vg_UserMsg,
- "error: %s set count not a power of two; aborting.",
- name);
+ VG_UMSG("error: %s set count not a power of two; aborting.", name);
VG_(exit)(1);
}
if (-1 == VG_(log2)(cache->line_size)) {
- VG_(message)(Vg_UserMsg,
- "error: %s line size of %dB not a power of two; aborting.",
- name, cache->line_size);
+ VG_UMSG("error: %s line size of %dB not a power of two; aborting.",
+ name, cache->line_size);
VG_(exit)(1);
}
@@ -1178,24 +1175,22 @@ void check_cache(cache_t* cache, Char *name)
// straddle three cache lines, which breaks a simulation assertion and is
// stupid anyway.
if (cache->line_size < MIN_LINE_SIZE) {
- VG_(message)(Vg_UserMsg,
- "error: %s line size of %dB too small; aborting.",
- name, cache->line_size);
+ VG_UMSG("error: %s line size of %dB too small; aborting.",
+ name, cache->line_size);
VG_(exit)(1);
}
/* Then check cache size > line size (causes seg faults if not). */
if (cache->size <= cache->line_size) {
- VG_(message)(Vg_UserMsg,
- "error: %s cache size of %dB <= line size of %dB; aborting.",
- name, cache->size, cache->line_size);
+ VG_UMSG("error: %s cache size of %dB <= line size of %dB; aborting.",
+ name, cache->size, cache->line_size);
VG_(exit)(1);
}
/* Then check assoc <= (size / line size) (seg faults otherwise). */
if (cache->assoc > (cache->size / cache->line_size)) {
- VG_(message)(Vg_UserMsg,
- "warning: %s associativity > (size / line size); aborting.", name);
+ VG_UMSG("warning: %s associativity > (size / line size); aborting.",
+ name);
VG_(exit)(1);
}
}
@@ -1226,14 +1221,14 @@ void configure_caches(cache_t* I1c, cache_t* D1c, cache_t* L2c)
check_cache(D1c, "D1");
check_cache(L2c, "L2");
- if (VG_(clo_verbosity) > 1) {
- VG_(message)(Vg_UserMsg, "Cache configuration used:");
- VG_(message)(Vg_UserMsg, " I1: %dB, %d-way, %dB lines",
- I1c->size, I1c->assoc, I1c->line_size);
- VG_(message)(Vg_UserMsg, " D1: %dB, %d-way, %dB lines",
- D1c->size, D1c->assoc, D1c->line_size);
- VG_(message)(Vg_UserMsg, " L2: %dB, %d-way, %dB lines",
- L2c->size, L2c->assoc, L2c->line_size);
+ if (VG_(clo_verbosity) >= 2) {
+ VG_UMSG("Cache configuration used:");
+ VG_UMSG(" I1: %dB, %d-way, %dB lines",
+ I1c->size, I1c->assoc, I1c->line_size);
+ VG_UMSG(" D1: %dB, %d-way, %dB lines",
+ D1c->size, D1c->assoc, D1c->line_size);
+ VG_UMSG(" L2: %dB, %d-way, %dB lines",
+ L2c->size, L2c->assoc, L2c->line_size);
}
#undef CMD_LINE_DEFINED
}
@@ -1270,11 +1265,9 @@ static void fprint_CC_table_and_calc_totals(void)
if (sres.isError) {
// If the file can't be opened for whatever reason (conflict
// between multiple cachegrinded processes?), give up now.
- VG_(message)(Vg_UserMsg,
- "error: can't open cache simulation output file '%s'",
- cachegrind_out_file );
- VG_(message)(Vg_UserMsg,
- " ... so simulation results will be missing.");
+ VG_UMSG("error: can't open cache simulation output file '%s'",
+ cachegrind_out_file );
+ VG_UMSG(" ... so simulation results will be missing.");
VG_(free)(cachegrind_out_file);
return;
} else {
@@ -1484,23 +1477,23 @@ static void cg_fini(Int exitcode)
VG_(sprintf)(fmt, "%%s %%,%dllu", l1);
/* Always print this */
- VG_(message)(Vg_UserMsg, fmt, "I refs: ", Ir_total.a);
+ VG_UMSG(fmt, "I refs: ", Ir_total.a);
/* If cache profiling is enabled, show D access numbers and all
miss numbers */
if (clo_cache_sim) {
- VG_(message)(Vg_UserMsg, fmt, "I1 misses: ", Ir_total.m1);
- VG_(message)(Vg_UserMsg, fmt, "L2i misses: ", Ir_total.m2);
+ VG_UMSG(fmt, "I1 misses: ", Ir_total.m1);
+ VG_UMSG(fmt, "L2i misses: ", Ir_total.m2);
p = 100;
if (0 == Ir_total.a) Ir_total.a = 1;
VG_(percentify)(Ir_total.m1, Ir_total.a, 2, l1+1, buf1);
- VG_(message)(Vg_UserMsg, "I1 miss rate: %s", buf1);
+ VG_UMSG("I1 miss rate: %s", buf1);
VG_(percentify)(Ir_total.m2, Ir_total.a, 2, l1+1, buf1);
- VG_(message)(Vg_UserMsg, "L2i miss rate: %s", buf1);
- VG_(message)(Vg_UserMsg, "");
+ VG_UMSG("L2i miss rate: %s", buf1);
+ VG_UMSG("");
/* D cache results. Use the D_refs.rd and D_refs.wr values to
* determine the width of columns 2 & 3. */
@@ -1511,12 +1504,12 @@ static void cg_fini(Int exitcode)
/* Make format string, getting width right for numbers */
VG_(sprintf)(fmt, "%%s %%,%dllu (%%,%dllu rd + %%,%dllu wr)", l1, l2, l3);
- VG_(message)(Vg_UserMsg, fmt, "D refs: ",
- D_total.a, Dr_total.a, Dw_total.a);
- VG_(message)(Vg_UserMsg, fmt, "D1 misses: ",
- D_total.m1, Dr_total.m1, Dw_total.m1);
- VG_(message)(Vg_UserMsg, fmt, "L2d misses: ",
- D_total.m2, Dr_total.m2, Dw_total.m2);
+ VG_UMSG(fmt, "D refs: ",
+ D_total.a, Dr_total.a, Dw_total.a);
+ VG_UMSG(fmt, "D1 misses: ",
+ D_total.m1, Dr_total.m1, Dw_total.m1);
+ VG_UMSG(fmt, "L2d misses: ",
+ D_total.m2, Dr_total.m2, Dw_total.m2);
p = 10;
@@ -1526,32 +1519,32 @@ static void cg_fini(Int exitcode)
VG_(percentify)( D_total.m1, D_total.a, 1, l1+1, buf1);
VG_(percentify)(Dr_total.m1, Dr_total.a, 1, l2+1, buf2);
VG_(percentify)(Dw_total.m1, Dw_total.a, 1, l3+1, buf3);
- VG_(message)(Vg_UserMsg, "D1 miss rate: %s (%s + %s )", buf1, buf2,buf3);
+ VG_UMSG("D1 miss rate: %s (%s + %s )", buf1, buf2,buf3);
VG_(percentify)( D_total.m2, D_total.a, 1, l1+1, buf1);
VG_(percentify)(Dr_total.m2, Dr_total.a, 1, l2+1, buf2);
VG_(percentify)(Dw_total.m2, Dw_total.a, 1, l3+1, buf3);
- VG_(message)(Vg_UserMsg, "L2d miss rate: %s (%s + %s )", buf1, buf2,buf3);
- VG_(message)(Vg_UserMsg, "");
+ VG_UMSG("L2d miss rate: %s (%s + %s )", buf1, buf2,buf3);
+ VG_UMSG("");
/* L2 overall results */
L2_total = Dr_total.m1 + Dw_total.m1 + Ir_total.m1;
L2_total_r = Dr_total.m1 + Ir_total.m1;
L2_total_w = Dw_total.m1;
- VG_(message)(Vg_UserMsg, fmt, "L2 refs: ",
- L2_total, L2_total_r, L2_total_w);
+ VG_UMSG(fmt, "L2 refs: ",
+ L2_total, L2_total_r, L2_total_w);
L2_total_m = Dr_total.m2 + Dw_total.m2 + Ir_total.m2;
L2_total_mr = Dr_total.m2 + Ir_total.m2;
L2_total_mw = Dw_total.m2;
- VG_(message)(Vg_UserMsg, fmt, "L2 misses: ",
- L2_total_m, L2_total_mr, L2_total_mw);
+ VG_UMSG(fmt, "L2 misses: ",
+ L2_total_m, L2_total_mr, L2_total_mw);
VG_(percentify)(L2_total_m, (Ir_total.a + D_total.a), 1, l1+1, buf1);
VG_(percentify)(L2_total_mr, (Ir_total.a + Dr_total.a), 1, l2+1, buf2);
VG_(percentify)(L2_total_mw, Dw_total.a, 1, l3+1, buf3);
- VG_(message)(Vg_UserMsg, "L2 miss rate: %s (%s + %s )", buf1, buf2,buf3);
+ VG_UMSG("L2 miss rate: %s (%s + %s )", buf1, buf2,buf3);
}
/* If branch profiling is enabled, show branch overall results. */
@@ -1564,18 +1557,18 @@ static void cg_fini(Int exitcode)
B_total.b = Bc_total.b + Bi_total.b;
B_total.mp = Bc_total.mp + Bi_total.mp;
- VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg, fmt, "Branches: ",
- B_total.b, Bc_total.b, Bi_total.b);
+ VG_UMSG("");
+ VG_UMSG(fmt, "Branches: ",
+ B_total.b, Bc_total.b, Bi_total.b);
- VG_(message)(Vg_UserMsg, fmt, "Mispredicts: ",
- B_total.mp, Bc_total.mp, Bi_total.mp);
+ VG_UMSG(fmt, "Mispredicts: ",
+ B_total.mp, Bc_total.mp, Bi_total.mp);
VG_(percentify)(B_total.mp, B_total.b, 1, l1+1, buf1);
VG_(percentify)(Bc_total.mp, Bc_total.b, 1, l2+1, buf2);
VG_(percentify)(Bi_total.mp, Bi_total.b, 1, l3+1, buf3);
- VG_(message)(Vg_UserMsg, "Mispred rate: %s (%s + %s )", buf1, buf2,buf3);
+ VG_UMSG("Mispred rate: %s (%s + %s )", buf1, buf2,buf3);
}
// Various stats
@@ -1583,32 +1576,32 @@ static void cg_fini(Int exitcode)
Int debug_lookups = full_debugs + fn_debugs +
file_line_debugs + no_debugs;
- VG_(message)(Vg_DebugMsg, "");
- VG_(message)(Vg_DebugMsg, "cachegrind: distinct files: %d", distinct_files);
- VG_(message)(Vg_DebugMsg, "cachegrind: distinct fns: %d", distinct_fns);
- VG_(message)(Vg_DebugMsg, "cachegrind: distinct lines: %d", distinct_lines);
- VG_(message)(Vg_DebugMsg, "cachegrind: distinct instrs:%d", distinct_instrs);
- VG_(message)(Vg_DebugMsg, "cachegrind: debug lookups : %d", debug_lookups);
+ VG_DMSG("");
+ VG_DMSG("cachegrind: distinct files: %d", distinct_files);
+ VG_DMSG("cachegrind: distinct fns: %d", distinct_fns);
+ VG_DMSG("cachegrind: distinct lines: %d", distinct_lines);
+ VG_DMSG("cachegrind: distinct instrs:%d", distinct_instrs);
+ VG_DMSG("cachegrind: debug lookups : %d", debug_lookups);
VG_(percentify)(full_debugs, debug_lookups, 1, 6, buf1);
VG_(percentify)(file_line_debugs, debug_lookups, 1, 6, buf2);
VG_(percentify)(fn_debugs, debug_lookups, 1, 6, buf3);
VG_(percentify)(no_debugs, debug_lookups, 1, 6, buf4);
- VG_(message)(Vg_DebugMsg, "cachegrind: with full info:%s (%d)",
- buf1, full_debugs);
- VG_(message)(Vg_DebugMsg, "cachegrind: with file/line info:%s (%d)",
- buf2, file_line_debugs);
- VG_(message)(Vg_DebugMsg, "cachegrind: with fn name info:%s (%d)",
- buf3, fn_debugs);
- VG_(message)(Vg_DebugMsg, "cachegrind: with zero info:%s (%d)",
- buf4, no_debugs);
-
- VG_(message)(Vg_DebugMsg, "cachegrind: string table size: %lu",
- VG_(OSetGen_Size)(stringTable));
- VG_(message)(Vg_DebugMsg, "cachegrind: CC table size: %lu",
- VG_(OSetGen_Size)(CC_table));
- VG_(message)(Vg_DebugMsg, "cachegrind: InstrInfo table size: %lu",
- VG_(OSetGen_Size)(instrInfoTable));
+ VG_DMSG("cachegrind: with full info:%s (%d)",
+ buf1, full_debugs);
+ VG_DMSG("cachegrind: with file/line info:%s (%d)",
+ buf2, file_line_debugs);
+ VG_DMSG("cachegrind: with fn name info:%s (%d)",
+ buf3, fn_debugs);
+ VG_DMSG("cachegrind: with zero info:%s (%d)",
+ buf4, no_debugs);
+
+ VG_DMSG("cachegrind: string table size: %lu",
+ VG_(OSetGen_Size)(stringTable));
+ VG_DMSG("cachegrind: CC table size: %lu",
+ VG_(OSetGen_Size)(CC_table));
+ VG_DMSG("cachegrind: InstrInfo table size: %lu",
+ VG_(OSetGen_Size)(instrInfoTable));
}
}
@@ -1664,8 +1657,7 @@ static void parse_cache_opt ( cache_t* cache, Char* opt )
return;
overflow:
- VG_(message)(Vg_UserMsg,
- "one of the cache parameters was too large and overflowed\n");
+ VG_UMSG("one of the cache parameters was too large and overflowed\n");
bad:
// XXX: this omits the "--I1/D1/L2=" part from the message, but that's
// not a big deal.
@@ -1744,10 +1736,8 @@ static void cg_post_clo_init(void)
/* Can't disable both cache and branch profiling */
if ((!clo_cache_sim) && (!clo_branch_sim)) {
- VG_(message)(Vg_DebugMsg,
- "ERROR: --cache-sim=no --branch-sim=no is not allowed.");
- VG_(message)(Vg_DebugMsg,
- "You must select cache profiling, or branch profiling, or both.");
+ VG_UMSG("ERROR: --cache-sim=no --branch-sim=no is not allowed.");
+ VG_UMSG("You must select cache profiling, or branch profiling, or both.");
VG_(exit)(2);
}
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c
index 047c7f36b..ec45800ee 100644
--- a/coregrind/m_errormgr.c
+++ b/coregrind/m_errormgr.c
@@ -289,16 +289,15 @@ static Bool eq_Error ( VgRes res, Error* e1, Error* e2 )
static void pp_Error ( Error* err )
{
if (VG_(clo_xml)) {
- VG_(message)(Vg_UserMsg, "<error>");
- VG_(message)(Vg_UserMsg, " <unique>0x%x</unique>",
- err->unique);
- VG_(message)(Vg_UserMsg, " <tid>%d</tid>", err->tid);
+ VG_UMSG("<error>");
+ VG_UMSG(" <unique>0x%x</unique>", err->unique);
+ VG_UMSG(" <tid>%d</tid>", err->tid);
}
if (!VG_(clo_xml)) {
if (VG_(tdict).tool_show_ThreadIDs_for_errors
&& err->tid > 0 && err->tid != last_tid_printed) {
- VG_(message)(Vg_UserMsg, "Thread %d:", err->tid );
+ VG_UMSG("Thread %d:", err->tid );
last_tid_printed = err->tid;
}
}
@@ -321,7 +320,7 @@ static void pp_Error ( Error* err )
}
if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, "</error>");
+ VG_UMSG("</error>");
}
/* Figure out if we want to perform a given action for this error, possibly
@@ -334,7 +333,7 @@ Bool VG_(is_action_requested) ( Char* action, Bool* clo )
if (*clo == False)
return False;
- VG_(message)(Vg_UserMsg, "");
+ VG_UMSG("");
again:
VG_(printf)(
@@ -432,9 +431,8 @@ static void gen_suppression(Error* err)
} else {
Char* name = VG_TDICT_CALL(tool_get_error_name, err);
if (NULL == name) {
- VG_(message)(Vg_UserMsg,
- "(%s does not allow error to be suppressed)",
- VG_(details).name);
+ VG_UMSG("(%s does not allow error to be suppressed)",
+ VG_(details).name);
return;
}
VG_(printf)("{\n");
@@ -504,29 +502,25 @@ void VG_(maybe_record_error) ( ThreadId tid,
|| n_errs_found >= M_COLLECT_NO_ERRORS_AFTER_FOUND)
&& !VG_(clo_xml)) {
if (!stopping_message) {
- VG_(message)(Vg_UserMsg, "");
+ VG_UMSG("");
if (n_errs_shown >= M_COLLECT_NO_ERRORS_AFTER_SHOWN) {
- VG_(message)(Vg_UserMsg,
+ VG_UMSG(
"More than %d different errors detected. "
"I'm not reporting any more.",
M_COLLECT_NO_ERRORS_AFTER_SHOWN );
} else {
- VG_(message)(Vg_UserMsg,
+ VG_UMSG(
"More than %d total errors detected. "
"I'm not reporting any more.",
M_COLLECT_NO_ERRORS_AFTER_FOUND );
}
- VG_(message)(Vg_UserMsg,
- "Final error counts will be inaccurate. Go fix your program!");
- VG_(message)(Vg_UserMsg,
- "Rerun with --error-limit=no to disable this cutoff. Note");
- VG_(message)(Vg_UserMsg,
- "that errors may occur in your program without prior warning from");
- VG_(message)(Vg_UserMsg,
- "Valgrind, because errors are no longer being displayed.");
- VG_(message)(Vg_UserMsg, "");
+ VG_UMSG("Final error counts will be inaccurate. Go fix your program!");
+ VG_UMSG("Rerun with --error-limit=no to disable this cutoff. Note");
+ VG_UMSG("that errors may occur in your program without prior warning from");
+ VG_UMSG("Valgrind, because errors are no longer being displayed.");
+ VG_UMSG("");
stopping_message = True;
}
return;
@@ -539,12 +533,10 @@ void VG_(maybe_record_error) ( ThreadId tid,
&& !VG_(clo_xml)) {
exe_res = Vg_LowRes;
if (!slowdown_message) {
- VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg,
- "More than %d errors detected. Subsequent errors",
- M_COLLECT_ERRORS_SLOWLY_AFTER);
- VG_(message)(Vg_UserMsg,
- "will still be recorded, but in less detail than before.");
+ VG_UMSG("");
+ VG_UMSG("More than %d errors detected. Subsequent errors",
+ M_COLLECT_ERRORS_SLOWLY_AFTER);
+ VG_UMSG("will still be recorded, but in less detail than before.");
slowdown_message = True;
}
}
@@ -631,7 +623,7 @@ void VG_(maybe_record_error) ( ThreadId tid,
if (p->supp == NULL) {
n_errs_found++;
if (!is_first_shown_context)
- VG_(message)(Vg_UserMsg, "");
+ VG_UMSG("");
pp_Error(p);
is_first_shown_context = False;
n_errs_shown++;
@@ -675,7 +667,7 @@ Bool VG_(unique_error) ( ThreadId tid, ErrorKind ekind, Addr a, Char* s,
if (print_error) {
if (!is_first_shown_context)
- VG_(message)(Vg_UserMsg, "");
+ VG_UMSG("");
pp_Error(&err);
is_first_shown_context = False;
n_errs_shown++;
@@ -703,7 +695,7 @@ static Bool show_used_suppressions ( void )
Bool any_supp;
if (VG_(clo_xml))
- VG_(message)(Vg_DebugMsg, "<suppcounts>");
+ VG_UMSG("<suppcounts>");
any_supp = False;
for (su = suppressions; su != NULL; su = su->next) {
@@ -718,12 +710,12 @@ static Bool show_used_suppressions ( void )
" </pair>",
su->count, su->sname);
} else {
- VG_(message)(Vg_DebugMsg, "supp: %6d %s", su->count, su->sname);
+ VG_DMSG("supp: %6d %s", su->count, su->sname);
}
}
if (VG_(clo_xml))
- VG_(message)(Vg_DebugMsg, "</suppcounts>");
+ VG_UMSG("</suppcounts>");
return any_supp;
}
@@ -762,11 +754,10 @@ void VG_(show_all_errors) ( void )
}
/* We only get here if not printing XML. */
- VG_(message)(Vg_UserMsg,
- "ERROR SUMMARY: "
- "%d errors from %d contexts (suppressed: %d from %d)",
- n_errs_found, n_err_contexts,
- n_errs_suppressed, n_supp_contexts );
+ VG_UMSG("ERROR SUMMARY: "
+ "%d errors from %d contexts (suppressed: %d from %d)",
+ n_errs_found, n_err_contexts,
+ n_errs_suppressed, n_supp_contexts );
if (VG_(clo_verbosity) <= 1)
return;
@@ -784,10 +775,9 @@ void VG_(show_all_errors) ( void )
}
if (p_min == NULL) VG_(tool_panic)("show_all_errors()");
- VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg, "%d errors in context %d of %d:",
- p_min->count,
- i+1, n_err_contexts);
+ VG_UMSG("");
+ VG_UMSG("%d errors in context %d of %d:",
+ p_min->count, i+1, n_err_contexts);
pp_Error( p_min );
if ((i+1 == VG_(clo_dump_error))) {
@@ -802,18 +792,17 @@ void VG_(show_all_errors) ( void )
}
if (n_supp_contexts > 0)
- VG_(message)(Vg_DebugMsg, "");
+ VG_UMSG( "");
any_supp = show_used_suppressions();
if (n_err_contexts > 0) {
if (any_supp)
- VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg,
- "IN SUMMARY: "
- "%d errors from %d contexts (suppressed: %d from %d)",
- n_errs_found, n_err_contexts, n_errs_suppressed,
- n_supp_contexts );
- VG_(message)(Vg_UserMsg, "");
+ VG_UMSG("");
+ VG_UMSG("IN SUMMARY: "
+ "%d errors from %d contexts (suppressed: %d from %d)",
+ n_errs_found, n_err_contexts, n_errs_suppressed,
+ n_supp_contexts );
+ VG_UMSG("");
}
}
@@ -822,21 +811,18 @@ void VG_(show_all_errors) ( void )
void VG_(show_error_counts_as_XML) ( void )
{
Error* err;
- VG_(message)(Vg_UserMsg, "<errorcounts>");
+ VG_UMSG("<errorcounts>");
for (err = errors; err != NULL; err = err->next) {
if (err->supp != NULL)
continue;
if (err->count <= 0)
continue;
- VG_(message)(
- Vg_UserMsg, " <pair>\n"
- " <count>%d</count>\n"
- " <unique>0x%x</unique>\n"
- " </pair>",
- err->count, err->unique
- );
+ VG_UMSG(" <pair>");
+ VG_UMSG(" <count>%d</count>", err->count);
+ VG_UMSG(" <unique>0x%x</unique>", err->unique);
+ VG_UMSG(" </pair>");
}
- VG_(message)(Vg_UserMsg, "</errorcounts>");
+ VG_UMSG("</errorcounts>");
}
@@ -974,9 +960,8 @@ static void load_one_suppressions_file ( Char* filename )
sres = VG_(open)( filename, VKI_O_RDONLY, 0 );
if (sres.isError) {
if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, "</valgrindoutput>\n");
- VG_(message)(Vg_UserMsg, "FATAL: can't open suppressions file \"%s\"",
- filename );
+ VG_UMSG("</valgrindoutput>\n");
+ VG_UMSG("FATAL: can't open suppressions file \"%s\"", filename );
VG_(exit)(1);
}
fd = sres.res;
@@ -1132,15 +1117,13 @@ static void load_one_suppressions_file ( Char* filename )
syntax_error:
if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, "</valgrindoutput>\n");
- VG_(message)(Vg_UserMsg,
- "FATAL: in suppressions file \"%s\" near line %d:",
- filename, lineno );
- VG_(message)(Vg_UserMsg,
- " %s", err_str );
+ VG_UMSG("</valgrindoutput>\n");
+ VG_UMSG("FATAL: in suppressions file \"%s\" near line %d:",
+ filename, lineno );
+ VG_UMSG(" %s", err_str );
VG_(close)(fd);
- VG_(message)(Vg_UserMsg, "exiting now.");
+ VG_UMSG("exiting now.");
VG_(exit)(1);
# undef BOMB
@@ -1154,8 +1137,7 @@ void VG_(load_suppressions) ( void )
suppressions = NULL;
for (i = 0; i < VG_(clo_n_suppressions); i++) {
if (VG_(clo_verbosity) > 1) {
- VG_(message)(Vg_DebugMsg, "Reading suppressions file: %s",
- VG_(clo_suppressions)[i] );
+ VG_DMSG("Reading suppressions file: %s", VG_(clo_suppressions)[i] );
}
load_one_suppressions_file( VG_(clo_suppressions)[i] );
}
@@ -1313,11 +1295,11 @@ static Supp* is_suppressible_error ( Error* err )
*/
void VG_(print_errormgr_stats) ( void )
{
- VG_(message)(Vg_DebugMsg,
+ VG_DMSG(
" errormgr: %'lu supplist searches, %'lu comparisons during search",
em_supplist_searches, em_supplist_cmps
);
- VG_(message)(Vg_DebugMsg,
+ VG_DMSG(
" errormgr: %'lu errlist searches, %'lu comparisons during search",
em_errlist_searches, em_errlist_cmps
);
diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c
index 13ad4ba8d..fe4b3bf0e 100644
--- a/coregrind/m_libcassert.c
+++ b/coregrind/m_libcassert.c
@@ -189,7 +189,7 @@ void VG_(assert_fail) ( Bool isCore, const Char* expr, const Char* file,
}
if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, "</valgrindoutput>\n");
+ VG_UMSG("</valgrindoutput>\n");
// Treat vg_assert2(0, "foo") specially, as a panicky abort
if (VG_STREQ(expr, "0")) {
@@ -210,7 +210,7 @@ static void panic ( Char* name, Char* report, Char* str,
Addr ip, Addr sp, Addr fp, Addr lr )
{
if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, "</valgrindoutput>\n");
+ VG_UMSG("</valgrindoutput>\n");
VG_(printf)("\n%s: the 'impossible' happened:\n %s\n", name, str);
report_and_quit(report, ip, sp, fp, lr);
}
@@ -234,27 +234,18 @@ void VG_(tool_panic) ( Char* str )
void VG_(unimplemented) ( Char* msg )
{
if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, "</valgrindoutput>\n");
- VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg,
- "Valgrind detected that your program requires");
- VG_(message)(Vg_UserMsg,
- "the following unimplemented functionality:");
- VG_(message)(Vg_UserMsg, " %s", msg);
- VG_(message)(Vg_UserMsg,
- "This may be because the functionality is hard to implement,");
- VG_(message)(Vg_UserMsg,
- "or because no reasonable program would behave this way,");
- VG_(message)(Vg_UserMsg,
- "or because nobody has yet needed it. In any case, let us know at");
- VG_(message)(Vg_UserMsg,
- "%s and/or try to work around the problem, if you can.", VG_BUGS_TO);
- VG_(message)(Vg_UserMsg,
- "");
- VG_(message)(Vg_UserMsg,
- "Valgrind has to exit now. Sorry. Bye!");
- VG_(message)(Vg_UserMsg,
- "");
+ VG_UMSG("</valgrindoutput>\n");
+ VG_UMSG("");
+ VG_UMSG("Valgrind detected that your program requires");
+ VG_UMSG("the following unimplemented functionality:");
+ VG_UMSG(" %s", msg);
+ VG_UMSG("This may be because the functionality is hard to implement,");
+ VG_UMSG("or because no reasonable program would behave this way,");
+ VG_UMSG("or because nobody has yet needed it. In any case, let us know at");
+ VG_UMSG("%s and/or try to work around the problem, if you can.", VG_BUGS_TO);
+ VG_UMSG("");
+ VG_UMSG("Valgrind has to exit now. Sorry. Bye!");
+ VG_UMSG("");
VG_(show_sched_status)();
VG_(exit)(1);
}
diff --git a/include/pub_tool_libcprint.h b/include/pub_tool_libcprint.h
index 065203221..ffaf42531 100644
--- a/include/pub_tool_libcprint.h
+++ b/include/pub_tool_libcprint.h
@@ -98,7 +98,9 @@ extern UInt VG_(message)( VgMsgKind kind, const HChar* format, ... )
extern UInt VG_(vmessage)( VgMsgKind kind, const HChar* format, va_list vargs )
PRINTF_CHECK(2, 0);
-
+// Short-cuts for VG_(message)().
+#define VG_UMSG( format, args... ) VG_(message)(Vg_UserMsg, format, ##args)
+#define VG_DMSG( format, args... ) VG_(message)(Vg_DebugMsg, format, ##args)
#endif // __PUB_TOOL_LIBCPRINT_H
diff --git a/lackey/lk_main.c b/lackey/lk_main.c
index 3e43edebd..c0394806c 100644
--- a/lackey/lk_main.c
+++ b/lackey/lk_main.c
@@ -368,17 +368,14 @@ static void instrument_detail(IRSB* sb, Op op, IRType type)
static void print_details ( void )
{
Int typeIx;
- VG_(message)(Vg_UserMsg,
- " Type Loads Stores AluOps");
- VG_(message)(Vg_UserMsg,
- " -------------------------------------------");
+ VG_UMSG(" Type Loads Stores AluOps");
+ VG_UMSG(" -------------------------------------------");
for (typeIx = 0; typeIx < N_TYPES; typeIx++) {
- VG_(message)(Vg_UserMsg,
- " %4s %'12llu %'12llu %'12llu",
- nameOfTypeIndex( typeIx ),
- detailCounts[OpLoad ][typeIx],
- detailCounts[OpStore][typeIx],
- detailCounts[OpAlu ][typeIx]
+ VG_UMSG(" %4s %'12llu %'12llu %'12llu",
+ nameOfTypeIndex( typeIx ),
+ detailCounts[OpLoad ][typeIx],
+ detailCounts[OpStore][typeIx],
+ detailCounts[OpAlu ][typeIx]
);
}
}
@@ -865,45 +862,44 @@ static void lk_fini(Int exitcode)
ULong total_Jccs = n_Jccs + n_IJccs;
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);
+ VG_UMSG("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_UMSG("");
+ VG_UMSG("Jccs:");
+ VG_UMSG(" 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_UMSG(" 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_UMSG("");
+ VG_UMSG("Executed:");
+ VG_UMSG(" SBs entered: %'llu", n_SBs_entered);
+ VG_UMSG(" SBs completed: %'llu", n_SBs_completed);
+ VG_UMSG(" guest instrs: %'llu", n_guest_instrs);
+ VG_UMSG(" IRStmts: %'llu", n_IRStmts);
- VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg, "Ratios:");
+ VG_UMSG("");
+ VG_UMSG("Ratios:");
tl_assert(n_SBs_entered); // Paranoia time.
- VG_(message)(Vg_UserMsg, " guest instrs : SB entered = %'llu : 10",
+ VG_UMSG(" guest instrs : SB entered = %'llu : 10",
10 * n_guest_instrs / n_SBs_entered);
- VG_(message)(Vg_UserMsg, " IRStmts : SB entered = %'llu : 10",
+ VG_UMSG(" IRStmts : SB entered = %'llu : 10",
10 * n_IRStmts / n_SBs_entered);
tl_assert(n_guest_instrs); // Paranoia time.
- VG_(message)(Vg_UserMsg, " IRStmts : guest instr = %'llu : 10",
+ VG_UMSG(" IRStmts : guest instr = %'llu : 10",
10 * n_IRStmts / n_guest_instrs);
}
if (clo_detailed_counts) {
- VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg, "IR-level counts by type:");
+ VG_UMSG("");
+ VG_UMSG("IR-level counts by type:");
print_details();
}
if (clo_basic_counts) {
- VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg, "Exit code: %d", exitcode);
+ VG_UMSG("");
+ VG_UMSG("Exit code: %d", exitcode);
}
}
diff --git a/massif/ms_main.c b/massif/ms_main.c
index d454e08a0..4c680f2eb 100644
--- a/massif/ms_main.c
+++ b/massif/ms_main.c
@@ -217,7 +217,7 @@ Number of snapshots: 50
// Used for printing things when clo_verbosity > 1.
#define VERB(verb, format, args...) \
if (VG_(clo_verbosity) > verb) { \
- VG_(message)(Vg_DebugMsg, "Massif: " format, ##args); \
+ VG_DMSG("Massif: " format, ##args); \
}
//------------------------------------------------------------//
@@ -919,16 +919,16 @@ static XPt* get_XCon( ThreadId tid, Bool is_custom_alloc )
if (0 != xpt->n_children) {
static Int n_moans = 0;
if (n_moans < 3) {
- VG_(message)(Vg_UserMsg,
+ VG_UMSG(
"Warning: Malformed stack trace detected. In Massif's output,");
- VG_(message)(Vg_UserMsg,
+ VG_UMSG(
" the size of an entry's child entries may not sum up");
- VG_(message)(Vg_UserMsg,
+ VG_UMSG(
" to the entry's size as they normally do.");
n_moans++;
if (3 == n_moans)
- VG_(message)(Vg_UserMsg,
- " (And Massif now won't warn about this again.)");
+ VG_UMSG(
+ " (And Massif now won't warn about this again.)");
}
}
return xpt;
@@ -2075,10 +2075,8 @@ static void write_snapshots_to_file(void)
if (sres.isError) {
// If the file can't be opened for whatever reason (conflict
// between multiple cachegrinded processes?), give up now.
- VG_(message)(Vg_UserMsg,
- "error: can't open output file '%s'", massif_out_file );
- VG_(message)(Vg_UserMsg,
- " ... so profiling results will be missing.");
+ VG_UMSG("error: can't open output file '%s'", massif_out_file );
+ VG_UMSG(" ... so profiling results will be missing.");
VG_(free)(massif_out_file);
return;
} else {
@@ -2164,7 +2162,7 @@ static void ms_post_clo_init(void)
// Check options.
if (clo_threshold < 0 || clo_threshold > 100) {
- VG_(message)(Vg_UserMsg, "--threshold must be between 0.0 and 100.0");
+ VG_UMSG("--threshold must be between 0.0 and 100.0");
VG_(err_bad_option)("--threshold");
}