Add extra frame when dex_pc is non-zero.
Use the art dex file library to read the dex data.
Add unit tests for the UnwindDexFile code.
Bug: 72070049
Test: All unit tests continue to pass.
Test: Dumped the backtrace of the 137-cfi test while running in interpreter
Test: mode and verified that the stack trace is correct. Did this on host
Test: and for arm/arm64.
Change-Id: Ia6f343318c5dd6968a954015a7d59fdf101575b0
diff --git a/libbacktrace/Android.bp b/libbacktrace/Android.bp
index d9eed76..94b1935 100644
--- a/libbacktrace/Android.bp
+++ b/libbacktrace/Android.bp
@@ -50,6 +50,7 @@
"BacktracePtrace.cpp",
"thread_utils.c",
"ThreadEntry.cpp",
+ "UnwindDexFile.cpp",
"UnwindStack.cpp",
"UnwindStackMap.cpp",
]
@@ -92,13 +93,27 @@
"liblog",
"libunwind",
"libunwindstack",
+ "libdexfile",
],
static_libs: ["libcutils"],
+
+ // libdexfile will eventually properly export headers, for now
+ // include these directly.
+ include_dirs: [
+ "art/runtime",
+ ],
+
+ header_libs: [ "jni_headers", ],
},
android: {
static_libs: ["libasync_safe"],
},
+ vendor: {
+ cflags: ["-DNO_LIBDEXFILE"],
+ exclude_srcs: ["UnwindDexFile.cpp"],
+ exclude_shared_libs: ["libdexfile"],
+ },
},
whole_static_libs: ["libdemangle"],
}
@@ -161,6 +176,8 @@
"backtrace_test.cpp",
"GetPss.cpp",
"thread_utils.c",
+
+ "unwind_dex_test.cpp",
],
cflags: [
@@ -172,6 +189,7 @@
shared_libs: [
"libbacktrace_test",
"libbacktrace",
+ "libdexfile",
"libbase",
"libcutils",
"liblog",
@@ -212,6 +230,12 @@
},
},
+ // libdexfile will eventually properly export headers, for now
+ // include these directly.
+ include_dirs: [
+ "art/runtime",
+ ],
+
data: [
"testdata/arm/*",
"testdata/arm64/*",