From 096992fac73756cfa0974a94754329f30fd4e786 Mon Sep 17 00:00:00 2001 From: nealsid Date: Tue, 1 Dec 2009 21:35:52 +0000 Subject: Upstreaming several patches from Chrome: Build fix for systems where sys/user.h needs sys/types.h.... http://breakpad.appspot.com/40002 MDRawSystemInfo.processor_level refers to the CPU family, not the cpuid level.. http://breakpad.appspot.com/40003 Use MD_MODULE_SIZE in place of sizeof(MDRawModule). http://breakpad.appspot.com/39003 Linux x64 compile fix. http://breakpad.appspot.com/40004 Include linux_syscall_support.h to get definition of NT_PRXFPREG. This is Chromium commit 23659. http://breakpad.appspot.com/40005 Build breakpad / crash reporting on Linux 64-bit. This is Chromium commit 23396. http://breakpad.appspot.com/40006 Fix #includes in a couple unit tests. http://breakpad.appspot.com/41001 Clean up unused headers / files for Linux dump_syms. http://breakpad.appspot.com/40002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@432 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/client/linux/minidump_writer/linux_dumper.cc | 4 +++- src/client/linux/minidump_writer/linux_dumper.h | 8 ++++++-- src/client/linux/minidump_writer/minidump_writer.cc | 16 ++++++++-------- 3 files changed, 17 insertions(+), 11 deletions(-) (limited to 'src/client/linux/minidump_writer') diff --git a/src/client/linux/minidump_writer/linux_dumper.cc b/src/client/linux/minidump_writer/linux_dumper.cc index e821db7d..86ebb866 100644 --- a/src/client/linux/minidump_writer/linux_dumper.cc +++ b/src/client/linux/minidump_writer/linux_dumper.cc @@ -316,10 +316,12 @@ bool LinuxDumper::ThreadInfoGet(pid_t tid, ThreadInfo* info) { return false; } -#if defined(__i386) || defined(__x86_64) +#if defined(__i386) if (sys_ptrace(PTRACE_GETFPXREGS, tid, NULL, &info->fpxregs) == -1) return false; +#endif +#if defined(__i386) || defined(__x86_64) for (unsigned i = 0; i < ThreadInfo::kNumDebugRegisters; ++i) { if (sys_ptrace( PTRACE_PEEKUSER, tid, diff --git a/src/client/linux/minidump_writer/linux_dumper.h b/src/client/linux/minidump_writer/linux_dumper.h index 252e9ee6..d8e5e783 100644 --- a/src/client/linux/minidump_writer/linux_dumper.h +++ b/src/client/linux/minidump_writer/linux_dumper.h @@ -31,9 +31,10 @@ #define CLIENT_LINUX_MINIDUMP_WRITER_LINUX_DUMPER_H_ #include +#include #include +#include #include -#include #include "common/linux/memory.h" @@ -64,8 +65,11 @@ struct ThreadInfo { user_regs_struct regs; user_fpregs_struct fpregs; -#if defined(__i386) || defined(__x86_64) +#if defined(__i386) user_fpxregs_struct fpxregs; +#endif + +#if defined(__i386) || defined(__x86_64) static const unsigned kNumDebugRegisters = 8; debugreg_t dregs[8]; diff --git a/src/client/linux/minidump_writer/minidump_writer.cc b/src/client/linux/minidump_writer/minidump_writer.cc index a99309f3..10041f77 100644 --- a/src/client/linux/minidump_writer/minidump_writer.cc +++ b/src/client/linux/minidump_writer/minidump_writer.cc @@ -248,21 +248,21 @@ static void CPUFillFromThreadInfo(MDRawContextAMD64 *out, out->flt_save.control_word = info.fpregs.cwd; out->flt_save.status_word = info.fpregs.swd; - out->flt_save.tag_word = info.fpregs.twd; + out->flt_save.tag_word = info.fpregs.ftw; out->flt_save.error_opcode = info.fpregs.fop; out->flt_save.error_offset = info.fpregs.rip; out->flt_save.error_selector = 0; // We don't have this. out->flt_save.data_offset = info.fpregs.rdp; out->flt_save.data_selector = 0; // We don't have this. out->flt_save.mx_csr = info.fpregs.mxcsr; - out->flt_save.mx_csr_mask = info.fpregs.mxcsr_mask; + out->flt_save.mx_csr_mask = info.fpregs.mxcr_mask; memcpy(&out->flt_save.float_registers, &info.fpregs.st_space, 8 * 16); memcpy(&out->flt_save.xmm_registers, &info.fpregs.xmm_space, 16 * 16); } static void CPUFillFromUContext(MDRawContextAMD64 *out, const ucontext *uc, const struct _libc_fpstate* fpregs) { - const greg_t* regs = uc->gregs; + const greg_t* regs = uc->uc_mcontext.gregs; out->context_flags = MD_CONTEXT_AMD64_FULL; @@ -302,7 +302,7 @@ static void CPUFillFromUContext(MDRawContextAMD64 *out, const ucontext *uc, out->flt_save.error_selector = 0; // We don't have this. out->flt_save.data_selector = 0; // We don't have this. out->flt_save.mx_csr = fpregs->mxcsr; - out->flt_save.mx_csr_mask = fpregs->mxcsr_mask; + out->flt_save.mx_csr_mask = fpregs->mxcr_mask; memcpy(&out->flt_save.float_registers, &fpregs->_st, 8 * 16); memcpy(&out->flt_save.xmm_registers, &fpregs->_xmm, 16 * 16); } @@ -510,7 +510,7 @@ class MinidumpWriter { } TypedMDRVA list(&minidump_writer_); - if (!list.AllocateObjectAndArray(num_output_mappings, sizeof(MDRawModule))) + if (!list.AllocateObjectAndArray(num_output_mappings, MD_MODULE_SIZE)) return false; dirent->stream_type = MD_MODULE_LIST_STREAM; @@ -523,7 +523,7 @@ class MinidumpWriter { continue; MDRawModule mod; - my_memset(&mod, 0, sizeof(mod)); + my_memset(&mod, 0, MD_MODULE_SIZE); mod.base_of_image = mapping.start_addr; mod.size_of_image = mapping.size; const size_t filepath_len = my_strlen(mapping.name); @@ -579,7 +579,7 @@ class MinidumpWriter { return false; mod.module_name_rva = ld.rva; - list.CopyIndexAfterObject(j++, &mod, sizeof(mod)); + list.CopyIndexAfterObject(j++, &mod, MD_MODULE_SIZE); } return true; @@ -650,7 +650,7 @@ class MinidumpWriter { { "processor", -1, false }, { "model", 0, false }, { "stepping", 0, false }, - { "cpuid level", 0, false }, + { "cpu family", 0, false }, }; // processor_architecture should always be set, do this first -- cgit v1.2.1