summaryrefslogtreecommitdiffstats
path: root/libbacktrace/Backtrace.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2015-08-20 11:16:54 -0700
committerChristopher Ferris <cferris@google.com>2015-08-20 14:07:30 -0700
commit600017332cb3969c8a23012362f4b63d73e1f9ea (patch)
tree01b886909ba3e180a27c708f43d3f44e94e30dc3 /libbacktrace/Backtrace.cpp
parent565d20ef0422fc3ed2f695306d84c14945ddd890 (diff)
downloadsystem_core-600017332cb3969c8a23012362f4b63d73e1f9ea.tar.gz
system_core-600017332cb3969c8a23012362f4b63d73e1f9ea.tar.bz2
system_core-600017332cb3969c8a23012362f4b63d73e1f9ea.zip
Display the map offset for each frame.
The dlopen of a shared library in an apk results in large map offsets. Unfortunately, the current way that the frame data is printed, it's impossible to tell what the relative pc is relative to. With the addition of the offset, it's possible to figure out what the relative pc actually references. Bug: 23348999 (cherry picked from commit e0ab23223a1c3110c9550136b8a119b4c30ec066) Change-Id: I950f92c1cb29ee05eed777f47453efa03318cf3e
Diffstat (limited to 'libbacktrace/Backtrace.cpp')
-rw-r--r--libbacktrace/Backtrace.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libbacktrace/Backtrace.cpp b/libbacktrace/Backtrace.cpp
index 128bb047b..97f0ef445 100644
--- a/libbacktrace/Backtrace.cpp
+++ b/libbacktrace/Backtrace.cpp
@@ -102,6 +102,11 @@ std::string Backtrace::FormatFrameData(const backtrace_frame_data_t* frame) {
uintptr_t relative_pc = BacktraceMap::GetRelativePc(frame->map, frame->pc);
std::string line(StringPrintf("#%02zu pc %" PRIPTR " %s", frame->num, relative_pc, map_name));
+ // Special handling for non-zero offset maps, we need to print that
+ // information.
+ if (frame->map.offset != 0) {
+ line += " (offset " + StringPrintf("0x%" PRIxPTR, frame->map.offset) + ")";
+ }
if (!frame->func_name.empty()) {
line += " (" + frame->func_name;
if (frame->func_offset) {