diff options
Diffstat (limited to 'libbacktrace/UnwindStackMap.cpp')
-rw-r--r-- | libbacktrace/UnwindStackMap.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libbacktrace/UnwindStackMap.cpp b/libbacktrace/UnwindStackMap.cpp index 52dd44192..9d15af2db 100644 --- a/libbacktrace/UnwindStackMap.cpp +++ b/libbacktrace/UnwindStackMap.cpp @@ -25,6 +25,7 @@ #include <unwindstack/Elf.h> #include <unwindstack/MapInfo.h> #include <unwindstack/Maps.h> +#include <unwindstack/Regs.h> #include "UnwindStackMap.h" @@ -106,7 +107,17 @@ std::string UnwindStackMap::GetFunctionName(uint64_t pc, uint64_t* offset) { return ""; } - unwindstack::Elf* elf = map_info->GetElf(process_memory()); + if (arch_ == unwindstack::ARCH_UNKNOWN) { + if (pid_ == getpid()) { + arch_ = unwindstack::Regs::CurrentArch(); + } else { + // Create a remote regs, to figure out the architecture. + std::unique_ptr<unwindstack::Regs> regs(unwindstack::Regs::RemoteGet(pid_)); + arch_ = regs->Arch(); + } + } + + unwindstack::Elf* elf = map_info->GetElf(process_memory(), arch_); std::string name; uint64_t func_offset; |