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

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

Issue 895853003: Update from https://crrev.com/314320 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env 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 # drmemory_analyze.py 6 # drmemory_analyze.py
7 7
8 ''' Given a Dr. Memory output file, parses errors and uniques them.''' 8 ''' Given a Dr. Memory output file, parses errors and uniques them.'''
9 9
10 from collections import defaultdict 10 from collections import defaultdict
(...skipping 22 matching lines...) Expand all
33 supp_lines[l] = "name=<insert_a_suppression_name_here>" 33 supp_lines[l] = "name=<insert_a_suppression_name_here>"
34 if supp_lines[l].startswith("chrome.dll!"): 34 if supp_lines[l].startswith("chrome.dll!"):
35 supp_lines[l] = supp_lines[l].replace("chrome.dll!", "*!") 35 supp_lines[l] = supp_lines[l].replace("chrome.dll!", "*!")
36 bang_index = supp_lines[l].find("!") 36 bang_index = supp_lines[l].find("!")
37 d_exe_index = supp_lines[l].find(".exe!") 37 d_exe_index = supp_lines[l].find(".exe!")
38 if bang_index >= 4 and d_exe_index + 4 == bang_index: 38 if bang_index >= 4 and d_exe_index + 4 == bang_index:
39 supp_lines[l] = "*" + supp_lines[l][bang_index:] 39 supp_lines[l] = "*" + supp_lines[l][bang_index:]
40 self._suppression = "\n".join(supp_lines) 40 self._suppression = "\n".join(supp_lines)
41 41
42 def __str__(self): 42 def __str__(self):
43 output = self._report + "\n" 43 output = ""
44 output += "### BEGIN MEMORY TOOL REPORT (error hash=#%016X#)\n" % \
45 self.ErrorHash()
46 output += self._report + "\n"
44 if self._testcase: 47 if self._testcase:
45 output += "The report came from the `%s` test.\n" % self._testcase 48 output += "The report came from the `%s` test.\n" % self._testcase
46 output += "Suppression (error hash=#%016X#):\n" % self.ErrorHash() 49 output += "Suppression (error hash=#%016X#):\n" % self.ErrorHash()
47 output += (" For more info on using suppressions see " 50 output += (" For more info on using suppressions see "
48 "http://dev.chromium.org/developers/how-tos/using-drmemory#TOC-Suppressi ng-error-reports-from-the-\n") 51 "http://dev.chromium.org/developers/how-tos/using-drmemory#TOC-Suppressi ng-error-reports-from-the-\n")
49 output += "{\n%s\n}\n" % self._suppression 52 output += "{\n%s\n}\n" % self._suppression
53 output += "### END MEMORY TOOL REPORT (error hash=#%016X#)\n" % \
54 self.ErrorHash()
50 return output 55 return output
51 56
52 # This is a device-independent hash identifying the suppression. 57 # This is a device-independent hash identifying the suppression.
53 # By printing out this hash we can find duplicate reports between tests and 58 # By printing out this hash we can find duplicate reports between tests and
54 # different shards running on multiple buildbots 59 # different shards running on multiple buildbots
55 def ErrorHash(self): 60 def ErrorHash(self):
56 return int(hashlib.md5(self._suppression).hexdigest()[:16], 16) 61 return int(hashlib.md5(self._suppression).hexdigest()[:16], 16)
57 62
58 def __hash__(self): 63 def __hash__(self):
59 return hash(self._suppression) 64 return hash(self._suppression)
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 if len(args) == 0: 193 if len(args) == 0:
189 parser.error("no filename specified") 194 parser.error("no filename specified")
190 filenames = args 195 filenames = args
191 196
192 logging.getLogger().setLevel(logging.INFO) 197 logging.getLogger().setLevel(logging.INFO)
193 return DrMemoryAnalyzer().Report(filenames, None, False) 198 return DrMemoryAnalyzer().Report(filenames, None, False)
194 199
195 200
196 if __name__ == '__main__': 201 if __name__ == '__main__':
197 sys.exit(main()) 202 sys.exit(main())
OLDNEW
« no previous file with comments | « tools/valgrind/drmemory/suppressions_full.txt ('k') | tools/valgrind/gtest_exclude/cc_unittests.gtest-drmemory.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698