Changed error messages: now don't print anything below main() unless the new
option --show-below-main is on. It's on by default. It also affects
suppressions generated with --gen-suppressions=yes. Updated reg tests
accordingly.
Also updated docs for this. And added some missing command-line args to docs.
Also compartmentalised the options a little in the docs, and rearranged the
order of options in the usage message, in anticipation of a bigger
rearrangement that will be necessary soon -- to distinguish options used by all
skins from those used by error-checking skins, to skin-specific ones.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2020 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_errcontext.c b/coregrind/vg_errcontext.c
index 3c76f05..7f4f729 100644
--- a/coregrind/vg_errcontext.c
+++ b/coregrind/vg_errcontext.c
@@ -195,6 +195,7 @@
{
Int i;
UChar buf[M_VG_ERRTXT];
+ Bool main_done = False;
ExeContext* ec = VG_(get_error_where)(err);
Int stop_at = VG_(clo_backtrace_size);
@@ -222,10 +223,16 @@
i = 0;
do {
Addr eip = ec->eips[i];
- if (i > 0)
- eip--; /* point to calling line */
-
+ if (i > 0) eip--; /* point to calling line */
if ( VG_(get_fnname_nodemangle) (eip, buf, M_VG_ERRTXT) ) {
+ // Stop after "main"; if main() is recursive, stop after last main().
+
+ if ( ! VG_(clo_show_below_main)) {
+ if (VG_STREQ(buf, "main"))
+ main_done = True;
+ else if (main_done)
+ break;
+ }
VG_(printf)(" fun:%s\n", buf);
} else if ( VG_(get_objname)(eip, buf, M_VG_ERRTXT) ) {
VG_(printf)(" obj:%s\n", buf);