OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (C) 2013 The Android Open Source Project | 3 # Copyright (C) 2013 The Android Open Source Project |
4 # | 4 # |
5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
6 # you may not use this file except in compliance with 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 | 7 # You may obtain a copy of the License at |
8 # | 8 # |
9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
10 # | 10 # |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 for option, value in options: | 131 for option, value in options: |
132 if option == "--help": | 132 if option == "--help": |
133 PrintUsage() | 133 PrintUsage() |
134 elif option == "--symbols-dir": | 134 elif option == "--symbols-dir": |
135 symbol.SYMBOLS_DIR = os.path.expanduser(value) | 135 symbol.SYMBOLS_DIR = os.path.expanduser(value) |
136 elif option == "--symbols-zip": | 136 elif option == "--symbols-zip": |
137 zip_arg = os.path.expanduser(value) | 137 zip_arg = os.path.expanduser(value) |
138 elif option == "--arch": | 138 elif option == "--arch": |
139 symbol.ARCH = value | 139 symbol.ARCH = value |
140 elif option == "--chrome-symbols-dir": | 140 elif option == "--chrome-symbols-dir": |
141 symbol.CHROME_SYMBOLS_DIR = os.path.join(symbol.CHROME_SYMBOLS_DIR, value) | 141 symbol.CHROME_SYMBOLS_DIR = os.path.join(symbol.CHROME_SRC, value) |
142 elif option == "--more-info": | 142 elif option == "--more-info": |
143 more_info = True | 143 more_info = True |
144 elif option == "--less-info": | 144 elif option == "--less-info": |
145 more_info = False | 145 more_info = False |
146 elif option == "--verbose": | 146 elif option == "--verbose": |
147 logging.basicConfig(level=logging.DEBUG) | 147 logging.basicConfig(level=logging.DEBUG) |
148 | 148 |
149 if len(arguments) > 1: | 149 if len(arguments) > 1: |
150 PrintUsage() | 150 PrintUsage() |
151 | 151 |
152 if not arguments or arguments[0] == "-": | 152 if not arguments or arguments[0] == "-": |
153 print "Reading native crash info from stdin" | 153 print "Reading native crash info from stdin" |
154 f = sys.stdin | 154 f = sys.stdin |
155 else: | 155 else: |
156 print "Searching for native crashes in %s" % arguments[0] | 156 print "Searching for native crashes in %s" % arguments[0] |
157 f = open(arguments[0], "r") | 157 f = open(arguments[0], "r") |
158 | 158 |
159 lines = f.readlines() | 159 lines = f.readlines() |
160 f.close() | 160 f.close() |
161 | 161 |
162 rootdir = None | 162 rootdir = None |
163 if zip_arg: | 163 if zip_arg: |
164 rootdir, symbol.SYMBOLS_DIR = UnzipSymbols(zip_arg) | 164 rootdir, symbol.SYMBOLS_DIR = UnzipSymbols(zip_arg) |
165 | 165 |
166 print "Reading Android symbols from", symbol.SYMBOLS_DIR | 166 print "Reading Android symbols from", symbol.SYMBOLS_DIR |
167 print "Reading Chrome symbols from", symbol.CHROME_SYMBOLS_DIR | 167 chrome_search_path = symbol.GetLibrarySearchPaths() |
| 168 print "Searching for Chrome symbols from within", ':'.join(chrome_search_path) |
168 stack_core.ConvertTrace(lines, more_info) | 169 stack_core.ConvertTrace(lines, more_info) |
169 | 170 |
170 if rootdir: | 171 if rootdir: |
171 # be a good citizen and clean up...os.rmdir and os.removedirs() don't work | 172 # be a good citizen and clean up...os.rmdir and os.removedirs() don't work |
172 cmd = "rm -rf \"%s\"" % rootdir | 173 cmd = "rm -rf \"%s\"" % rootdir |
173 print "\ncleaning up (%s)" % cmd | 174 print "\ncleaning up (%s)" % cmd |
174 os.system(cmd) | 175 os.system(cmd) |
175 | 176 |
176 if __name__ == "__main__": | 177 if __name__ == "__main__": |
177 sys.exit(main(sys.argv[1:])) | 178 sys.exit(main(sys.argv[1:])) |
178 | 179 |
179 # vi: ts=2 sw=2 | 180 # vi: ts=2 sw=2 |
OLD | NEW |