diff options
author | dkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-16 20:00:40 +0000 |
---|---|---|
committer | dkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-16 20:00:40 +0000 |
commit | 386414b51924681ddd1735304ac9221921c9956d (patch) | |
tree | 7802d206b93a92e8d0aa27186b2d338b13c58a3e /tools | |
parent | b06612fa2e390c0727393f03863186ab6d01a1c8 (diff) | |
download | chromium_src-386414b51924681ddd1735304ac9221921c9956d.zip chromium_src-386414b51924681ddd1735304ac9221921c9956d.tar.gz chromium_src-386414b51924681ddd1735304ac9221921c9956d.tar.bz2 |
Valgrind doesn't have an option (yet) to put suppressions into its xml
output file, so generate them by hand, and always print them. Lets you
copy and paste from the bot into the suppressions file rather than having
to reproduce yourself, which is handy for hard-to-reproduce warnings.
BUG=none
TEST=watch the bot. See the suppressions.
Review URL: http://codereview.chromium.org/149762
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20887 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/valgrind/memcheck_analyze.py | 26 | ||||
-rwxr-xr-x | tools/valgrind/valgrind_test.py | 3 |
2 files changed, 24 insertions, 5 deletions
diff --git a/tools/valgrind/memcheck_analyze.py b/tools/valgrind/memcheck_analyze.py index a108d36..f5ddf35 100755 --- a/tools/valgrind/memcheck_analyze.py +++ b/tools/valgrind/memcheck_analyze.py @@ -10,6 +10,7 @@ import logging import optparse import os +import subprocess import sys import time from xml.dom.minidom import parse @@ -139,13 +140,25 @@ class ValgrindError: frames = None def __str__(self): - ''' Pretty print the type and backtrace(s) of this specific error.''' + ''' Pretty print the type and backtrace(s) of this specific error, + including suppression (which is just a mangled backtrace).''' output = self._kind + "\n" for backtrace in self._backtraces: output += backtrace[0] + "\n" + filter = subprocess.Popen("c++filt", stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + close_fds=True) + buf = "" for frame in backtrace[1]: - output += (" " + (frame[FUNCTION_NAME] or frame[INSTRUCTION_POINTER]) + - " (") + buf += (frame[FUNCTION_NAME] or frame[INSTRUCTION_POINTER]) + "\n" + (stdoutbuf, stderrbuf) = filter.communicate(buf.encode('latin-1')) + demangled_names = stdoutbuf.split("\n") + + i = 0 + for frame in backtrace[1]: + output += (" " + demangled_names[i] + " (") + i = i + 1 if frame[SRC_FILE_DIR] != "": output += (frame[SRC_FILE_DIR] + "/" + frame[SRC_FILE_NAME] + ":" + @@ -154,6 +167,10 @@ class ValgrindError: output += frame[OBJECT_FILE] output += ")\n" + output += "Suppression:\n" + for frame in backtrace[1]: + output += " fun:" + (frame[FUNCTION_NAME] or "*") + "\n" + return output def UniqueString(self): @@ -216,7 +233,8 @@ class MemcheckAnalyze: # Ignore "possible" leaks for now by default. if (show_all_leaks or getTextOf(raw_error, "kind") != "Leak_PossiblyLost"): - self._errors.add(ValgrindError(source_dir, raw_error)) + error = ValgrindError(source_dir, raw_error) + self._errors.add(error) except ExpatError, e: self._parse_failed = True logging.warn("could not parse %s: %s" % (file, e)) diff --git a/tools/valgrind/valgrind_test.py b/tools/valgrind/valgrind_test.py index c9e7e46..9409fcd 100755 --- a/tools/valgrind/valgrind_test.py +++ b/tools/valgrind/valgrind_test.py @@ -205,7 +205,8 @@ class ValgrindTool(object): proc = ["valgrind", "--tool=%s" % tool_name, "--smc-check=all", - "--num-callers=%i" % self._num_callers] + "--num-callers=%i" % self._num_callers, + "--demangle=no"] if self._options.trace_children: proc += ["--trace-children=yes"]; |