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

Side by Side Diff: third_party/android_platform/development/scripts/stack

Issue 18326020: Android: adds a few third-party scripts for stack symbolization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright (C) 2013 The Android Open Source Project
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 """stack symbolizes native crash dumps."""
18
19 import getopt
20 import sys
21
22 import stack_core
23 import symbol
24
25
26 def PrintUsage():
27 """Print usage and exit with error."""
28 # pylint: disable-msg=C6310
29 print
30 print " usage: " + sys.argv[0] + " [options] [FILE]"
31 print
32 print " --arch=arm|x86"
33 print " the target architecture"
34 print
35 print " FILE should contain a stack trace in it somewhere"
36 print " the tool will find that and re-print it with"
37 print " source files and line numbers. If you don't"
38 print " pass FILE, or if file is -, it reads from"
39 print " stdin."
40 print
41 # pylint: enable-msg=C6310
42 sys.exit(1)
43
44
45 def main():
46 try:
47 options, arguments = getopt.getopt(sys.argv[1:], "",
48 ["arch=",
49 "help"])
50 except getopt.GetoptError, unused_error:
51 PrintUsage()
52
53 for option, value in options:
54 if option == "--help":
55 PrintUsage()
56 elif option == "--arch":
57 symbol.ARCH = value
58
59 if len(arguments) > 1:
60 PrintUsage()
61
62 if not arguments or arguments[0] == "-":
63 print "Reading native crash info from stdin"
64 f = sys.stdin
65 else:
66 print "Searching for native crashes in %s" % arguments[0]
67 f = open(arguments[0], "r")
68
69 lines = f.readlines()
70 f.close()
71
72 print "Reading symbols from", symbol.SYMBOLS_DIR
73 stack_core.ConvertTrace(lines)
74
75 if __name__ == "__main__":
76 main()
77
78 # vi: ts=2 sw=2
OLDNEW
« no previous file with comments | « third_party/android_platform/README.chromium ('k') | third_party/android_platform/development/scripts/stack_core.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698