Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: tools/valgrind/tsan_analyze.py

Issue 3156050: tsan_analyze.py now assumes that all ThreadSanitizer reports contain VIM fold... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2008 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
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 binary, ip = match.groups() 76 binary, ip = match.groups()
77 TheAddressTable.AddBinaryAt(binary, ip) 77 TheAddressTable.AddBinaryAt(binary, ip)
78 return 78 return
79 match = TsanAnalyzer.TSAN_LINE_RE.match(self.line_) 79 match = TsanAnalyzer.TSAN_LINE_RE.match(self.line_)
80 if match: 80 if match:
81 address, binary_name = match.groups() 81 address, binary_name = match.groups()
82 stack_trace_line = _StackTraceLine(self.line_, address, binary_name) 82 stack_trace_line = _StackTraceLine(self.line_, address, binary_name)
83 TheAddressTable.Add(stack_trace_line.binary, stack_trace_line.address) 83 TheAddressTable.Add(stack_trace_line.binary, stack_trace_line.address)
84 self.stack_trace_line_ = stack_trace_line 84 self.stack_trace_line_ = stack_trace_line
85 85
86 # TODO(glider): merge Read*Section once TSan is fixed to print {{{ and }}} 86 def ReadSection(self):
87 # around all reports.
88 def ReadRaceSection(self):
89 result = [self.line_] 87 result = [self.line_]
90 if re.search("{{{", self.line_): 88 if re.search("{{{", self.line_):
91 while not re.search('}}}', self.line_): 89 while not re.search('}}}', self.line_):
92 self.ReadLine() 90 self.ReadLine()
93 if self.stack_trace_line_ is None: 91 if self.stack_trace_line_ is None:
94 result.append(self.line_) 92 result.append(self.line_)
95 else: 93 else:
96 result.append(self.stack_trace_line_) 94 result.append(self.stack_trace_line_)
97 return result 95 return result
98 96
99 def ReadWarningSection(self):
100 result = [self.line_]
101 self.ReadLine()
102 while TsanAnalyzer.TSAN_WARNING_LINE_RE.match(self.line_):
103 self.ReadLine()
104 if self.stack_trace_line_ is None:
105 result.append(self.line_)
106 else:
107 result.append(self.stack_trace_line_)
108 return result
109
110
111 def ParseReportFile(self, filename): 97 def ParseReportFile(self, filename):
112 self.cur_fd_ = open(filename, 'r') 98 self.cur_fd_ = open(filename, 'r')
113 99
114 while True: 100 while True:
115 # Read ThreadSanitizer reports. 101 # Read ThreadSanitizer reports.
116 self.ReadLine() 102 self.ReadLine()
117 if (self.line_ == ''): 103 if (self.line_ == ''):
118 break 104 break
119 105
120 tmp = [] 106 tmp = []
121 while re.search(TsanAnalyzer.THREAD_CREATION_STR, self.line_): 107 while re.search(TsanAnalyzer.THREAD_CREATION_STR, self.line_):
122 # TODO(glider): that's not really a race section but rather an {{{...}}} 108 tmp.extend(self.ReadSection())
123 # but use this wrong name to quick-fix the script.
124 tmp.extend(self.ReadRaceSection())
125 self.ReadLine() 109 self.ReadLine()
126 if re.search(TsanAnalyzer.TSAN_RACE_DESCRIPTION, self.line_): 110 if re.search(TsanAnalyzer.TSAN_RACE_DESCRIPTION, self.line_):
127 tmp.extend(self.ReadRaceSection()) 111 tmp.extend(self.ReadSection())
128 self.reports.append(tmp) 112 self.reports.append(tmp)
129 if (re.search(TsanAnalyzer.TSAN_WARNING_DESCRIPTION, self.line_) and 113 if (re.search(TsanAnalyzer.TSAN_WARNING_DESCRIPTION, self.line_) and
130 not common.IsWindows()): # workaround for http://crbug.com/53198 114 not common.IsWindows()): # workaround for http://crbug.com/53198
131 tmp.extend(self.ReadWarningSection()) 115 tmp.extend(self.ReadSection())
132 self.reports.append(tmp) 116 self.reports.append(tmp)
133 117
134 match = re.search(" used_suppression:\s+([0-9]+)\s(.*)", self.line_) 118 match = re.search(" used_suppression:\s+([0-9]+)\s(.*)", self.line_)
135 if match: 119 if match:
136 count, supp_name = match.groups() 120 count, supp_name = match.groups()
137 count = int(count) 121 count = int(count)
138 if supp_name in self.used_suppressions: 122 if supp_name in self.used_suppressions:
139 self.used_suppressions[supp_name] += count 123 self.used_suppressions[supp_name] += count
140 else: 124 else:
141 self.used_suppressions[supp_name] = count 125 self.used_suppressions[supp_name] = count
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 186
203 (options, args) = parser.parse_args() 187 (options, args) = parser.parse_args()
204 if len(args) == 0: 188 if len(args) == 0:
205 parser.error("no filename specified") 189 parser.error("no filename specified")
206 filenames = args 190 filenames = args
207 191
208 analyzer = TsanAnalyzer(options.source_dir, use_gdb=True) 192 analyzer = TsanAnalyzer(options.source_dir, use_gdb=True)
209 retcode = analyzer.Report(filenames) 193 retcode = analyzer.Report(filenames)
210 194
211 sys.exit(retcode) 195 sys.exit(retcode)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698