Make error messages at start-up more consistent. Every line of such
messages now begin with "valgrind: ", and they're more often printed before
the preamble. This required introducing a new message kind, Vg_FailMsg, and
functions VG_(fmsg) and VG_(fmsg_bad_option), and removing
VG_(err_bad_option).
Where we used to have horrible output like this:
[ocean:~/grind/ws2] vg5 --tool=massif --threshold=101 date
==31877== Massif, a heap profiler
==31877== Copyright (C) 2003-2010, and GNU GPL'd, by Nicholas Nethercote
==31877== Using Valgrind-3.6.0.SVN and LibVEX; rerun with -h for copyright info
==31877== Command: date
==31877==
==31877== --threshold must be between 0.0 and 100.0
valgrind: Bad option '--threshold'; aborting.
valgrind: Use --help for more information.
We now have nice output like this:
[ocean:~/grind/ws2] vg2 --tool=massif --threshold=101 date
valgrind: Bad option: --threshold=101
valgrind: --threshold must be between 0.0 and 100.0
valgrind: Use --help for more information or consult the user manual.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11209 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/massif/ms_main.c b/massif/ms_main.c
index 0b88bc3..c34d27b 100644
--- a/massif/ms_main.c
+++ b/massif/ms_main.c
@@ -442,7 +442,12 @@
VG_(addToXA)(ignore_fns, &tmp_str);
}
- else if VG_DBL_CLO(arg, "--threshold", clo_threshold) {}
+ else if VG_DBL_CLO(arg, "--threshold", clo_threshold) {
+ if (clo_threshold < 0 || clo_threshold > 100) {
+ VG_(fmsg_bad_option)(arg,
+ "--threshold must be between 0.0 and 100.0\n");
+ }
+ }
else if VG_DBL_CLO(arg, "--peak-inaccuracy", clo_peak_inaccuracy) {}
@@ -2386,14 +2391,10 @@
Char* s2;
// Check options.
- if (clo_threshold < 0 || clo_threshold > 100) {
- VG_(umsg)("--threshold must be between 0.0 and 100.0\n");
- VG_(err_bad_option)("--threshold");
- }
if (clo_pages_as_heap) {
if (clo_stacks) {
- VG_(umsg)("--pages-as-heap=yes cannot be used with --stacks=yes\n");
- VG_(err_bad_option)("--pages-as-heap=yes with --stacks=yes");
+ VG_(fmsg_bad_option)(
+ "--pages-as-heap=yes together with --stacks=yes", "");
}
}
if (!clo_heap) {