]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make it possible to match against "???" line in suppressions,
authorNicholas Nethercote <njn@valgrind.org>
Thu, 18 Aug 2005 15:49:21 +0000 (15:49 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Thu, 18 Aug 2005 15:49:21 +0000 (15:49 +0000)
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

coregrind/m_errormgr.c
memcheck/tests/Makefile.am
memcheck/tests/supp_unknown.stderr.exp [new file with mode: 0644]
memcheck/tests/supp_unknown.supp [new file with mode: 0644]
memcheck/tests/supp_unknown.vgtest [new file with mode: 0644]

index c41d03dff249458d35465706508210d643edbe2c..8149b705bd2b17adc884b765c6c0510aa35fcffb 100644 (file)
@@ -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");
       }
index 5e59567eb50a3d395758234c04c5a69b845e96fd..28bc93060d61f0e5c320b8e3e40dc741991533a5 100644 (file)
@@ -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 (file)
index 0000000..c465028
--- /dev/null
@@ -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 (file)
index 0000000..149a50c
--- /dev/null
@@ -0,0 +1,8 @@
+# This contains a match against a "???" entry
+{
+   <insert a suppression name here>
+   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 (file)
index 0000000..de687e6
--- /dev/null
@@ -0,0 +1,3 @@
+vgopts: -q --suppressions=supp_unknown.supp
+prog: badjump
+cleanup: rm -f vgcore.pid*