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 */
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) ))
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;
}
}
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;
" --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"
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))
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);
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=");
}
}
<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>
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>