From dd45e18f943d1661a178dcca840bccde295f4b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Kosi=C5=84ski?= Date: Wed, 24 Feb 2021 15:21:50 -0800 Subject: [PATCH] Make the "stack" script work for device tests. The path where the tests are uploaded by atest differs from the path to unstripped binaries in the out directory. As a result, the script can't symbolize the parts of the stack trace that correspond to code in the test binary. Add a fixup to use the correct path. Test: Used the script on example crashes in framework and vendor device tests - appears to work and give correct line numbers. Change-Id: I5470e6342afb801ac596cbc0c0bf067850b1e09a --- scripts/stack_core.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/stack_core.py b/scripts/stack_core.py index 9556cc23d..ee63b532d 100755 --- a/scripts/stack_core.py +++ b/scripts/stack_core.py @@ -391,6 +391,17 @@ class TraceConverter: lib = area lib_name = None + # When using atest, test paths are different between the out/ directory + # and device. Apply fixups. + if lib.startswith("/data/local/tests/") or lib.startswith("/data/local/tmp/"): + test_name = lib.rsplit("/", 1)[-1] + prefix = "/data/nativetest" + if symbol.ARCH.endswith("64"): + prefix += "64" + if lib.startswith("/data/local/tests/vendor/"): + prefix += "/vendor" + lib = prefix + "/" + test_name + "/" + test_name + # If a calls b which further calls c and c is inlined to b, we want to # display "a -> b -> c" in the stack trace instead of just "a -> c" info = symbol.SymbolInformation(lib, code_addr)