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
This commit is contained in:
Krzysztof Kosiński
2021-02-24 15:21:50 -08:00
parent 3ca6731998
commit dd45e18f94

View File

@@ -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)