From: Julian Seward Date: Tue, 4 Nov 2008 11:29:19 +0000 (+0000) Subject: * add some assertions to frame-level wildcarding mechanism X-Git-Tag: svn/VALGRIND_3_4_0~167 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=217f01f3e258edeb74f083a48bbd976dc1dc529b;p=thirdparty%2Fvalgrind.git * add some assertions to frame-level wildcarding mechanism * remove a couple of tabs * clarify related documentation a bit git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8727 --- diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c index 2e408436f8..90560adc58 100644 --- a/coregrind/m_errormgr.c +++ b/coregrind/m_errormgr.c @@ -1133,7 +1133,7 @@ static void load_one_suppressions_file ( Char* filename ) if (VG_(clo_xml)) VG_(message)(Vg_UserMsg, "\n"); VG_(message)(Vg_UserMsg, - "FATAL: in suppressions file \"%s\" around line %d:", + "FATAL: in suppressions file \"%s\" near line %d:", filename, lineno ); VG_(message)(Vg_UserMsg, " %s", err_str ); @@ -1190,6 +1190,7 @@ Bool supp_matches_callers_WRK ( StackTrace trace, Int n_ips, Int i, j; static Char caller_name[ERRTXT_LEN]; /* NOT IN FRAME */ + vg_assert(n_ips > 0 && n_callers > 0); i = j = 0; while (i < n_callers) { Addr a = trace[j]; @@ -1209,6 +1210,7 @@ Bool supp_matches_callers_WRK ( StackTrace trace, Int n_ips, VG_(strcpy)(caller_name, "???"); break; case DotDotDot: + caller_name[0] = 0; /* precautionary */ break; default: VG_(tool_panic)("supp_wildmatch_callers"); @@ -1219,16 +1221,17 @@ Bool supp_matches_callers_WRK ( StackTrace trace, Int n_ips, /* Handle frame-level wildcard case */ Char *lookahead; - // collapse subsequent wildcards - while (i < n_callers && callers[i].ty == DotDotDot) + // collapse subsequent wildcards + while (i < n_callers && callers[i].ty == DotDotDot) ++i; - --i; + --i; if (i == n_callers-1) // wildcard at the top, doesn't matter return True; - lookahead = callers[i+1].name; + vg_assert(i >= 0 && i+1 < n_callers); + lookahead = callers[i+1].name; while (j < n_ips) { static Char tmp[ERRTXT_LEN]; /* NOT IN FRAME */ diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml index a413c37ff2..d090559470 100644 --- a/docs/xml/manual-core.xml +++ b/docs/xml/manual-core.xml @@ -365,7 +365,12 @@ them. Note: By far the easiest way to add suppressions is to use the flag -described in . +described in . This generates +suppressions automatically. For best results, +though, you may want to edit the output + of by hand, in which +case it would be advisable to read through this section. + Each error to be suppressed is described very specifically, to @@ -953,8 +958,15 @@ that can report errors, e.g. Memcheck, but not Cachegrind. required. Note that the suppressions printed are as specific as - possible. You may want to common up similar ones, eg. by adding - wildcards to function names. Sometimes two different errors + possible. You may want to common up similar ones, by adding + wildcards to function names, and by using frame-level wildcards. + The wildcarding facilities are powerful yet flexible, and with a + bit of careful editing, you may be able to suppress a whole + family of related errors with only a few suppressions. For + details on how to do this, see + . + + Sometimes two different errors are suppressed by the same suppression, in which case Valgrind will output the suppression more than once, but you only need to have one copy in your suppression file (but having more than one @@ -1445,7 +1457,7 @@ will create a core dump in the usual way. make, make install mechanism, and we have attempted to ensure that it works on machines with kernel 2.4 or 2.6 and glibc -2.2.X to 2.5.X. Once you have completed +2.2.X to 2.9.X. Once you have completed make install you may then want to run the regression tests with make regtest.