OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # tsan_analyze.py | 6 # tsan_analyze.py |
7 | 7 |
8 ''' Given a ThreadSanitizer output file, parses errors and uniques them.''' | 8 ''' Given a ThreadSanitizer output file, parses errors and uniques them.''' |
9 | 9 |
10 import gdb_helper | 10 import gdb_helper |
11 | 11 |
12 import common | 12 import common |
| 13 import hashlib |
13 import logging | 14 import logging |
14 import optparse | 15 import optparse |
15 import os | 16 import os |
16 import re | 17 import re |
17 import subprocess | 18 import subprocess |
18 import sys | 19 import sys |
19 import time | 20 import time |
20 | 21 |
21 # Global symbol table (ugh) | 22 # Global symbol table (ugh) |
22 TheAddressTable = None | 23 TheAddressTable = None |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 result = [self.line_] | 106 result = [self.line_] |
106 if re.search("{{{", self.line_): | 107 if re.search("{{{", self.line_): |
107 while not re.search('}}}', self.line_): | 108 while not re.search('}}}', self.line_): |
108 self.ReadLine() | 109 self.ReadLine() |
109 if self.stack_trace_line_ is None: | 110 if self.stack_trace_line_ is None: |
110 result.append(self.line_) | 111 result.append(self.line_) |
111 else: | 112 else: |
112 result.append(self.stack_trace_line_) | 113 result.append(self.stack_trace_line_) |
113 self.ReadLine() | 114 self.ReadLine() |
114 if re.match('-+ suppression -+', self.line_): | 115 if re.match('-+ suppression -+', self.line_): |
115 result.append(self.line_) | 116 # We need to calculate the suppression hash and prepend a line like |
| 117 # "Suppression (error hash=#0123456789ABCDEF#):" so the buildbot can |
| 118 # extract the suppression snippet. |
| 119 supp = "" |
116 while not re.match('-+ end suppression -+', self.line_): | 120 while not re.match('-+ end suppression -+', self.line_): |
117 self.ReadLine() | 121 self.ReadLine() |
118 result.append(self.line_) | 122 supp += self.line_ |
119 self.ReadLine() | 123 self.ReadLine() |
| 124 result.append("Suppression (error hash=#%016X#):\n" % \ |
| 125 (int(hashlib.md5(supp).hexdigest()[:16], 16))) |
| 126 result.append(" For more info on using suppressions see " |
| 127 "http://dev.chromium.org/developers/how-tos/using-valgrind/threadsan
itizer#TOC-Suppressing-data-races\n") |
| 128 result.append(supp) |
120 else: | 129 else: |
121 self.ReadLine() | 130 self.ReadLine() |
122 | 131 |
123 return result | 132 return result |
124 | 133 |
125 def ReadTillTheEnd(self): | 134 def ReadTillTheEnd(self): |
126 result = [self.line_] | 135 result = [self.line_] |
127 while self.line_: | 136 while self.line_: |
128 self.ReadLine() | 137 self.ReadLine() |
129 result.append(self.line_) | 138 result.append(self.line_) |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 261 |
253 (options, args) = parser.parse_args() | 262 (options, args) = parser.parse_args() |
254 if not args: | 263 if not args: |
255 parser.error("no filename specified") | 264 parser.error("no filename specified") |
256 filenames = args | 265 filenames = args |
257 | 266 |
258 analyzer = TsanAnalyzer(options.source_dir, use_gdb=True) | 267 analyzer = TsanAnalyzer(options.source_dir, use_gdb=True) |
259 retcode = analyzer.Report(filenames) | 268 retcode = analyzer.Report(filenames) |
260 | 269 |
261 sys.exit(retcode) | 270 sys.exit(retcode) |
OLD | NEW |