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

Unified Diff: third_party/android_platform/development/scripts/stack

Issue 1412223008: stack: Adjust Pre-M Android incorrect debuggerd addresses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update for review comments Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
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..78bb6b8f9b26cb183526a1d50f62f30c3ae9c9c9 100755
--- a/third_party/android_platform/development/scripts/stack
+++ b/third_party/android_platform/development/scripts/stack
@@ -23,11 +23,15 @@ import os
import sys
import stack_core
+import stack_libs
import subprocess
import symbol
import sys
DEFAULT_SYMROOT='/tmp/symbols'
+DEFAULT_APK_DIR='chrome_apk'
+# From: https://source.android.com/source/build-numbers.html
+_ANDROID_M_MAJOR_VERSION=6
def PrintUsage():
"""Print usage and exit with error."""
@@ -44,6 +48,20 @@ def PrintUsage():
print " If not specified, will look for the newest lib in out/Debug or"
print " out/Release"
print
+ 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
+ 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
print " --symbols-zip=path"
print " the path to a symbols zip file, such as =dream-symbols-12345.zip"
print
@@ -115,9 +133,12 @@ def UnzipSymbols(symbolfile, symdir=None):
def main(argv):
try:
options, arguments = getopt.getopt(argv, "",
- ["more-info",
+ ["packed-relocation-adjustments",
+ "no-packed-relocation-adjustments",
+ "more-info",
"less-info",
"chrome-symbols-dir=",
+ "chrome-apk-dir=",
"symbols-dir=",
"symbols-zip=",
"arch=",
@@ -128,6 +149,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 = "unknown"
for option, value in options:
if option == "--help":
PrintUsage()
@@ -139,6 +163,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 +177,10 @@ 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_DIR)
rmcilroy 2015/10/28 17:32:33 You've missed this comment from the previous patch
+
if len(arguments) > 1:
PrintUsage()
@@ -153,7 +188,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 +198,31 @@ 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 == "unknown":
+ version = stack_libs.GetTargetAndroidVersionNumber(lines)
+ if version == None:
+ print ("Unknown Android release, "
+ + "consider --[no-]packed-relocation-adjustments options")
+ packed_relocation_adjustments = False
+ elif version >= _ANDROID_M_MAJOR_VERSION:
+ packed_relocation_adjustments = False
+ else:
+ packed_relocation_adjustments = True
+ print ("Pre-M Android release detected, "
+ + "added --packed-relocation-adjustments option")
+
+ 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
« 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