summaryrefslogtreecommitdiffstats
path: root/libbacktrace/UnwindCurrent.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2017-07-19 14:20:46 -0700
committerChristopher Ferris <cferris@google.com>2017-07-19 15:36:32 -0700
commit96722b0fa48524e03659c0a3d579f8ef4f1641ba (patch)
tree36fc9010745e09a91647fabbc5abdbbbe2cea9f2 /libbacktrace/UnwindCurrent.cpp
parent33913ebfb5ca699d09459227284b3d324343fa43 (diff)
downloadsystem_core-96722b0fa48524e03659c0a3d579f8ef4f1641ba.tar.gz
system_core-96722b0fa48524e03659c0a3d579f8ef4f1641ba.tar.bz2
system_core-96722b0fa48524e03659c0a3d579f8ef4f1641ba.zip
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
Diffstat (limited to 'libbacktrace/UnwindCurrent.cpp')
-rw-r--r--libbacktrace/UnwindCurrent.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libbacktrace/UnwindCurrent.cpp b/libbacktrace/UnwindCurrent.cpp
index 3c509e61a..2c87fa837 100644
--- a/libbacktrace/UnwindCurrent.cpp
+++ b/libbacktrace/UnwindCurrent.cpp
@@ -133,6 +133,11 @@ bool UnwindCurrent::UnwindFromContext(size_t num_ignore_frames, ucontext_t* ucon
backtrace_frame_data_t* prev = &frames_.at(num_frames-1);
prev->stack_size = frame->sp - prev->sp;
}
+ if (BacktraceMap::IsValid(frame->map)) {
+ frame->rel_pc = frame->pc - frame->map.start + frame->map.load_bias;
+ } else {
+ frame->rel_pc = frame->pc;
+ }
num_frames++;
} else {
num_ignore_frames--;