From a1513e03483d13277293a2666a8167e53647fbd3 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 16 May 2014 22:38:46 +0000 Subject: [PATCH] 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 --- NEWS | 1 - cachegrind/cg_arch.c | 2 +- coregrind/m_main.c | 14 +++++--------- coregrind/m_options.c | 8 +++++++- include/pub_tool_options.h | 9 +++------ massif/ms_main.c | 4 ++-- 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/NEWS b/NEWS index 8b3fe0e5a..a4f02a18d 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/cachegrind/cg_arch.c b/cachegrind/cg_arch.c index 5a1e5a6c1..0b39c526d 100644 --- a/cachegrind/cg_arch.c +++ b/cachegrind/cg_arch.c @@ -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, diff --git a/coregrind/m_main.c b/coregrind/m_main.c index a5fc5db85..ee83a2280 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -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!) */ diff --git a/coregrind/m_options.c b/coregrind/m_options.c index de457ec58..7b8b14156 100644 --- a/coregrind/m_options.c +++ b/coregrind/m_options.c @@ -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, ""); } } diff --git a/include/pub_tool_options.h b/include/pub_tool_options.h index af9eefc21..2ad1da8f0 100644 --- a/include/pub_tool_options.h +++ b/include/pub_tool_options.h @@ -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; \ }) \ ) diff --git a/massif/ms_main.c b/massif/ms_main.c index a6a37202a..d6a0d17d5 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -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) {