summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-26 17:43:38 +0000
committertimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-26 17:43:38 +0000
commitcaa12cbeb461f79a4f8a5894fe80857e4d274fe4 (patch)
treeeff924c3dfbf92a3db191b7bc5c4f6f9969bc896
parent9522228ea5ca6d44ebd8185f0a9606eb5a0576fe (diff)
downloadchromium_src-caa12cbeb461f79a4f8a5894fe80857e4d274fe4.zip
chromium_src-caa12cbeb461f79a4f8a5894fe80857e4d274fe4.tar.gz
chromium_src-caa12cbeb461f79a4f8a5894fe80857e4d274fe4.tar.bz2
Better output format in drmemory_analyze.py
Fixed a few style nits found in this file noted in Alexander's comments at http://codereview.chromium.org/2455001/show Review URL: http://codereview.chromium.org/3047015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53635 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-xtools/valgrind/drmemory_analyze.py36
-rwxr-xr-xtools/valgrind/memcheck_analyze.py2
-rw-r--r--tools/valgrind/tsan_analyze.py2
3 files changed, 21 insertions, 19 deletions
diff --git a/tools/valgrind/drmemory_analyze.py b/tools/valgrind/drmemory_analyze.py
index d06449b..c6046e9 100755
--- a/tools/valgrind/drmemory_analyze.py
+++ b/tools/valgrind/drmemory_analyze.py
@@ -56,33 +56,36 @@ class DrMemoryAnalyze:
cnt = 1
while len(self.line_.strip()) > 0:
tmp_line = self.line_
- match1 = re.search("system call (.*)\n", tmp_line)
- if match1:
- result.append(" #%2i <sys.call> %s\n" % (cnt, match1.groups()[0]))
+ match_syscall = re.search("system call (.*)\n", tmp_line)
+ if match_syscall:
+ syscall_name = match_syscall.groups()[0]
+ result.append(" #%2i <sys.call> %s\n" % (cnt, syscall_name))
cnt = cnt + 1
self.ReadLine() # skip "<system call> line
self.ReadLine()
continue
- match1 = re.search("(0x[0-9a-fA-F]+) <.*> (.*)!([^+]*)"
- "(?:\+0x[0-9a-fA-F]+)?\n", tmp_line)
+
+ match_binary_fname = re.search("(0x[0-9a-fA-F]+) <.*> (.*)!([^+]*)"
+ "(?:\+0x[0-9a-fA-F]+)?\n", tmp_line)
self.ReadLine()
- match2 = re.search("\s*(.*):([0-9]+)(?:\+0x[0-9a-fA-F]+)?", self.line_)
- if match2:
+ match_src_line = re.search("\s*(.*):([0-9]+)(?:\+0x[0-9a-fA-F]+)?",
+ self.line_)
+ if match_src_line:
self.ReadLine()
- if match1:
- pc, binary, fname = match1.groups()
+ if match_binary_fname:
+ pc, binary, fname = match_binary_fname.groups()
if re.search(CUT_STACK_BELOW, fname):
break
- src, lineno = match2.groups()
- binary_fname = "%s!%s" % (binary, fname)
- report_line = (" #%2i %s %s" % (cnt, pc, binary_fname))
+ report_line = (" #%2i %s %-50s" % (cnt, pc, fname))
+ if not re.search("\.exe$", binary):
+ # Print the DLL name
+ report_line += " " + binary
+ src, lineno = match_src_line.groups()
if src != "??":
for pat in FILE_PREFIXES_TO_CUT:
idx = src.rfind(pat)
if idx != -1:
src = src[idx+len(pat):]
- if (len(binary_fname) < 40):
- report_line += " " * (40 - len(binary_fname))
report_line += " " + src
if int(lineno) != 0:
report_line += ":%i" % int(lineno)
@@ -97,11 +100,9 @@ class DrMemoryAnalyze:
self.ReadLine()
if (self.line_ == ''):
break
-
if re.search("Grouping errors that", self.line_):
# DrMemory has finished working.
break
-
tmp = []
match = re.search("Error #[0-9]+: (.*)", self.line_)
if match:
@@ -124,6 +125,7 @@ class DrMemoryAnalyze:
for line in report_list:
report += str(line)
logging.error('\n' + report)
+ logging.error("Total: %i error reports" % len(self.reports))
return -1
logging.info("PASS: No error reports found")
return 0
@@ -137,7 +139,7 @@ if __name__ == '__main__':
"(used to normalize source paths in baseline)")
(options, args) = parser.parse_args()
- if not len(args) >= 1:
+ if len(args) == 0:
parser.error("no filename specified")
filenames = args
diff --git a/tools/valgrind/memcheck_analyze.py b/tools/valgrind/memcheck_analyze.py
index 7388de1..32ac22e8 100755
--- a/tools/valgrind/memcheck_analyze.py
+++ b/tools/valgrind/memcheck_analyze.py
@@ -559,7 +559,7 @@ def _main():
"(used to normalize source paths in baseline)")
(options, args) = parser.parse_args()
- if not len(args) >= 1:
+ if len(args) == 0:
parser.error("no filename specified")
filenames = args
diff --git a/tools/valgrind/tsan_analyze.py b/tools/valgrind/tsan_analyze.py
index eb0887a..ea19285 100644
--- a/tools/valgrind/tsan_analyze.py
+++ b/tools/valgrind/tsan_analyze.py
@@ -164,7 +164,7 @@ if __name__ == '__main__':
"(used to normalize source paths in baseline)")
(options, args) = parser.parse_args()
- if not len(args) >= 1:
+ if len(args) == 0:
parser.error("no filename specified")
filenames = args