Revert "Tools should explain why an option is bad when using fmsg_bad_option."

This reverts valgrind svn r13975. This was a work in progress, still being
discussed in bug #334802. It should not yet been pushed.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13978
This commit is contained in:
Mark Wielaard 2014-05-16 22:38:46 +00:00
parent e984a5b888
commit a1513e0348
6 changed files with 18 additions and 20 deletions

1
NEWS
View File

@ -129,7 +129,6 @@ where XXXXXX is the bug number as listed below.
334049 lzcnt fails silently (x86_32)
334705 sendmsg and recvmsg should guard against bogus msghdr fields.
334727 Build fails with -Werror=format-security
334802 valgrind does not always explain why a given option is bad
n-i-bz Fix KVM_CREATE_IRQCHIP ioctl handling
n-i-bz s390x: Fix memory corruption for multithreaded applications
n-i-bz vex arm->IR: allow PC as basereg in some LDRD cases

View File

@ -105,7 +105,7 @@ static void parse_cache_opt ( cache_t* cache, const HChar* opt,
return;
bad:
VG_(fmsg_bad_option)(opt, "Bad argument '%s'\n", optval);
VG_(fmsg_bad_option)(opt, "");
overflow:
VG_(fmsg_bad_option)(opt,

View File

@ -542,12 +542,9 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd,
else if VG_INT_CLO (arg, "--vgdb-poll", VG_(clo_vgdb_poll)) {}
else if VG_INT_CLO (arg, "--vgdb-error", VG_(clo_vgdb_error)) {}
else if VG_STR_CLO (arg, "--vgdb-stop-at", tmp_str) {
const HChar event_set[] = "startup,exit,valgrindabexit";
if (!VG_(parse_enum_set)(event_set, tmp_str,
if (!VG_(parse_enum_set)("startup,exit,valgrindabexit", tmp_str,
&VG_(clo_vgdb_stop_at)))
VG_(fmsg_bad_option)(arg,
"Bad event set '%s', should be a list containing '%s'\n",
tmp_str, event_set);
VG_(fmsg_bad_option)(arg, "");
}
else if VG_STR_CLO (arg, "--vgdb-prefix", VG_(clo_vgdb_prefix)) {
VG_(arg_vgdb_prefix) = arg;
@ -576,8 +573,8 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd,
else if (VG_(strcmp)(tmp_str, "no") == 0)
VG_(clo_fair_sched) = disable_fair_sched;
else
VG_(fmsg_bad_option)(arg,
"Bad argument, should be 'yes', 'try' or 'no'\n");
VG_(fmsg_bad_option)(arg, "");
}
else if VG_BOOL_CLO(arg, "--trace-sched", VG_(clo_trace_sched)) {}
else if VG_BOOL_CLO(arg, "--trace-signals", VG_(clo_trace_signals)) {}
@ -901,8 +898,7 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd,
chaos. No big deal; dump_error is a flag for debugging V
itself. */
if (VG_(clo_dump_error) > 0) {
VG_(fmsg_bad_option)("--xml=yes",
"Cannot be used together with --dump-error");
VG_(fmsg_bad_option)("--xml=yes together with --dump-error", "");
}
/* Disable error limits (this might be a bad idea!) */

View File

@ -267,7 +267,13 @@ HChar* VG_(expand_file_name)(const HChar* option_name, const HChar* format)
return out;
bad: {
VG_(fmsg_bad_option)(option_name, "Bad format '%s'\n", format);
HChar* opt = // 2: 1 for the '=', 1 for the NUL.
VG_(malloc)( "options.efn.3",
VG_(strlen)(option_name) + VG_(strlen)(format) + 2 );
VG_(strcpy)(opt, option_name);
VG_(strcat)(opt, "=");
VG_(strcat)(opt, format);
VG_(fmsg_bad_option)(opt, "");
}
}

View File

@ -80,8 +80,7 @@
Long n = VG_(strtoll10)( val, &s ); \
(qq_var) = n; \
/* Check for non-numeralness, or overflow. */ \
if ('\0' != s[0] || (qq_var) != n) VG_(fmsg_bad_option)(qq_arg, \
"Invalid integer value '%s'\n", val); \
if ('\0' != s[0] || (qq_var) != n) VG_(fmsg_bad_option)(qq_arg, ""); \
True; \
}) \
)
@ -99,8 +98,7 @@
/* for all the other macros in this file. */ \
/* Check for non-numeralness, or overflow. */ \
/* Nb: it will overflow if qq_var is unsigned and qq_val is negative! */ \
if ('\0' != s[0] || (qq_var) != n) VG_(fmsg_bad_option)(qq_arg, \
"Invalid integer value '%s'\n", val); \
if ('\0' != s[0] || (qq_var) != n) VG_(fmsg_bad_option)(qq_arg, ""); \
/* Check bounds. */ \
if ((qq_var) < (qq_lo) || (qq_var) > (qq_hi)) { \
VG_(fmsg_bad_option)(qq_arg, \
@ -130,8 +128,7 @@
double n = VG_(strtod)( val, &s ); \
(qq_var) = n; \
/* Check for non-numeralness */ \
if ('\0' != s[0]) VG_(fmsg_bad_option)(qq_arg, \
"Invalid double (decimal) value '%s'\n"); \
if ('\0' != s[0]) VG_(fmsg_bad_option)(qq_arg, ""); \
True; \
}) \
)

View File

@ -2483,8 +2483,8 @@ static void ms_post_clo_init(void)
// Check options.
if (clo_pages_as_heap) {
if (clo_stacks) {
VG_(fmsg_bad_option)("--pages-as-heap=yes",
"Cannot be used together with --stacks=yes");
VG_(fmsg_bad_option)(
"--pages-as-heap=yes together with --stacks=yes", "");
}
}
if (!clo_heap) {