Add libunwindstack support for Mips and Mips64
This patch requires v3.18 kernel or above, because v3.10 kernel
has a bug (as of 8/1/2017) in the ptrace(GETREGSET) function for mips
and mips64.
Change-Id: I004c1fa190193eebe1c84440b366289122a6bd8a
Signed-off-by: Douglas Leung <douglas.leung@mips.com>
Signed-off-by: Dejan Jovicevic <dejan.jovicevic@mips.com>
diff --git a/libunwindstack/Elf.cpp b/libunwindstack/Elf.cpp
index 025429f..f486e23 100644
--- a/libunwindstack/Elf.cpp
+++ b/libunwindstack/Elf.cpp
@@ -189,9 +189,12 @@
} else if (e_machine == EM_386) {
arch_ = ARCH_X86;
interface.reset(new ElfInterface32(memory));
+ } else if (e_machine == EM_MIPS) {
+ arch_ = ARCH_MIPS;
+ interface.reset(new ElfInterface32(memory));
} else {
// Unsupported.
- ALOGI("32 bit elf that is neither arm nor x86: e_machine = %d\n", e_machine);
+ ALOGI("32 bit elf that is neither arm nor x86 nor mips: e_machine = %d\n", e_machine);
return nullptr;
}
} else if (class_type_ == ELFCLASS64) {
@@ -205,9 +208,12 @@
arch_ = ARCH_ARM64;
} else if (e_machine == EM_X86_64) {
arch_ = ARCH_X86_64;
+ } else if (e_machine == EM_MIPS) {
+ arch_ = ARCH_MIPS64;
} else {
// Unsupported.
- ALOGI("64 bit elf that is neither aarch64 nor x86_64: e_machine = %d\n", e_machine);
+ ALOGI("64 bit elf that is neither aarch64 nor x86_64 nor mips64: e_machine = %d\n",
+ e_machine);
return nullptr;
}
interface.reset(new ElfInterface64(memory));