summaryrefslogtreecommitdiffstats
path: root/libbacktrace
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2014-01-07 23:53:18 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-01-07 23:53:18 +0000
commitae998c7117b4944f57644bbbdcd2047ebaebc2ec (patch)
treebf79b152f3276ae34fc3846f8f78d02dc47836b8 /libbacktrace
parentb0e40722f4397fadf6f1b4014e45766f82cacd03 (diff)
parent0298da56f410ba0f6a1f1f44deb8e2224f9fc49d (diff)
downloadsystem_core-ae998c7117b4944f57644bbbdcd2047ebaebc2ec.zip
system_core-ae998c7117b4944f57644bbbdcd2047ebaebc2ec.tar.gz
system_core-ae998c7117b4944f57644bbbdcd2047ebaebc2ec.tar.bz2
am 0298da56: am 492b0ca4: am 1e424d8e: am 0afaf7f4: Merge "Fix the ucontext for mips/x86."
* commit '0298da56f410ba0f6a1f1f44deb8e2224f9fc49d': Fix the ucontext for mips/x86.
Diffstat (limited to 'libbacktrace')
-rw-r--r--libbacktrace/UnwindCurrent.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/libbacktrace/UnwindCurrent.cpp b/libbacktrace/UnwindCurrent.cpp
index d4ba68f..6c0cad6 100644
--- a/libbacktrace/UnwindCurrent.cpp
+++ b/libbacktrace/UnwindCurrent.cpp
@@ -40,17 +40,11 @@
struct sigcontext uc_mcontext;
uint32_t uc_sigmask;
} ucontext_t;
-#elif defined(__mips__)
- typedef struct ucontext {
- uint32_t sp;
- uint32_t ra;
- uint32_t pc;
- } ucontext_t;
#elif defined(__i386__)
#include <asm/sigcontext.h>
#include <asm/ucontext.h>
typedef struct ucontext ucontext_t;
-#else
+#elif !defined(__mips__)
#error Unsupported architecture.
#endif
@@ -93,6 +87,7 @@ bool UnwindCurrent::UnwindFromContext(size_t num_ignore_frames, bool resolve) {
int ret = unw_init_local(cursor, &context_);
if (ret < 0) {
BACK_LOGW("unw_init_local failed %d", ret);
+ delete cursor;
return false;
}
@@ -172,14 +167,8 @@ void UnwindCurrent::ExtractContext(void* sigcontext) {
context->regs[13] = uc->uc_mcontext.arm_sp;
context->regs[14] = uc->uc_mcontext.arm_lr;
context->regs[15] = uc->uc_mcontext.arm_pc;
-#elif defined(__mips__)
- context->uc_mcontext.sp = uc->sp;
- context->uc_mcontext.pc = uc->pc;
- context->uc_mcontext.ra = uc->ra;
-#elif defined(__i386__)
- context->uc_mcontext.gregs[REG_EBP] = uc->uc_mcontext.gregs[REG_EBP];
- context->uc_mcontext.gregs[REG_ESP] = uc->uc_mcontext.gregs[REG_ESP];
- context->uc_mcontext.gregs[REG_EIP] = uc->uc_mcontext.gregs[REG_EIP];
+#elif defined(__mips__) || defined(__i386__)
+ context->uc_mcontext = uc->uc_mcontext;
#endif
}