OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 | 7 |
8 import collections | 8 import collections |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
11 import re | 11 import re |
12 import sys | 12 import sys |
13 | 13 |
| 14 from pylib import constants |
14 from pylib.constants import host_paths | 15 from pylib.constants import host_paths |
15 | 16 |
16 # Uses symbol.py from third_party/android_platform, not python's. | 17 # Uses symbol.py from third_party/android_platform, not python's. |
17 with host_paths.SysPath( | 18 with host_paths.SysPath( |
18 host_paths.ANDROID_PLATFORM_DEVELOPMENT_SCRIPTS_PATH, | 19 host_paths.ANDROID_PLATFORM_DEVELOPMENT_SCRIPTS_PATH, |
19 position=0): | 20 position=0): |
20 import symbol | 21 import symbol |
21 | 22 |
22 | 23 |
23 _RE_ASAN = re.compile(r'(.*?)(#\S*?) (\S*?) \((.*?)\+(.*?)\)') | 24 _RE_ASAN = re.compile(r'(.*?)(#\S*?) (\S*?) \((.*?)\+(.*?)\)') |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 print '%s%s %s %s' % (m['prefix'], m['pos'], s[0], s[1]) | 87 print '%s%s %s %s' % (m['prefix'], m['pos'], s[0], s[1]) |
87 else: | 88 else: |
88 print asan_log_line['raw_log'] | 89 print asan_log_line['raw_log'] |
89 | 90 |
90 | 91 |
91 def main(): | 92 def main(): |
92 parser = optparse.OptionParser() | 93 parser = optparse.OptionParser() |
93 parser.add_option('-l', '--logcat', | 94 parser.add_option('-l', '--logcat', |
94 help='File containing adb logcat output with ASan stacks. ' | 95 help='File containing adb logcat output with ASan stacks. ' |
95 'Use stdin if not specified.') | 96 'Use stdin if not specified.') |
| 97 parser.add_option('--output-directory', |
| 98 help='Path to the root build directory.') |
96 options, _ = parser.parse_args() | 99 options, _ = parser.parse_args() |
| 100 |
| 101 if options.output_directory: |
| 102 constants.SetOutputDirectory(options.output_directory) |
| 103 |
97 if options.logcat: | 104 if options.logcat: |
98 asan_input = file(options.logcat, 'r') | 105 asan_input = file(options.logcat, 'r') |
99 else: | 106 else: |
100 asan_input = sys.stdin | 107 asan_input = sys.stdin |
101 _Symbolize(asan_input.readlines()) | 108 _Symbolize(asan_input.readlines()) |
102 | 109 |
103 | 110 |
104 if __name__ == "__main__": | 111 if __name__ == "__main__": |
105 sys.exit(main()) | 112 sys.exit(main()) |
OLD | NEW |