mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-24 14:45:40 +01:00
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
This commit is contained in:
parent
873064894b
commit
096992fac7
@ -84,7 +84,7 @@ static bool DoneCallback(const char* dump_path,
|
||||
if (!succeeded)
|
||||
return succeeded;
|
||||
|
||||
int fd = (int) context;
|
||||
int fd = (intptr_t) context;
|
||||
uint32_t len = my_strlen(minidump_id);
|
||||
HANDLE_EINTR(sys_write(fd, &len, sizeof(len)));
|
||||
HANDLE_EINTR(sys_write(fd, minidump_id, len));
|
||||
@ -143,7 +143,7 @@ static const unsigned kControlMsgSize =
|
||||
static bool
|
||||
CrashHandler(const void* crash_context, size_t crash_context_size,
|
||||
void* context) {
|
||||
const int fd = (int) context;
|
||||
const int fd = (intptr_t) context;
|
||||
int fds[2];
|
||||
pipe(fds);
|
||||
|
||||
|
@ -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,
|
||||
|
@ -31,9 +31,10 @@
|
||||
#define CLIENT_LINUX_MINIDUMP_WRITER_LINUX_DUMPER_H_
|
||||
|
||||
#include <elf.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/user.h>
|
||||
#include <linux/limits.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#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];
|
||||
|
@ -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<uint32_t> 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
|
||||
|
@ -52,10 +52,8 @@
|
||||
|
||||
#include "common/linux/dump_symbols.h"
|
||||
#include "common/linux/file_id.h"
|
||||
#include "common/linux/guid_creator.h"
|
||||
#include "common/linux/module.h"
|
||||
#include "common/linux/stabs_reader.h"
|
||||
#include "processor/scoped_ptr.h"
|
||||
|
||||
// This namespace contains helper functions.
|
||||
namespace {
|
||||
@ -82,7 +80,7 @@ static std::string Demangle(const std::string &mangled) {
|
||||
// Fix offset into virtual address by adding the mapped base into offsets.
|
||||
// Make life easier when want to find something by offset.
|
||||
static void FixAddress(void *obj_base) {
|
||||
ElfW(Word) base = reinterpret_cast<ElfW(Word)>(obj_base);
|
||||
ElfW(Addr) base = reinterpret_cast<ElfW(Addr)>(obj_base);
|
||||
ElfW(Ehdr) *elf_header = static_cast<ElfW(Ehdr) *>(obj_base);
|
||||
elf_header->e_phoff += base;
|
||||
elf_header->e_shoff += base;
|
||||
|
@ -27,7 +27,7 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "breakpad/linux/linux_libc_support.h"
|
||||
#include "common/linux/linux_libc_support.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace {
|
||||
|
@ -86,8 +86,13 @@ class PageAllocator {
|
||||
|
||||
private:
|
||||
uint8_t *GetNPages(unsigned num_pages) {
|
||||
#ifdef __x86_64
|
||||
void *a = sys_mmap(NULL, page_size_ * num_pages, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
#else
|
||||
void *a = sys_mmap2(NULL, page_size_ * num_pages, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
#endif
|
||||
if (a == MAP_FAILED)
|
||||
return NULL;
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "breakpad/linux/memory.h"
|
||||
#include "common/linux/memory.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using namespace google_breakpad;
|
||||
|
@ -16,8 +16,7 @@ BIN=dump_syms
|
||||
|
||||
all:$(BIN)
|
||||
|
||||
DUMP_OBJ=dump_symbols.o guid_creator.o dump_syms.o file_id.o md5.o \
|
||||
stabs_reader.o module.o
|
||||
DUMP_OBJ=dump_symbols.o dump_syms.o file_id.o stabs_reader.o module.o
|
||||
|
||||
dump_syms:$(DUMP_OBJ)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^
|
||||
@ -31,14 +30,8 @@ stabs_reader.o:../../../common/linux/stabs_reader.cc
|
||||
module.o:../../../common/linux/module.cc
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $^
|
||||
|
||||
guid_creator.o:../../../common/linux/guid_creator.cc
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $^
|
||||
|
||||
file_id.o:../../../common/linux/file_id.cc
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $^
|
||||
|
||||
md5.o:../../../common/md5.c
|
||||
$(CC) $(CPPFLAGS) $(CXXFLAGS) -c $^
|
||||
|
||||
clean:
|
||||
rm -f $(BIN) $(DUMP_OBJ)
|
||||
|
@ -47,7 +47,8 @@
|
||||
|
||||
#include "google_breakpad/common/minidump_format.h"
|
||||
#include "google_breakpad/common/minidump_cpu_x86.h"
|
||||
#include "breakpad/linux/minidump_format_linux.h"
|
||||
#include "common/linux/linux_syscall_support.h"
|
||||
#include "common/linux/minidump_format_linux.h"
|
||||
|
||||
#if __WORDSIZE == 64
|
||||
#define ELF_CLASS ELFCLASS64
|
||||
@ -419,7 +420,7 @@ ParseModuleStream(CrashedProcess* crashinfo, MMappedRange range) {
|
||||
CrashedProcess::Mapping mapping;
|
||||
const MDRawModule* rawmodule =
|
||||
(MDRawModule*) range.GetArrayElement(sizeof(uint32_t),
|
||||
sizeof(MDRawModule), i);
|
||||
MD_MODULE_SIZE, i);
|
||||
mapping.start_address = rawmodule->base_of_image;
|
||||
mapping.end_address = rawmodule->size_of_image + rawmodule->base_of_image;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user