aboutsummaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorrmcilroy@chromium.org <rmcilroy@chromium.org>2015-04-21 21:34:14 +0000
committerrmcilroy@chromium.org <rmcilroy@chromium.org>2015-04-21 21:34:14 +0000
commit0f27af628fd9aff70193abb140038e2d8f938165 (patch)
tree2bf0f466b6b320fb93975d3aff953c90608a5493 /src/tools
parentupdate svn:ignores (diff)
downloadbreakpad-0f27af628fd9aff70193abb140038e2d8f938165.tar.xz
[MIPS]: Use mcontext_t structure for MIPS
This change removes user_regs_struct and user_fpregs_struct structures for mips and uses mcontext_t instead. R=fdegans@chromium.org, mark@chromium.org, rmcilroy@chromium.org Review URL: https://breakpad.appspot.com/3744002 Patch from Gordana Cmiljanovic <Gordana.Cmiljanovic@imgtec.com>. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1452 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/linux/md2core/minidump-2-core.cc46
1 files changed, 32 insertions, 14 deletions
diff --git a/src/tools/linux/md2core/minidump-2-core.cc b/src/tools/linux/md2core/minidump-2-core.cc
index bcb0076e..21d410bc 100644
--- a/src/tools/linux/md2core/minidump-2-core.cc
+++ b/src/tools/linux/md2core/minidump-2-core.cc
@@ -81,6 +81,9 @@
// containing core registers, while they use 'user_regs_struct' on other
// architectures. This file-local typedef simplifies the source code.
typedef user_regs user_regs_struct;
+#elif defined (__mips__)
+// This file-local typedef simplifies the source code.
+typedef gregset_t user_regs_struct;
#endif
using google_breakpad::MDTypeHelper;
@@ -208,13 +211,17 @@ struct CrashedProcess {
struct Thread {
pid_t tid;
+#if defined(__mips__)
+ mcontext_t mcontext;
+#else // __mips__
user_regs_struct regs;
-#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
+#if defined(__i386__) || defined(__x86_64__)
user_fpregs_struct fpregs;
-#endif
+#endif // __i386__ || __x86_64__
#if defined(__i386__)
user_fpxregs_struct fpxregs;
-#endif
+#endif // __i386__
+#endif // __mips__
uintptr_t stack_addr;
const uint8_t* stack;
size_t stack_length;
@@ -371,21 +378,28 @@ ParseThreadRegisters(CrashedProcess::Thread* thread,
const MDRawContextMIPS* rawregs = range.GetData<MDRawContextMIPS>(0);
for (int i = 0; i < MD_CONTEXT_MIPS_GPR_COUNT; ++i)
- thread->regs.regs[i] = rawregs->iregs[i];
+ thread->mcontext.gregs[i] = rawregs->iregs[i];
+
+ thread->mcontext.pc = rawregs->epc;
- thread->regs.lo = rawregs->mdlo;
- thread->regs.hi = rawregs->mdhi;
- thread->regs.epc = rawregs->epc;
- thread->regs.badvaddr = rawregs->badvaddr;
- thread->regs.status = rawregs->status;
- thread->regs.cause = rawregs->cause;
+ thread->mcontext.mdlo = rawregs->mdlo;
+ thread->mcontext.mdhi = rawregs->mdhi;
- for (int i = 0; i < MD_FLOATINGSAVEAREA_MIPS_FPR_COUNT; ++i)
- thread->fpregs.regs[i] = rawregs->float_save.regs[i];
+ thread->mcontext.hi1 = rawregs->hi[0];
+ thread->mcontext.lo1 = rawregs->lo[0];
+ thread->mcontext.hi2 = rawregs->hi[1];
+ thread->mcontext.lo2 = rawregs->lo[1];
+ thread->mcontext.hi3 = rawregs->hi[2];
+ thread->mcontext.lo3 = rawregs->lo[2];
- thread->fpregs.fpcsr = rawregs->float_save.fpcsr;
+ for (int i = 0; i < MD_FLOATINGSAVEAREA_MIPS_FPR_COUNT; ++i) {
+ thread->mcontext.fpregs.fp_r.fp_fregs[i]._fp_fregs =
+ rawregs->float_save.regs[i];
+ }
+
+ thread->mcontext.fpc_csr = rawregs->float_save.fpcsr;
#if _MIPS_SIM == _ABIO32
- thread->fpregs.fir = rawregs->float_save.fir;
+ thread->mcontext.fpc_eir = rawregs->float_save.fir;
#endif
}
#else
@@ -751,7 +765,11 @@ WriteThread(const CrashedProcess::Thread& thread, int fatal_signal) {
pr.pr_info.si_signo = fatal_signal;
pr.pr_cursig = fatal_signal;
pr.pr_pid = thread.tid;
+#if defined(__mips__)
+ memcpy(&pr.pr_reg, &thread.mcontext.gregs, sizeof(user_regs_struct));
+#else
memcpy(&pr.pr_reg, &thread.regs, sizeof(user_regs_struct));
+#endif
Nhdr nhdr;
memset(&nhdr, 0, sizeof(nhdr));