Fix issues in libunwindstack.
- Add a load_bias field in MapInfo so that it can be loaded offline,
and also so it can be cached.
- Add an Add function to the Maps class so that it's possible to manually
create a map.
- Remove the OfflineMaps class since I haven't found a reason for this to
exist.
- Add a pointer to the gnu debugdata compressed section in the interface
itself and modify the step path to try eh_frame, then debug_frame, then
gnu_debugdata. This way arm can add exidx as the last step behind
gnu_debugdata. Add an offline test to verify the order of unwind.
- Fix x86_64_ucontext_t since it was a different size on 32 bit and 64 bit
systems.
Test: Pass new unit tests.
Change-Id: I978b70d6c244bd307c62a29886d24c1a8cb2af23
diff --git a/libunwindstack/Elf.cpp b/libunwindstack/Elf.cpp
index f486e23..5ec4a3d 100644
--- a/libunwindstack/Elf.cpp
+++ b/libunwindstack/Elf.cpp
@@ -79,6 +79,7 @@
uint64_t load_bias;
if (gnu->Init(&load_bias)) {
gnu->InitHeaders();
+ interface_->SetGnuDebugdataInterface(gnu);
} else {
// Free all of the memory associated with the gnu_debugdata section.
gnu_debugdata_memory_.reset(nullptr);
@@ -115,17 +116,9 @@
return true;
}
- // Adjust the load bias to get the real relative pc.
- if (adjusted_rel_pc < load_bias_) {
- return false;
- }
- adjusted_rel_pc -= load_bias_;
-
// Lock during the step which can update information in the object.
std::lock_guard<std::mutex> guard(lock_);
- return interface_->Step(adjusted_rel_pc, regs, process_memory, finished) ||
- (gnu_debugdata_interface_ &&
- gnu_debugdata_interface_->Step(adjusted_rel_pc, regs, process_memory, finished));
+ return interface_->Step(adjusted_rel_pc, load_bias_, regs, process_memory, finished);
}
bool Elf::IsValidElf(Memory* memory) {