From 0f27af628fd9aff70193abb140038e2d8f938165 Mon Sep 17 00:00:00 2001 From: "rmcilroy@chromium.org" Date: Tue, 21 Apr 2015 21:34:14 +0000 Subject: [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 . git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1452 4c0a9323-5329-0410-9bdc-e9ce6186880e --- .../linux/minidump_writer/linux_ptrace_dumper.cc | 38 +++++++++++++--------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'src/client/linux/minidump_writer/linux_ptrace_dumper.cc') diff --git a/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/src/client/linux/minidump_writer/linux_ptrace_dumper.cc index 7a2cfb9f..5ea0050d 100644 --- a/src/client/linux/minidump_writer/linux_ptrace_dumper.cc +++ b/src/client/linux/minidump_writer/linux_ptrace_dumper.cc @@ -190,23 +190,25 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) { #ifdef PTRACE_GETREGSET struct iovec io; - io.iov_base = &info->regs; - io.iov_len = sizeof(info->regs); + info->GetGeneralPurposeRegisters(&io.iov_base, &io.iov_len); if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) { return false; } - io.iov_base = &info->fpregs; - io.iov_len = sizeof(info->fpregs); + info->GetFloatingPointRegisters(&io.iov_base, &io.iov_len); if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) { return false; } -#else - if (sys_ptrace(PTRACE_GETREGS, tid, NULL, &info->regs) == -1) { +#else // PTRACE_GETREGSET + void* gp_addr; + info->GetGeneralPurposeRegisters(&gp_addr, NULL); + if (sys_ptrace(PTRACE_GETREGS, tid, NULL, gp_addr) == -1) { return false; } - if (sys_ptrace(PTRACE_GETFPREGS, tid, NULL, &info->fpregs) == -1) { + void* fp_addr; + info->GetFloatingPointRegisters(&fp_addr, NULL); + if (sys_ptrace(PTRACE_GETFPREGS, tid, NULL, fp_addr) == -1) { return false; } #endif @@ -241,14 +243,20 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) { #endif #if defined(__mips__) - for (int i = 0; i < 3; ++i) { - sys_ptrace(PTRACE_PEEKUSER, tid, - reinterpret_cast(DSP_BASE + (i * 2)), &info->hi[i]); - sys_ptrace(PTRACE_PEEKUSER, tid, - reinterpret_cast(DSP_BASE + (i * 2) + 1), &info->lo[i]); - } sys_ptrace(PTRACE_PEEKUSER, tid, - reinterpret_cast(DSP_CONTROL), &info->dsp_control); + reinterpret_cast(DSP_BASE), &info->mcontext.hi1); + sys_ptrace(PTRACE_PEEKUSER, tid, + reinterpret_cast(DSP_BASE + 1), &info->mcontext.lo1); + sys_ptrace(PTRACE_PEEKUSER, tid, + reinterpret_cast(DSP_BASE + 2), &info->mcontext.hi2); + sys_ptrace(PTRACE_PEEKUSER, tid, + reinterpret_cast(DSP_BASE + 3), &info->mcontext.lo2); + sys_ptrace(PTRACE_PEEKUSER, tid, + reinterpret_cast(DSP_BASE + 4), &info->mcontext.hi3); + sys_ptrace(PTRACE_PEEKUSER, tid, + reinterpret_cast(DSP_BASE + 5), &info->mcontext.lo3); + sys_ptrace(PTRACE_PEEKUSER, tid, + reinterpret_cast(DSP_CONTROL), &info->mcontext.dsp); #endif const uint8_t* stack_pointer; @@ -262,7 +270,7 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) { my_memcpy(&stack_pointer, &info->regs.sp, sizeof(info->regs.sp)); #elif defined(__mips__) stack_pointer = - reinterpret_cast(info->regs.regs[MD_CONTEXT_MIPS_REG_SP]); + reinterpret_cast(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]); #else #error "This code hasn't been ported to your platform yet." #endif -- cgit v1.2.1