Chromium Code Reviews| Index: third_party/android_platform/development/scripts/stack |
| diff --git a/third_party/android_platform/development/scripts/stack b/third_party/android_platform/development/scripts/stack |
| index c5a56c61e031fd1ba226ea958e3ce20cc9d9fba1..745ebaf3b0a1be5343319998196bb8ae0aa7062c 100755 |
| --- a/third_party/android_platform/development/scripts/stack |
| +++ b/third_party/android_platform/development/scripts/stack |
| @@ -23,11 +23,13 @@ import os |
| import sys |
| import stack_core |
| +import stack_libs |
| import subprocess |
| import symbol |
| import sys |
| DEFAULT_SYMROOT='/tmp/symbols' |
| +DEFAULT_APK='chrome_apk' |
| def PrintUsage(): |
| """Print usage and exit with error.""" |
| @@ -44,6 +46,20 @@ def PrintUsage(): |
| print " If not specified, will look for the newest lib in out/Debug or" |
| print " out/Release" |
| + print " --packed-relocation-adjustments" |
| + print " --no-packed-relocation-adjustments" |
| + print " turn packed relocation adjustment on and off (default is off)" |
| + print " If running on pre-M Android and the stack trace appears to" |
| + print " make no sense, try turning this feature on." |
| + print " --chrome-apk-dir=path" |
| + print " the path to the APK staging dir (can be absolute or relative" |
| + print " to src), such as =out/Debug/chrome_apk" |
| + print " If not specified, uses =|chrome-symbols-dir|/../chrome_apk" |
| + print " Parses libraries here to find data for adjusting debuggerd" |
| + print " tombstones where relocations are packed." |
| + print " Enable/disable with --[no-]packed-relocation-adjustments." |
| print " --symbols-zip=path" |
| print " the path to a symbols zip file, such as =dream-symbols-12345.zip" |
| @@ -115,9 +131,12 @@ def UnzipSymbols(symbolfile, symdir=None): |
| def main(argv): |
| try: |
| options, arguments = getopt.getopt(argv, "", |
| - ["more-info", |
| + ["packed-relocation-adjustments", |
| + "no-packed-relocation-adjustments", |
|
rmcilroy
2015/10/23 16:25:10
Do we really need no-packed-relocation-adjustments
simonb (inactive)
2015/10/26 12:38:31
We don't *need* it. It's here for symmetry with th
rmcilroy
2015/10/26 16:42:17
I'm not convinced the symmetry adds anything, even
simonb (inactive)
2015/10/27 11:12:27
Now useful as a way to override any state that may
|
| + "more-info", |
| "less-info", |
| "chrome-symbols-dir=", |
| + "chrome-apk-dir=", |
| "symbols-dir=", |
| "symbols-zip=", |
| "arch=", |
| @@ -128,6 +147,9 @@ def main(argv): |
| zip_arg = None |
| more_info = False |
| + chrome_apk_dir = symbol.CHROME_SYMBOLS_DIR |
| + chrome_apk_dir_supplied = False |
| + packed_relocation_adjustments = False |
| for option, value in options: |
| if option == "--help": |
| PrintUsage() |
| @@ -139,6 +161,13 @@ def main(argv): |
| symbol.ARCH = value |
| elif option == "--chrome-symbols-dir": |
| symbol.CHROME_SYMBOLS_DIR = os.path.join(symbol.CHROME_SYMBOLS_DIR, value) |
| + elif option == "--chrome-apk-dir": |
| + chrome_apk_dir = os.path.join(chrome_apk_dir, value) |
| + chrome_apk_dir_supplied = True |
| + elif option == "--packed-relocation-adjustments": |
| + packed_relocation_adjustments = True |
| + elif option == "--no-packed-relocation-adjustments": |
| + packed_relocation_adjustments = False |
| elif option == "--more-info": |
| more_info = True |
| elif option == "--less-info": |
| @@ -146,6 +175,9 @@ def main(argv): |
| elif option == "--verbose": |
| logging.basicConfig(level=logging.DEBUG) |
| + if not chrome_apk_dir_supplied: |
| + chrome_apk_dir = os.path.join(symbol.CHROME_SYMBOLS_DIR, '..', DEFAULT_APK) |
|
rmcilroy
2015/10/23 16:25:10
nit - just make should chrome_apk_dir be chrome_ap
simonb (inactive)
2015/10/26 12:38:31
Again, symmetry. In this case with the existing --
rmcilroy
2015/10/26 16:42:17
dir is fine - my confusion stemed from the fact th
simonb (inactive)
2015/10/27 11:12:27
Done
|
| + |
| if len(arguments) > 1: |
| PrintUsage() |
| @@ -153,7 +185,7 @@ def main(argv): |
| print "Reading native crash info from stdin" |
| f = sys.stdin |
| else: |
| - print "Searching for native crashes in %s" % arguments[0] |
| + print "Searching for native crashes in: " + os.path.realpath(arguments[0]) |
| f = open(arguments[0], "r") |
| lines = f.readlines() |
| @@ -163,9 +195,18 @@ def main(argv): |
| if zip_arg: |
| rootdir, symbol.SYMBOLS_DIR = UnzipSymbols(zip_arg) |
| - print "Reading Android symbols from", symbol.SYMBOLS_DIR |
| - print "Reading Chrome symbols from", symbol.CHROME_SYMBOLS_DIR |
| - stack_core.ConvertTrace(lines, more_info) |
| + if packed_relocation_adjustments: |
| + print ("Reading Chrome APK library data from: " |
| + + os.path.normpath(chrome_apk_dir)) |
| + load_vaddrs = stack_libs.GetLoadVaddrs(chrome_apk_dir) |
| + else: |
| + load_vaddrs = {} |
| + |
| + print ("Reading Android symbols from: " |
| + + os.path.normpath(symbol.SYMBOLS_DIR)) |
| + print ("Reading Chrome symbols from: " |
| + + os.path.normpath(symbol.CHROME_SYMBOLS_DIR)) |
| + stack_core.ConvertTrace(lines, load_vaddrs, more_info) |
| if rootdir: |
| # be a good citizen and clean up...os.rmdir and os.removedirs() don't work |