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 """Symbolizes stack traces generated by Chromium for Android. | 7 """Symbolizes stack traces generated by Chromium for Android. |
8 | 8 |
9 Sample usage: | 9 Sample usage: |
10 adb logcat chromium:V | symbolize.py | 10 adb logcat chromium:V | symbolize.py |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 # calling out to addr2line each time. | 48 # calling out to addr2line each time. |
49 # 2) Have Python keep multiple addr2line instances open as subprocesses, | 49 # 2) Have Python keep multiple addr2line instances open as subprocesses, |
50 # piping addresses and reading back symbols as we find them | 50 # piping addresses and reading back symbols as we find them |
51 # 3) Read ahead the entire stack trace until we find no more, then batch | 51 # 3) Read ahead the entire stack trace until we find no more, then batch |
52 # the symbol lookups. | 52 # the symbol lookups. |
53 # | 53 # |
54 # TODO(scherkus): These results are memoized, which could result in | 54 # TODO(scherkus): These results are memoized, which could result in |
55 # incorrect lookups when running this script on long-lived instances | 55 # incorrect lookups when running this script on long-lived instances |
56 # (e.g., adb logcat) when doing incremental development. Consider clearing | 56 # (e.g., adb logcat) when doing incremental development. Consider clearing |
57 # the cache when modification timestamp of libraries change. | 57 # the cache when modification timestamp of libraries change. |
| 58 # pylint: disable=no-member |
58 sym = symbol.SymbolInformation(lib, addr, False)[0][0] | 59 sym = symbol.SymbolInformation(lib, addr, False)[0][0] |
59 | 60 |
60 if not sym: | 61 if not sym: |
61 post = match.end('addr') | 62 post = match.end('addr') |
62 self._output.write(data[:post]) | 63 self._output.write(data[:post]) |
63 data = data[post:] | 64 data = data[post:] |
64 continue | 65 continue |
65 | 66 |
66 pre = match.start('frame') | 67 pre = match.start('frame') |
67 post = match.end('addr') | 68 post = match.end('addr') |
(...skipping 11 matching lines...) Expand all Loading... |
79 | 80 |
80 def main(): | 81 def main(): |
81 symbolizer = Symbolizer(sys.stdout) | 82 symbolizer = Symbolizer(sys.stdout) |
82 for line in sys.stdin: | 83 for line in sys.stdin: |
83 symbolizer.write(line) | 84 symbolizer.write(line) |
84 symbolizer.flush() | 85 symbolizer.flush() |
85 | 86 |
86 | 87 |
87 if __name__ == '__main__': | 88 if __name__ == '__main__': |
88 main() | 89 main() |
OLD | NEW |