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/UnwindPtrace.cpp b/libbacktrace/UnwindPtrace.cpp
index 42ac1bc..87282ef 100644
--- a/libbacktrace/UnwindPtrace.cpp
+++ b/libbacktrace/UnwindPtrace.cpp
@@ -135,6 +135,11 @@
}
FillInMap(frame->pc, &frame->map);
+ if (BacktraceMap::IsValid(frame->map)) {
+ frame->rel_pc = frame->pc - frame->map.start + frame->map.load_bias;
+ } else {
+ frame->rel_pc = frame->pc;
+ }
frame->func_name = GetFunctionName(frame->pc, &frame->func_offset, &frame->map);