From: Nicholas Nethercote Date: Thu, 18 Aug 2005 15:49:21 +0000 (+0000) Subject: Make it possible to match against "???" line in suppressions, X-Git-Tag: svn/VALGRIND_3_1_0~571 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=224dad480c3d28cc476f860a9d64e1fa2f261835;p=thirdparty%2Fvalgrind.git Make it possible to match against "???" line in suppressions, using "obj:*" or "fun:*". Also generate "obj:*" for such lines with --gen-suppressions. Includes a regtest. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4447 --- diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c index c41d03dff2..8149b705bd 100644 --- a/coregrind/m_errormgr.c +++ b/coregrind/m_errormgr.c @@ -391,8 +391,7 @@ static void printSuppForIp(UInt n, Addr ip) } else if ( VG_(get_objname)(ip, buf, ERRTXT_LEN) ) { VG_(printf)(" obj:%s\n", buf); } else { - VG_(printf)(" ???:??? " - "# unknown, suppression will not work, sorry\n"); + VG_(printf)(" obj:*\n"); } } @@ -1093,16 +1092,20 @@ Bool supp_matches_callers(Error* err, Supp* su) for (i = 0; i < su->n_callers; i++) { Addr a = ips[i]; vg_assert(su->callers[i].name != NULL); + // The string to be used in the unknown case ("???") can be anything + // that couldn't be a valid function or objname. --gen-suppressions + // prints 'obj:*' for such an entry, which will match any string we + // use. switch (su->callers[i].ty) { case ObjName: if (!VG_(get_objname)(a, caller_name, ERRTXT_LEN)) - return False; + VG_(strcpy)(caller_name, "???"); break; case FunName: // Nb: mangled names used in suppressions if (!VG_(get_fnname_nodemangle)(a, caller_name, ERRTXT_LEN)) - return False; + VG_(strcpy)(caller_name, "???"); break; default: VG_(tool_panic)("supp_matches_callers"); } diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 5e59567eb5..28bc93060d 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -76,6 +76,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) \ stack_changes.stderr.exp stack_changes.stdout.exp stack_changes.vgtest \ strchr.stderr.exp strchr.vgtest \ str_tester.stderr.exp str_tester.vgtest \ + supp_unknown.stderr.exp supp_unknown.vgtest supp_unknown.supp \ supp1.stderr.exp supp1.vgtest \ supp2.stderr.exp supp2.vgtest \ supp.supp \ @@ -110,7 +111,7 @@ check_PROGRAMS = \ post-syscall \ realloc1 realloc2 realloc3 \ sigaltstack signal2 sigprocmask sigkill \ - stack_changes strchr str_tester supp1 supp2 suppfree \ + stack_changes strchr str_tester supp_unknown supp1 supp2 suppfree \ trivialleak weirdioctl \ mismatches new_override metadata \ vgtest_ume xml1 \ @@ -127,6 +128,7 @@ oset_test_CFLAGS = -DVGA_$(VG_ARCH) -DVGO_$(VG_OS) -DVGP_$(VG_PLATFORM) # Don't allow GCC to inline memcpy(), because then we can't intercept it overlap_CFLAGS = $(AM_CFLAGS) -fno-builtin-memcpy str_tester_CFLAGS = $(AM_CFLAGS) -Wno-shadow +supp_unknown_SOURCES = badjump.c supp1_SOURCES = supp.c supp2_SOURCES = supp.c diff --git a/memcheck/tests/supp_unknown.stderr.exp b/memcheck/tests/supp_unknown.stderr.exp new file mode 100644 index 0000000000..c465028b23 --- /dev/null +++ b/memcheck/tests/supp_unknown.stderr.exp @@ -0,0 +1,6 @@ + +Process terminating with default action of signal 11 (SIGSEGV) + Access not within mapped region at address 0x........ + at 0x........: ??? + by 0x........: __libc_start_main (in /...libc...) + by 0x........: ... diff --git a/memcheck/tests/supp_unknown.supp b/memcheck/tests/supp_unknown.supp new file mode 100644 index 0000000000..149a50c3c0 --- /dev/null +++ b/memcheck/tests/supp_unknown.supp @@ -0,0 +1,8 @@ +# This contains a match against a "???" entry +{ + + Memcheck:Addr1 + obj:* + fun:__libc_start_main +} + diff --git a/memcheck/tests/supp_unknown.vgtest b/memcheck/tests/supp_unknown.vgtest new file mode 100644 index 0000000000..de687e653d --- /dev/null +++ b/memcheck/tests/supp_unknown.vgtest @@ -0,0 +1,3 @@ +vgopts: -q --suppressions=supp_unknown.supp +prog: badjump +cleanup: rm -f vgcore.pid*