]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add a new variant for --gen-suppressions: --gen-suppressions=all,
authorJulian Seward <jseward@acm.org>
Mon, 10 Jan 2005 17:24:47 +0000 (17:24 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 10 Jan 2005 17:24:47 +0000 (17:24 +0000)
which just prints a suppression for all reported errors without asking
questions.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3219

coregrind/core.h
coregrind/vg_errcontext.c
coregrind/vg_main.c
docs/xml/manual-core.xml

index d15cfe4a7c22a31bde36b9c434e825de643aa244..6ef73b35f99f1af6673abb8baa707a3ed33a21db 100644 (file)
@@ -247,8 +247,9 @@ extern Bool  VG_(clo_error_limit);
 extern Bool  VG_(clo_db_attach);
 /* The debugger command?  default: whatever gdb ./configure found */
 extern Char* VG_(clo_db_command);
-/* Enquire about generating a suppression for each error?   default: NO */
-extern Bool  VG_(clo_gen_suppressions);
+/* Generating a suppression for each error?   default: 0 (NO)
+   Other values: 1 (yes, but ask user), 2 (yes, don't ask user) */
+extern Int  VG_(clo_gen_suppressions);
 /* Sanity-check level: 0 = none, 1 (default), > 1 = expensive. */
 extern Int   VG_(clo_sanity_level);
 /* Automatically attempt to demangle C++ names?  default: YES */
index 2fbaa09e36471b9a83630883c09eac3181d82e7e..a6f8b2d8e60da787e88fe74dadbcce72cbf908ee 100644 (file)
@@ -380,6 +380,8 @@ static void gen_suppression(Error* err)
 static 
 void do_actions_on_error(Error* err, Bool allow_db_attach)
 {
+   Bool still_noisy = True;
+
    /* Perhaps we want a debugger attach at this point? */
    if (allow_db_attach &&
        VG_(is_action_requested)( "Attach to debugger", & VG_(clo_db_attach) )) 
@@ -388,9 +390,14 @@ void do_actions_on_error(Error* err, Bool allow_db_attach)
       VG_(start_debugger)( err->tid );
    }
    /* Or maybe we want to generate the error's suppression? */
-   if (VG_(is_action_requested)( "Print suppression",
-                                 & VG_(clo_gen_suppressions) )) {
+   if (VG_(clo_gen_suppressions) == 2
+       || (VG_(clo_gen_suppressions) == 1
+           && VG_(is_action_requested)( "Print suppression",
+                                        &still_noisy ))
+      ) {
       gen_suppression(err);
+      if (VG_(clo_gen_suppressions) == 1 && !still_noisy)
+         VG_(clo_gen_suppressions) = 0;
    }
 }
 
index dffdbffc64030477357154b9502b1cf35e066840..da36f4d74f8b6ebf77dbb3531cea3eaaf0f9a2ff 100644 (file)
@@ -1464,7 +1464,7 @@ VexControl VG_(clo_vex_control);
 Bool   VG_(clo_error_limit)    = True;
 Bool   VG_(clo_db_attach)      = False;
 Char*  VG_(clo_db_command)     = VG_CLO_DEFAULT_DBCOMMAND;
-Bool   VG_(clo_gen_suppressions) = False;
+Int    VG_(clo_gen_suppressions) = 0;
 Int    VG_(clo_sanity_level)   = 1;
 Int    VG_(clo_verbosity)      = 1;
 Bool   VG_(clo_demangle)       = True;
@@ -1547,7 +1547,7 @@ void usage ( Bool debug_help )
 "    --error-limit=no|yes      stop showing new errors if too many? [yes]\n"
 "    --show-below-main=no|yes  continue stack traces below main() [no]\n"
 "    --suppressions=<filename> suppress errors described in <filename>\n"
-"    --gen-suppressions=no|yes print suppressions for errors detected [no]\n"
+"    --gen-suppressions=no|yes|all    print suppressions for errors? [no]\n"
 "    --db-attach=no|yes        start debugger when errors detected? [no]\n"
 "    --db-command=<command>    command to start debugger [gdb -nw %%f %%p]\n"
 "    --input-fd=<number>       file descriptor for input [0=stdin]\n"
@@ -1746,7 +1746,6 @@ static void process_cmd_line_options( UInt* client_auxv, const char* toolname )
       else VG_BOOL_CLO("--db-attach",        VG_(clo_db_attach))
       else VG_BOOL_CLO("--demangle",         VG_(clo_demangle))
       else VG_BOOL_CLO("--error-limit",      VG_(clo_error_limit))
-      else VG_BOOL_CLO("--gen-suppressions", VG_(clo_gen_suppressions))
       else VG_BOOL_CLO("--lowlat-signals",   VG_(clo_lowlat_signals))
       else VG_BOOL_CLO("--lowlat-syscalls",  VG_(clo_lowlat_syscalls))
       else VG_BOOL_CLO("--pointercheck",     VG_(clo_pointercheck))
@@ -1860,6 +1859,13 @@ static void process_cmd_line_options( UInt* client_auxv, const char* toolname )
       else if (VG_CLO_STREQ(arg, "--trace-pthread=all"))
          VG_(clo_trace_pthread_level) = 2;
 
+      else if (VG_CLO_STREQ(arg, "--gen-suppressions=no"))
+         VG_(clo_gen_suppressions) = 0;
+      else if (VG_CLO_STREQ(arg, "--gen-suppressions=yes"))
+         VG_(clo_gen_suppressions) = 1;
+      else if (VG_CLO_STREQ(arg, "--gen-suppressions=all"))
+         VG_(clo_gen_suppressions) = 2;
+
       else if ( ! VG_(needs).command_line_options
              || ! TL_(process_cmd_line_option)(arg) ) {
          VG_(bad_option)(arg);
@@ -2069,13 +2075,13 @@ static void process_cmd_line_options( UInt* client_auxv, const char* toolname )
       VG_(clo_n_suppressions)++;
    }
 
-   if (VG_(clo_gen_suppressions) && 
+   if (VG_(clo_gen_suppressions) > 0 && 
        !VG_(needs).core_errors && !VG_(needs).tool_errors) {
       VG_(message)(Vg_UserMsg, 
-                   "Can't use --gen-suppressions=yes with this tool,");
+                   "Can't use --gen-suppressions= with this tool,");
       VG_(message)(Vg_UserMsg, 
                    "as it doesn't generate errors.");
-      VG_(bad_option)("--gen-suppressions=yes");
+      VG_(bad_option)("--gen-suppressions=");
    }
 }
 
index 06da30a975f889281a1b2f123380d9ae8c2a7f44..e8ee1a345d5bb1d9159ba5a38f1f7777fd6232b9 100644 (file)
@@ -729,9 +729,12 @@ errors, e.g. Memcheck, but not Cachegrind.</para>
     <para><computeroutput>--gen-suppressions=no</computeroutput>
     [default]</para>
     <para><computeroutput>--gen-suppressions=yes</computeroutput></para>
-    <para>When enabled, Valgrind will pause after every error
-    shown, and print the line: <computeroutput>---- Print
-    suppression ?  --- [Return/N/n/Y/y/C/c] ----</computeroutput></para>
+    <para><computeroutput>--gen-suppressions=all</computeroutput></para>
+
+    <para>When set to <computeroutput>yes<computeroutput>, Valgrind
+    will pause after every error shown, and print the line:
+    <computeroutput>---- Print suppression ?  --- [Return/N/n/Y/y/C/c]
+    ----</computeroutput></para>
 
     <para>The prompt's behaviour is the same as for the 
     <computeroutput>--db-attach</computeroutput> option.</para>
@@ -741,6 +744,10 @@ errors, e.g. Memcheck, but not Cachegrind.</para>
     suppression file if you don't want to hear about the error in
     the future.</para>
 
+    <para>When set to <computeroutput>all<computeroutput>, Valgrind
+    will print a suppression for every reported error, without
+    querying the user.</para>
+
     <para>This option is particularly useful with C++ programs,
     as it prints out the suppressions with mangled names, as
     required.</para>