Commit e4e3caed authored by dkegel@google.com's avatar dkegel@google.com

Resubmit suppression count report patch, but this time don't crash if that...

Resubmit suppression count report patch, but this time don't crash if that section of the xml file is missing/empty

Review URL: http://codereview.chromium.org/203018

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25876 0039d316-1c4b-4281-b951-d872f2087c98
parent dea35348
...@@ -248,12 +248,6 @@ class ValgrindError: ...@@ -248,12 +248,6 @@ class ValgrindError:
# </frame> # </frame>
# although the dir, file, and line elements are missing if there is # although the dir, file, and line elements are missing if there is
# no debug info. # no debug info.
#
# With our patch for https://bugs.kde.org/show_bug.cgi?id=205000 in,
# the file also includes records of the form
# <load_obj><obj>/usr/lib/libgcc_s.1.dylib</obj><ip>0x27000</ip></load_obj>
# giving the filename and load address of each binary that was mapped
# into the process.
self._kind = getTextOf(error_node, "kind") self._kind = getTextOf(error_node, "kind")
self._backtraces = [] self._backtraces = []
...@@ -378,10 +372,31 @@ class MemcheckAnalyze: ...@@ -378,10 +372,31 @@ class MemcheckAnalyze:
show_all_leaks: whether to show even less important leaks show_all_leaks: whether to show even less important leaks
''' '''
# Beyond the detailed errors parsed by ValgrindError above,
# the xml file contain records describing suppressions that were used:
# <suppcounts>
# <pair>
# <count>28</count>
# <name>pango_font_leak_todo</name>
# </pair>
# <pair>
# <count>378</count>
# <name>bug_13243</name>
# </pair>
# </suppcounts
# Collect these and print them at the end.
#
# With our patch for https://bugs.kde.org/show_bug.cgi?id=205000 in,
# the file also includes records of the form
# <load_obj><obj>/usr/lib/libgcc_s.1.dylib</obj><ip>0x27000</ip></load_obj>
# giving the filename and load address of each binary that was mapped
# into the process.
global TheAddressTable global TheAddressTable
if use_gdb: if use_gdb:
TheAddressTable = _AddressTable() TheAddressTable = _AddressTable()
self._errors = set() self._errors = set()
self._suppcounts = {}
badfiles = set() badfiles = set()
start = time.time() start = time.time()
self._parse_failed = False self._parse_failed = False
...@@ -449,6 +464,17 @@ class MemcheckAnalyze: ...@@ -449,6 +464,17 @@ class MemcheckAnalyze:
error = ValgrindError(source_dir, raw_error, commandline) error = ValgrindError(source_dir, raw_error, commandline)
self._errors.add(error) self._errors.add(error)
suppcountlist = parsed_file.getElementsByTagName("suppcounts")
if len(suppcountlist) > 0:
suppcountlist = suppcountlist[0]
for node in suppcountlist.getElementsByTagName("pair"):
count = getTextOf(node, "count");
name = getTextOf(node, "name");
if name in self._suppcounts:
self._suppcounts[name] += int(count)
else:
self._suppcounts[name] = int(count)
if len(badfiles) > 0: if len(badfiles) > 0:
logging.warn("valgrind didn't finish writing %d files?!" % len(badfiles)) logging.warn("valgrind didn't finish writing %d files?!" % len(badfiles))
for file in badfiles: for file in badfiles:
...@@ -460,6 +486,13 @@ class MemcheckAnalyze: ...@@ -460,6 +486,13 @@ class MemcheckAnalyze:
logging.error("FAIL! Couldn't parse Valgrind output file") logging.error("FAIL! Couldn't parse Valgrind output file")
return -2 return -2
print "-----------------------------------------------------"
print "Suppressions used:"
print " count name"
for item in sorted(self._suppcounts.items(), key=lambda (k,v): (v,k)):
print "%7s %s" % (item[1], item[0])
print "-----------------------------------------------------"
if self._errors: if self._errors:
logging.error("FAIL! There were %s errors: " % len(self._errors)) logging.error("FAIL! There were %s errors: " % len(self._errors))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment