Loading libbacktrace/include/backtrace/BacktraceMap.h +4 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,10 @@ struct backtrace_stackinfo_t; // Special flag to indicate a map is in /dev/. However, a map in // /dev/ashmem/... does not set this flag. static constexpr int PROT_DEVICE_MAP = 0x8000; // Special flag to indicate that this map represents an elf file // created by ART for use with the gdb jit debug interface. // This should only ever appear in offline maps data. static constexpr int PROT_JIT_SYMFILE_MAP = 0x4000; struct backtrace_map_t { uint64_t start = 0; Loading libunwindstack/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -194,6 +194,7 @@ cc_test { "tests/files/offline/eh_frame_hdr_begin_x86_64/*", "tests/files/offline/jit_debug_arm/*", "tests/files/offline/jit_debug_x86/*", "tests/files/offline/jit_map_arm/*", "tests/files/offline/gnu_debugdata_arm/*", "tests/files/offline/straddle_arm/*", "tests/files/offline/straddle_arm64/*", Loading libunwindstack/Maps.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <android-base/unique_fd.h> #include <algorithm> #include <cctype> #include <memory> #include <string> Loading Loading @@ -209,6 +210,11 @@ void Maps::Add(uint64_t start, uint64_t end, uint64_t offset, uint64_t flags, maps_.push_back(map_info); } void Maps::Sort() { std::sort(maps_.begin(), maps_.end(), [](const MapInfo* a, const MapInfo* b) { return a->start < b->start; }); } Maps::~Maps() { for (auto& map : maps_) { delete map; Loading libunwindstack/Unwinder.cpp +11 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <unwindstack/Elf.h> #include <unwindstack/JitDebug.h> #include <unwindstack/MapInfo.h> #include <unwindstack/Maps.h> #include <unwindstack/Unwinder.h> #if !defined(NO_LIBDEXFILE_SUPPORT) Loading Loading @@ -142,26 +143,31 @@ void Unwinder::Unwind(const std::vector<std::string>* initial_map_names_to_skip, uint64_t cur_sp = regs_->sp(); MapInfo* map_info = maps_->Find(regs_->pc()); uint64_t rel_pc; uint64_t pc_adjustment = 0; uint64_t step_pc; uint64_t rel_pc; Elf* elf; if (map_info == nullptr) { rel_pc = regs_->pc(); step_pc = rel_pc; step_pc = regs_->pc(); rel_pc = step_pc; last_error_.code = ERROR_INVALID_MAP; } else { if (ShouldStop(map_suffixes_to_ignore, map_info->name)) { break; } elf = map_info->GetElf(process_memory_, true); rel_pc = elf->GetRelPc(regs_->pc(), map_info); step_pc = regs_->pc(); rel_pc = elf->GetRelPc(step_pc, map_info); // Everyone except elf data in gdb jit debug maps uses the relative pc. if (!(map_info->flags & MAPS_FLAGS_JIT_SYMFILE_MAP)) { step_pc = rel_pc; } if (adjust_pc) { pc_adjustment = regs_->GetPcAdjustment(rel_pc, elf); } else { pc_adjustment = 0; } step_pc = rel_pc - pc_adjustment; step_pc -= pc_adjustment; // If the pc is in an invalid elf file, try and get an Elf object // using the jit debug information. Loading libunwindstack/include/unwindstack/Maps.h +6 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,10 @@ namespace unwindstack { // Special flag to indicate a map is in /dev/. However, a map in // /dev/ashmem/... does not set this flag. static constexpr int MAPS_FLAGS_DEVICE_MAP = 0x8000; // Special flag to indicate that this map represents an elf file // created by ART for use with the gdb jit debug interface. // This should only ever appear in offline maps data. static constexpr int MAPS_FLAGS_JIT_SYMFILE_MAP = 0x4000; class Maps { public: Loading @@ -45,6 +49,8 @@ class Maps { void Add(uint64_t start, uint64_t end, uint64_t offset, uint64_t flags, const std::string& name, uint64_t load_bias); void Sort(); typedef std::vector<MapInfo*>::iterator iterator; iterator begin() { return maps_.begin(); } iterator end() { return maps_.end(); } Loading Loading
libbacktrace/include/backtrace/BacktraceMap.h +4 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,10 @@ struct backtrace_stackinfo_t; // Special flag to indicate a map is in /dev/. However, a map in // /dev/ashmem/... does not set this flag. static constexpr int PROT_DEVICE_MAP = 0x8000; // Special flag to indicate that this map represents an elf file // created by ART for use with the gdb jit debug interface. // This should only ever appear in offline maps data. static constexpr int PROT_JIT_SYMFILE_MAP = 0x4000; struct backtrace_map_t { uint64_t start = 0; Loading
libunwindstack/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -194,6 +194,7 @@ cc_test { "tests/files/offline/eh_frame_hdr_begin_x86_64/*", "tests/files/offline/jit_debug_arm/*", "tests/files/offline/jit_debug_x86/*", "tests/files/offline/jit_map_arm/*", "tests/files/offline/gnu_debugdata_arm/*", "tests/files/offline/straddle_arm/*", "tests/files/offline/straddle_arm64/*", Loading
libunwindstack/Maps.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <android-base/unique_fd.h> #include <algorithm> #include <cctype> #include <memory> #include <string> Loading Loading @@ -209,6 +210,11 @@ void Maps::Add(uint64_t start, uint64_t end, uint64_t offset, uint64_t flags, maps_.push_back(map_info); } void Maps::Sort() { std::sort(maps_.begin(), maps_.end(), [](const MapInfo* a, const MapInfo* b) { return a->start < b->start; }); } Maps::~Maps() { for (auto& map : maps_) { delete map; Loading
libunwindstack/Unwinder.cpp +11 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <unwindstack/Elf.h> #include <unwindstack/JitDebug.h> #include <unwindstack/MapInfo.h> #include <unwindstack/Maps.h> #include <unwindstack/Unwinder.h> #if !defined(NO_LIBDEXFILE_SUPPORT) Loading Loading @@ -142,26 +143,31 @@ void Unwinder::Unwind(const std::vector<std::string>* initial_map_names_to_skip, uint64_t cur_sp = regs_->sp(); MapInfo* map_info = maps_->Find(regs_->pc()); uint64_t rel_pc; uint64_t pc_adjustment = 0; uint64_t step_pc; uint64_t rel_pc; Elf* elf; if (map_info == nullptr) { rel_pc = regs_->pc(); step_pc = rel_pc; step_pc = regs_->pc(); rel_pc = step_pc; last_error_.code = ERROR_INVALID_MAP; } else { if (ShouldStop(map_suffixes_to_ignore, map_info->name)) { break; } elf = map_info->GetElf(process_memory_, true); rel_pc = elf->GetRelPc(regs_->pc(), map_info); step_pc = regs_->pc(); rel_pc = elf->GetRelPc(step_pc, map_info); // Everyone except elf data in gdb jit debug maps uses the relative pc. if (!(map_info->flags & MAPS_FLAGS_JIT_SYMFILE_MAP)) { step_pc = rel_pc; } if (adjust_pc) { pc_adjustment = regs_->GetPcAdjustment(rel_pc, elf); } else { pc_adjustment = 0; } step_pc = rel_pc - pc_adjustment; step_pc -= pc_adjustment; // If the pc is in an invalid elf file, try and get an Elf object // using the jit debug information. Loading
libunwindstack/include/unwindstack/Maps.h +6 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,10 @@ namespace unwindstack { // Special flag to indicate a map is in /dev/. However, a map in // /dev/ashmem/... does not set this flag. static constexpr int MAPS_FLAGS_DEVICE_MAP = 0x8000; // Special flag to indicate that this map represents an elf file // created by ART for use with the gdb jit debug interface. // This should only ever appear in offline maps data. static constexpr int MAPS_FLAGS_JIT_SYMFILE_MAP = 0x4000; class Maps { public: Loading @@ -45,6 +49,8 @@ class Maps { void Add(uint64_t start, uint64_t end, uint64_t offset, uint64_t flags, const std::string& name, uint64_t load_bias); void Sort(); typedef std::vector<MapInfo*>::iterator iterator; iterator begin() { return maps_.begin(); } iterator end() { return maps_.end(); } Loading