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

Side by Side Diff: build/android/symbolize.py

Issue 727543003: [Android] Fix new pylint errors in build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 1 month 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
« no previous file with comments | « build/android/pylib/utils/report_results.py ('k') | 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/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
11 """ 11 """
12 12
13 import os 13 import os
14 import re 14 import re
15 import sys 15 import sys
16 16
17 from pylib import constants 17 from pylib import constants
18 18
19 # Uses symbol.py from third_party/android_platform, not python's. 19 # Uses symbol.py from third_party/android_platform, not python's.
20 sys.path.insert(0, 20 sys.path.insert(0,
21 os.path.join(constants.DIR_SOURCE_ROOT, 21 os.path.join(constants.DIR_SOURCE_ROOT,
22 'third_party/android_platform/development/scripts')) 22 'third_party/android_platform/development/scripts'))
23 import symbol 23 import symbol
24 24
25 # Sample output from base/debug/stack_trace_android.cc 25 # Sample output from base/debug/stack_trace_android.cc
26 #00 0x693cd34f /path/to/some/libfoo.so+0x0007434f 26 #00 0x693cd34f /path/to/some/libfoo.so+0x0007434f
27 TRACE_LINE = re.compile('(?P<frame>\#[0-9]+ 0x[0-9a-f]{8,8}) ' 27 TRACE_LINE = re.compile(r'(?P<frame>\#[0-9]+ 0x[0-9a-f]{8,8}) '
28 '(?P<lib>[^+]+)\+0x(?P<addr>[0-9a-f]{8,8})') 28 r'(?P<lib>[^+]+)\+0x(?P<addr>[0-9a-f]{8,8})')
29 29
30 class Symbolizer(object): 30 class Symbolizer(object):
31 def __init__(self, output): 31 def __init__(self, output):
32 self._output = output 32 self._output = output
33 33
34 def write(self, data): 34 def write(self, data):
35 while True: 35 while True:
36 match = re.search(TRACE_LINE, data) 36 match = re.search(TRACE_LINE, data)
37 if not match: 37 if not match:
38 self._output.write(data) 38 self._output.write(data)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 def main(): 80 def main():
81 symbolizer = Symbolizer(sys.stdout) 81 symbolizer = Symbolizer(sys.stdout)
82 for line in sys.stdin: 82 for line in sys.stdin:
83 symbolizer.write(line) 83 symbolizer.write(line)
84 symbolizer.flush() 84 symbolizer.flush()
85 85
86 86
87 if __name__ == '__main__': 87 if __name__ == '__main__':
88 main() 88 main()
OLDNEW
« no previous file with comments | « build/android/pylib/utils/report_results.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698