summaryrefslogtreecommitdiffstats
path: root/tools/valgrind/memcheck_analyze.py
diff options
context:
space:
mode:
authordkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-16 20:00:40 +0000
committerdkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-16 20:00:40 +0000
commit386414b51924681ddd1735304ac9221921c9956d (patch)
tree7802d206b93a92e8d0aa27186b2d338b13c58a3e /tools/valgrind/memcheck_analyze.py
parentb06612fa2e390c0727393f03863186ab6d01a1c8 (diff)
downloadchromium_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/valgrind/memcheck_analyze.py')
-rwxr-xr-xtools/valgrind/memcheck_analyze.py26
1 files changed, 22 insertions, 4 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))