]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Revert "Tools should explain why an option is bad when using fmsg_bad_option."
authorMark Wielaard <mark@klomp.org>
Fri, 16 May 2014 22:38:46 +0000 (22:38 +0000)
committerMark Wielaard <mark@klomp.org>
Fri, 16 May 2014 22:38:46 +0000 (22:38 +0000)
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
cachegrind/cg_arch.c
coregrind/m_main.c
coregrind/m_options.c
include/pub_tool_options.h
massif/ms_main.c

diff --git a/NEWS b/NEWS
index 8b3fe0e5a2663548e58223672b87aa0064d7e435..a4f02a18d6ba89f550cf8ab63d8f07e32b768e75 100644 (file)
--- 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
index 5a1e5a6c19f64ddd38dda36f2bfccf24b6907e3c..0b39c526ddb633b791e4a0e09eb19d10d5ce67d8 100644 (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,
index a5fc5db858028ea6d317e54798aadaf33741f199..ee83a2280c2a1dd80abcdee0d59ee030731804a6 100644 (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!) */
index de457ec580216bbe8311ba65d3109ac62fa303b2..7b8b141560f735ce2a656bb85323368c8353b246 100644 (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, "");
   }
 }
 
index af9eefc21754e99dfecb1da1661552e3cc7d6cbf..2ad1da8f0ddcd36a989ded2c65a3af72775725e7 100644 (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, \
       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; \
      }) \
     )
index a6a37202afcb3e273d7c2a76f6bb1cf0f5060002..d6a0d17d5bbb6e768f026aefd56b0e241a80142b 100644 (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) {