| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 print " --less-info" | 68 print " --less-info" |
| 69 print " Change the level of detail in the output." | 69 print " Change the level of detail in the output." |
| 70 print " --more-info is slower and more verbose, but more functions will" | 70 print " --more-info is slower and more verbose, but more functions will" |
| 71 print " be fully qualified with namespace/classname and have full" | 71 print " be fully qualified with namespace/classname and have full" |
| 72 print " argument information. Also, the 'stack data' section will be" | 72 print " argument information. Also, the 'stack data' section will be" |
| 73 print " printed." | 73 print " printed." |
| 74 print | 74 print |
| 75 print " --arch=arm|arm64|x64|x86|mips" | 75 print " --arch=arm|arm64|x64|x86|mips" |
| 76 print " the target architecture" | 76 print " the target architecture" |
| 77 print | 77 print |
| 78 print " --fallback-monochrome" |
| 79 print " fallback to monochrome instead of chrome if fail to detect" |
| 80 print " shared lib which is loaded from APK, this doesn't work for" |
| 81 print " component build." |
| 82 print |
| 78 print " --verbose" | 83 print " --verbose" |
| 79 print " enable extra logging, particularly for debugging failed symboliz
ation" | 84 print " enable extra logging, particularly for debugging failed symboliz
ation" |
| 80 print | 85 print |
| 81 print " FILE should contain a stack trace in it somewhere" | 86 print " FILE should contain a stack trace in it somewhere" |
| 82 print " the tool will find that and re-print it with" | 87 print " the tool will find that and re-print it with" |
| 83 print " source files and line numbers. If you don't" | 88 print " source files and line numbers. If you don't" |
| 84 print " pass FILE, or if file is -, it reads from" | 89 print " pass FILE, or if file is -, it reads from" |
| 85 print " stdin." | 90 print " stdin." |
| 86 print | 91 print |
| 87 # pylint: enable-msg=C6310 | 92 # pylint: enable-msg=C6310 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 options, arguments = getopt.getopt(argv, "", | 139 options, arguments = getopt.getopt(argv, "", |
| 135 ["packed-relocation-adjustments", | 140 ["packed-relocation-adjustments", |
| 136 "no-packed-relocation-adjustments", | 141 "no-packed-relocation-adjustments", |
| 137 "more-info", | 142 "more-info", |
| 138 "less-info", | 143 "less-info", |
| 139 "chrome-symbols-dir=", | 144 "chrome-symbols-dir=", |
| 140 "output-directory=", | 145 "output-directory=", |
| 141 "symbols-dir=", | 146 "symbols-dir=", |
| 142 "symbols-zip=", | 147 "symbols-zip=", |
| 143 "arch=", | 148 "arch=", |
| 149 "fallback-monochrome", |
| 144 "verbose", | 150 "verbose", |
| 145 "help"]) | 151 "help"]) |
| 146 except getopt.GetoptError, unused_error: | 152 except getopt.GetoptError, unused_error: |
| 147 PrintUsage() | 153 PrintUsage() |
| 148 | 154 |
| 149 zip_arg = None | 155 zip_arg = None |
| 150 more_info = False | 156 more_info = False |
| 151 packed_relocation_adjustments = "unknown" | 157 packed_relocation_adjustments = "unknown" |
| 158 fallback_monochrome = False |
| 159 arch_defined = False |
| 152 for option, value in options: | 160 for option, value in options: |
| 153 if option == "--help": | 161 if option == "--help": |
| 154 PrintUsage() | 162 PrintUsage() |
| 155 elif option == "--symbols-dir": | 163 elif option == "--symbols-dir": |
| 156 symbol.SYMBOLS_DIR = os.path.expanduser(value) | 164 symbol.SYMBOLS_DIR = os.path.expanduser(value) |
| 157 elif option == "--symbols-zip": | 165 elif option == "--symbols-zip": |
| 158 zip_arg = os.path.expanduser(value) | 166 zip_arg = os.path.expanduser(value) |
| 159 elif option == "--arch": | 167 elif option == "--arch": |
| 160 symbol.ARCH = value | 168 symbol.ARCH = value |
| 169 arch_defined = True |
| 161 elif option == "--chrome-symbols-dir": | 170 elif option == "--chrome-symbols-dir": |
| 162 symbol.CHROME_SYMBOLS_DIR = os.path.join(symbol.CHROME_SRC, value) | 171 symbol.CHROME_SYMBOLS_DIR = os.path.join(symbol.CHROME_SRC, value) |
| 163 elif option == "--output-directory": | 172 elif option == "--output-directory": |
| 164 constants.SetOutputDirectory(value) | 173 constants.SetOutputDirectory(value) |
| 165 elif option == "--packed-relocation-adjustments": | 174 elif option == "--packed-relocation-adjustments": |
| 166 packed_relocation_adjustments = True | 175 packed_relocation_adjustments = True |
| 167 elif option == "--no-packed-relocation-adjustments": | 176 elif option == "--no-packed-relocation-adjustments": |
| 168 packed_relocation_adjustments = False | 177 packed_relocation_adjustments = False |
| 169 elif option == "--more-info": | 178 elif option == "--more-info": |
| 170 more_info = True | 179 more_info = True |
| 171 elif option == "--less-info": | 180 elif option == "--less-info": |
| 172 more_info = False | 181 more_info = False |
| 182 elif option == "--fallback-monochrome": |
| 183 fallback_monochrome = True |
| 173 elif option == "--verbose": | 184 elif option == "--verbose": |
| 174 logging.basicConfig(level=logging.DEBUG) | 185 logging.basicConfig(level=logging.DEBUG) |
| 175 | 186 |
| 176 if len(arguments) > 1: | 187 if len(arguments) > 1: |
| 177 PrintUsage() | 188 PrintUsage() |
| 178 | 189 |
| 179 # Do an up-front test that the output directory is known. | 190 # Do an up-front test that the output directory is known. |
| 180 if not symbol.CHROME_SYMBOLS_DIR: | 191 if not symbol.CHROME_SYMBOLS_DIR: |
| 181 constants.CheckOutputDirectory() | 192 constants.CheckOutputDirectory() |
| 182 | 193 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 stripped_libs_dir = constants.GetOutDirectory() | 225 stripped_libs_dir = constants.GetOutDirectory() |
| 215 load_vaddrs = stack_libs.GetLoadVaddrs(stripped_libs_dir) | 226 load_vaddrs = stack_libs.GetLoadVaddrs(stripped_libs_dir) |
| 216 else: | 227 else: |
| 217 load_vaddrs = {} | 228 load_vaddrs = {} |
| 218 | 229 |
| 219 print ("Reading Android symbols from: " | 230 print ("Reading Android symbols from: " |
| 220 + os.path.normpath(symbol.SYMBOLS_DIR)) | 231 + os.path.normpath(symbol.SYMBOLS_DIR)) |
| 221 chrome_search_path = symbol.GetLibrarySearchPaths() | 232 chrome_search_path = symbol.GetLibrarySearchPaths() |
| 222 print ("Searching for Chrome symbols from within: " | 233 print ("Searching for Chrome symbols from within: " |
| 223 + ':'.join((os.path.normpath(d) for d in chrome_search_path))) | 234 + ':'.join((os.path.normpath(d) for d in chrome_search_path))) |
| 224 stack_core.ConvertTrace(lines, load_vaddrs, more_info) | 235 stack_core.ConvertTrace(lines, load_vaddrs, more_info, fallback_monochrome, |
| 236 arch_defined) |
| 225 | 237 |
| 226 if rootdir: | 238 if rootdir: |
| 227 # be a good citizen and clean up...os.rmdir and os.removedirs() don't work | 239 # be a good citizen and clean up...os.rmdir and os.removedirs() don't work |
| 228 cmd = "rm -rf \"%s\"" % rootdir | 240 cmd = "rm -rf \"%s\"" % rootdir |
| 229 print "\ncleaning up (%s)" % cmd | 241 print "\ncleaning up (%s)" % cmd |
| 230 os.system(cmd) | 242 os.system(cmd) |
| 231 | 243 |
| 232 if __name__ == "__main__": | 244 if __name__ == "__main__": |
| 233 sys.exit(main(sys.argv[1:])) | 245 sys.exit(main(sys.argv[1:])) |
| 234 | 246 |
| 235 # vi: ts=2 sw=2 | 247 # vi: ts=2 sw=2 |
| OLD | NEW |