|
From: <sv...@va...> - 2009-08-24 06:41:54
|
Author: njn
Date: 2009-08-24 07:41:40 +0100 (Mon, 24 Aug 2009)
New Revision: 10866
Log:
More conversions.
Modified:
branches/MSG2/cachegrind/cg_main.c
branches/MSG2/callgrind/sim.c
branches/MSG2/coregrind/m_debuglog.c
branches/MSG2/coregrind/m_libcprint.c
branches/MSG2/coregrind/m_main.c
branches/MSG2/coregrind/pub_core_debuglog.h
branches/MSG2/include/pub_tool_stacktrace.h
branches/MSG2/include/pub_tool_tooliface.h
branches/MSG2/memcheck/mc_main.c
branches/MSG2/none/tests/cmdline2.stdout.exp
Modified: branches/MSG2/cachegrind/cg_main.c
===================================================================
--- branches/MSG2/cachegrind/cg_main.c 2009-08-23 23:33:28 UTC (rev 10865)
+++ branches/MSG2/cachegrind/cg_main.c 2009-08-24 06:41:40 UTC (rev 10866)
@@ -1588,31 +1588,31 @@
Int debug_lookups = full_debugs + fn_debugs +
file_line_debugs + no_debugs;
- VG_(dmsg)("\n");
- VG_(dmsg)("cachegrind: distinct files: %d\n", distinct_files);
- VG_(dmsg)("cachegrind: distinct fns: %d\n", distinct_fns);
- VG_(dmsg)("cachegrind: distinct lines: %d\n", distinct_lines);
- VG_(dmsg)("cachegrind: distinct instrs:%d\n", distinct_instrs);
- VG_(dmsg)("cachegrind: debug lookups : %d\n", debug_lookups);
+ VG_(msgd)("\n");
+ VG_(msgd)("cachegrind: distinct files: %d\n", distinct_files);
+ VG_(msgd)("cachegrind: distinct fns: %d\n", distinct_fns);
+ VG_(msgd)("cachegrind: distinct lines: %d\n", distinct_lines);
+ VG_(msgd)("cachegrind: distinct instrs:%d\n", distinct_instrs);
+ VG_(msgd)("cachegrind: debug lookups : %d\n", 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_(dmsg)("cachegrind: with full info:%s (%d)\n",
+ VG_(msgd)("cachegrind: with full info:%s (%d)\n",
buf1, full_debugs);
- VG_(dmsg)("cachegrind: with file/line info:%s (%d)\n",
+ VG_(msgd)("cachegrind: with file/line info:%s (%d)\n",
buf2, file_line_debugs);
- VG_(dmsg)("cachegrind: with fn name info:%s (%d)\n",
+ VG_(msgd)("cachegrind: with fn name info:%s (%d)\n",
buf3, fn_debugs);
- VG_(dmsg)("cachegrind: with zero info:%s (%d)\n",
+ VG_(msgd)("cachegrind: with zero info:%s (%d)\n",
buf4, no_debugs);
- VG_(dmsg)("cachegrind: string table size: %lu\n",
+ VG_(msgd)("cachegrind: string table size: %lu\n",
VG_(OSetGen_Size)(stringTable));
- VG_(dmsg)("cachegrind: CC table size: %lu\n",
+ VG_(msgd)("cachegrind: CC table size: %lu\n",
VG_(OSetGen_Size)(CC_table));
- VG_(dmsg)("cachegrind: InstrInfo table size: %lu\n",
+ VG_(msgd)("cachegrind: InstrInfo table size: %lu\n",
VG_(OSetGen_Size)(instrInfoTable));
}
}
@@ -1669,7 +1669,7 @@
checkRes = check_cache(cache);
if (checkRes) {
- VG_(msgf)(checkRes);
+ VG_(msgf)("%s", checkRes);
goto bad;
}
Modified: branches/MSG2/callgrind/sim.c
===================================================================
--- branches/MSG2/callgrind/sim.c 2009-08-23 23:33:28 UTC (rev 10865)
+++ branches/MSG2/callgrind/sim.c 2009-08-24 06:41:40 UTC (rev 10866)
@@ -1540,7 +1540,7 @@
checkRes = check_cache(cache);
if (checkRes) {
- VG_(msgf)(checkRes);
+ VG_(msgf)("%s", checkRes);
goto bad;
}
Modified: branches/MSG2/coregrind/m_debuglog.c
===================================================================
--- branches/MSG2/coregrind/m_debuglog.c 2009-08-23 23:33:28 UTC (rev 10865)
+++ branches/MSG2/coregrind/m_debuglog.c 2009-08-24 06:41:40 UTC (rev 10866)
@@ -933,16 +933,27 @@
is <= the current loglevel. */
/* EXPORTED */
__attribute__((format(__printf__, 3, 4)))
-void VG_(debugLog) ( Int level, const HChar* modulename,
+UInt VG_(debugLog) ( Int level, const HChar* modulename,
const HChar* format, ... )
{
+ UInt count;
+ va_list vargs;
+ va_start(vargs, format);
+ count = VG_(vdebugLog) ( level, modulename, format, vargs );
+ va_end(vargs);
+ return count;
+}
+
+__attribute__((format(__printf__, 3, 0)))
+UInt VG_(vdebugLog) ( Int level, const HChar* modulename,
+ const HChar* format, va_list vargs )
+{
UInt ret, pid;
Int indent, depth, i;
- va_list vargs;
printf_buf buf;
if (level > loglevel)
- return;
+ return 0;
indent = 2*level - 1;
if (indent < 1) indent = 1;
@@ -966,15 +977,13 @@
(void)myvprintf_str ( add_to_buf, &buf, 0, 8, (HChar*)modulename, False );
(void)myvprintf_str ( add_to_buf, &buf, 0, indent, "", False );
- va_start(vargs,format);
-
ret = VG_(debugLog_vprintf) ( add_to_buf, &buf, format, vargs );
if (buf.n > 0) {
emit( buf.buf, local_strlen(buf.buf) );
}
- va_end(vargs);
+ return ret;
}
Modified: branches/MSG2/coregrind/m_libcprint.c
===================================================================
--- branches/MSG2/coregrind/m_libcprint.c 2009-08-23 23:33:28 UTC (rev 10865)
+++ branches/MSG2/coregrind/m_libcprint.c 2009-08-24 06:41:40 UTC (rev 10866)
@@ -511,7 +511,7 @@
{
UInt count;
va_list vargs;
- va_start(vargs,format);
+ va_start(vargs, format);
count = VG_(vmessage) ( kind, format, vargs );
va_end(vargs);
return count;
@@ -523,7 +523,7 @@
{
UInt count;
va_list vargs;
- va_start(vargs,format);
+ va_start(vargs, format);
count = VG_(vmessage) ( kind, format, vargs );
va_end(vargs);
return count;
@@ -601,12 +601,14 @@
return count;
}
+// MMM: should just merge this with VG_(debugLog)
UInt VG_(msgd) ( const HChar* format, ... )
{
UInt count;
va_list vargs;
va_start(vargs,format);
- count = VG_(vmessage) ( Vg_DebugMsg, format, vargs );
+ // MMM: 0 here... hmm.
+ count = VG_(vdebugLog) ( 0, "MMM", format, vargs );
va_end(vargs);
return count;
}
Modified: branches/MSG2/coregrind/m_main.c
===================================================================
--- branches/MSG2/coregrind/m_main.c 2009-08-23 23:33:28 UTC (rev 10865)
+++ branches/MSG2/coregrind/m_main.c 2009-08-24 06:41:40 UTC (rev 10866)
@@ -171,8 +171,8 @@
Char* usage2 =
"\n"
" debugging options for all Valgrind tools:\n"
+" -d show verbose debugging output\n"
" --stats=no|yes show tool and core statistics [no]\n"
-" -d show verbose debugging output\n"
" --sanity-level=<number> level of sanity checking to do [1]\n"
" --trace-flags=<XXXXXXXX> show generated code? (X = 0|1) [00000000]\n"
" --profile-flags=<XXXXXXXX> ditto, but for profiling (X = 0|1) [00000000]\n"
Modified: branches/MSG2/coregrind/pub_core_debuglog.h
===================================================================
--- branches/MSG2/coregrind/pub_core_debuglog.h 2009-08-23 23:33:28 UTC (rev 10865)
+++ branches/MSG2/coregrind/pub_core_debuglog.h 2009-08-24 06:41:40 UTC (rev 10866)
@@ -69,9 +69,14 @@
/* Send debugging output. Nothing happens unless 'level'
does not exceed the logging threshold level. */
extern
+// MMM: use PRINTF_CHECK
__attribute__((format(__printf__, 3, 4)))
-void VG_(debugLog) ( Int level, const HChar* modulename,
+UInt VG_(debugLog) ( Int level, const HChar* modulename,
const HChar* format, ... );
+extern
+__attribute__((format(__printf__, 3, 0)))
+UInt VG_(vdebugLog) ( Int level, const HChar* modulename,
+ const HChar* format, va_list vargs );
/* A simple vprintf(). For each emitted byte, (*send_fn) is called with
Modified: branches/MSG2/include/pub_tool_stacktrace.h
===================================================================
--- branches/MSG2/include/pub_tool_stacktrace.h 2009-08-23 23:33:28 UTC (rev 10865)
+++ branches/MSG2/include/pub_tool_stacktrace.h 2009-08-24 06:41:40 UTC (rev 10866)
@@ -74,6 +74,7 @@
);
// Print a StackTrace.
+// MMM: should probably take a VgMsgKind argument.
extern void VG_(pp_StackTrace) ( StackTrace ips, UInt n_ips );
// Gets and immediately prints a StackTrace. Just a bit simpler than
Modified: branches/MSG2/include/pub_tool_tooliface.h
===================================================================
--- branches/MSG2/include/pub_tool_tooliface.h 2009-08-23 23:33:28 UTC (rev 10865)
+++ branches/MSG2/include/pub_tool_tooliface.h 2009-08-24 06:41:40 UTC (rev 10866)
@@ -374,15 +374,17 @@
/* Tool defines its own command line options? */
extern void VG_(needs_command_line_options) (
- // Return True if option was recognised. Presumably sets some state to
- // record the option as well. Nb: tools can assume that the argv will
- // never disappear. So they can, for example, store a pointer to a string
- // within an option, rather than having to make a copy.
+ // Return True if option was recognised, False if it wasn't (but also see
+ // below). Presumably sets some state to record the option as well.
//
+ // Nb: tools can assume that the argv will never disappear. So they can,
+ // for example, store a pointer to a string within an option, rather than
+ // having to make a copy.
+ //
// Options (and combinations of options) should be checked in this function
// if possible rather than in post_clo_init(), and if they are bad then
- // VG_(err_bad_option)() should be called. This ensures that the messaging
- // is consistent with command line option errors from the core.
+ // VG_(msgf_bad_option)() should be called. This ensures that the
+ // messaging is consistent with command line option errors from the core.
Bool (*process_cmd_line_option)(Char* argv),
// Print out command line usage for options for normal tool operation.
Modified: branches/MSG2/memcheck/mc_main.c
===================================================================
--- branches/MSG2/memcheck/mc_main.c 2009-08-23 23:33:28 UTC (rev 10865)
+++ branches/MSG2/memcheck/mc_main.c 2009-08-24 06:41:40 UTC (rev 10866)
@@ -4666,8 +4666,6 @@
static Bool mc_process_cmd_line_options(Char* arg)
{
Char* tmp_str;
- Char* bad_level_msg =
- "ERROR: --track-origins=yes has no effect when --undef-value-errors=no";
tl_assert( MC_(clo_mc_level) >= 1 && MC_(clo_mc_level) <= 3 );
@@ -4682,8 +4680,7 @@
*/
if (0 == VG_(strcmp)(arg, "--undef-value-errors=no")) {
if (MC_(clo_mc_level) == 3) {
- VG_(message)(Vg_DebugMsg, "%s\n", bad_level_msg);
- return False;
+ goto bad_level;
} else {
MC_(clo_mc_level) = 1;
return True;
@@ -4701,8 +4698,7 @@
}
if (0 == VG_(strcmp)(arg, "--track-origins=yes")) {
if (MC_(clo_mc_level) == 1) {
- VG_(message)(Vg_DebugMsg, "%s\n", bad_level_msg);
- return False;
+ goto bad_level;
} else {
MC_(clo_mc_level) = 3;
return True;
@@ -4768,6 +4764,10 @@
return VG_(replacement_malloc_process_cmd_line_option)(arg);
return True;
+
+ bad_level:
+ VG_(msgf_bad_option)(arg,
+ "--track-origins=yes has no effect when --undef-value-errors=no.\n");
}
static void mc_print_usage(void)
Modified: branches/MSG2/none/tests/cmdline2.stdout.exp
===================================================================
--- branches/MSG2/none/tests/cmdline2.stdout.exp 2009-08-23 23:33:28 UTC (rev 10865)
+++ branches/MSG2/none/tests/cmdline2.stdout.exp 2009-08-24 06:41:40 UTC (rev 10866)
@@ -60,8 +60,8 @@
(none)
debugging options for all Valgrind tools:
+ -d show verbose debugging output
--stats=no|yes show tool and core statistics [no]
- -d show verbose debugging output
--sanity-level=<number> level of sanity checking to do [1]
--trace-flags=<XXXXXXXX> show generated code? (X = 0|1) [00000000]
--profile-flags=<XXXXXXXX> ditto, but for profiling (X = 0|1) [00000000]
|