summaryrefslogtreecommitdiffstats
path: root/libbacktrace
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2018-12-13 16:08:50 -0800
committerChristopher Ferris <cferris@google.com>2018-12-18 11:22:14 -0800
commita09c4a6ff2806644c8baf0b93415078fa252b0e9 (patch)
tree27827d1b44afc8b9391eb42fca881e2ba837c3f4 /libbacktrace
parent8fd4435d532846b46fe47e52a6825a050d1af13c (diff)
downloadsystem_core-a09c4a6ff2806644c8baf0b93415078fa252b0e9.tar.gz
system_core-a09c4a6ff2806644c8baf0b93415078fa252b0e9.tar.bz2
system_core-a09c4a6ff2806644c8baf0b93415078fa252b0e9.zip
Fix offsets when shared lib split across maps.
The linker was modified so that a shared library has a read-only map, then a read-execute map to represent the whole shared library. When backtraces are created, then the offsets are set incorrectly for backtraces. For example, all backtraces wind up with an offset now, and a shared library loaded out of an apk shows the wrong offset. Changes: - Fix the FormatFrame function which was putting the offset before the map name. - Refactor the Maps and MapInfo classes to keep track of the previous map instead of all maps. This was the only map that was ever needed. - Modify the unwind_for_offline tool to capture both the read-only and read-execute map when using the read-only segment option. Bug: 120981155 Test: Updated unit tests pass. Test: Unwinds on device don't show the offsets everywhere any more. Change-Id: I75b3727221be9c20316dfdcd7a1c6d242d7ce948
Diffstat (limited to 'libbacktrace')
-rw-r--r--libbacktrace/UnwindStack.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libbacktrace/UnwindStack.cpp b/libbacktrace/UnwindStack.cpp
index fe28eba41..f5f9b2ada 100644
--- a/libbacktrace/UnwindStack.cpp
+++ b/libbacktrace/UnwindStack.cpp
@@ -117,7 +117,7 @@ bool Backtrace::Unwind(unwindstack::Regs* regs, BacktraceMap* back_map,
back_frame->map.name = frame->map_name;
back_frame->map.start = frame->map_start;
back_frame->map.end = frame->map_end;
- back_frame->map.offset = frame->map_offset;
+ back_frame->map.offset = frame->map_elf_start_offset;
back_frame->map.load_bias = frame->map_load_bias;
back_frame->map.flags = frame->map_flags;
}