Cleanup the libbacktrace interface a bit.
- Change the field name load_base to load_bias (which is what it really is).
- Add a rel_pc field so that callers do not need to compute it themselves.
- Remove the BacktraceMap::GetRelativePc() since nobody should need to
compute this themselves.
Bug: 23762183
Test: Compiles and unit tests pass (debuggerd, libbacktrace).
Change-Id: I2cb579767120adf08c407a58f3c487ee3f2b45fc
diff --git a/libbacktrace/backtrace_test.cpp b/libbacktrace/backtrace_test.cpp
index fb463b0..1ec6a45 100644
--- a/libbacktrace/backtrace_test.cpp
+++ b/libbacktrace/backtrace_test.cpp
@@ -784,6 +784,7 @@
backtrace_frame_data_t frame;
frame.num = 1;
frame.pc = 2;
+ frame.rel_pc = 2;
frame.sp = 0;
frame.stack_size = 0;
frame.func_offset = 0;
@@ -799,9 +800,10 @@
// Check map name empty, but exists.
frame.pc = 0xb0020;
+ frame.rel_pc = 0x20;
frame.map.start = 0xb0000;
frame.map.end = 0xbffff;
- frame.map.load_base = 0;
+ frame.map.load_bias = 0;
#if defined(__LP64__)
EXPECT_EQ("#01 pc 0000000000000020 <anonymous:00000000000b0000>",
#else
@@ -813,7 +815,7 @@
frame.pc = 0xc0020;
frame.map.start = 0xc0000;
frame.map.end = 0xcffff;
- frame.map.load_base = 0;
+ frame.map.load_bias = 0;
frame.map.name = "[anon:thread signal stack]";
#if defined(__LP64__)
EXPECT_EQ("#01 pc 0000000000000020 [anon:thread signal stack:00000000000c0000]",
@@ -824,6 +826,7 @@
// Check relative pc is set and map name is set.
frame.pc = 0x12345679;
+ frame.rel_pc = 0x12345678;
frame.map.name = "MapFake";
frame.map.start = 1;
frame.map.end = 1;
@@ -852,9 +855,10 @@
#endif
backtrace->FormatFrameData(&frame));
- // Check func_name is set, func offset is non-zero, and load_base is non-zero.
+ // Check func_name is set, func offset is non-zero, and load_bias is non-zero.
+ frame.rel_pc = 0x123456dc;
frame.func_offset = 645;
- frame.map.load_base = 100;
+ frame.map.load_bias = 100;
#if defined(__LP64__)
EXPECT_EQ("#01 pc 00000000123456dc MapFake (ProcFake+645)",
#else
@@ -1737,9 +1741,13 @@
FinishRemoteProcess(pid);
}
-TEST(libbacktrace, unwind_remote_through_signal_using_handler) { UnwindThroughSignal(false); }
+TEST(libbacktrace, unwind_remote_through_signal_using_handler) {
+ UnwindThroughSignal(false);
+}
-TEST(libbacktrace, unwind_remote_through_signal_using_action) { UnwindThroughSignal(true); }
+TEST(libbacktrace, unwind_remote_through_signal_using_action) {
+ UnwindThroughSignal(true);
+}
#if defined(ENABLE_PSS_TESTS)
#include "GetPss.h"