mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 12:34:43 +00:00
Compare commits
1 Commits
gdb-15-bra
...
users/cbie
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2196e892c8 |
@@ -72,16 +72,16 @@ BFD_H = bfd.h
|
||||
BFD32_LIBS = \
|
||||
archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo cache.lo \
|
||||
coff-bfd.lo compress.lo corefile.lo elf-properties.lo format.lo \
|
||||
hash.lo init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo \
|
||||
section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo \
|
||||
binary.lo ihex.lo srec.lo tekhex.lo verilog.lo
|
||||
hash.lo init.lo libbfd.lo linker.lo merge.lo minidump-core.lo \
|
||||
opncls.lo reloc.lo section.lo simple.lo stab-syms.lo stabs.lo syms.lo \
|
||||
targets.lo binary.lo ihex.lo srec.lo tekhex.lo verilog.lo
|
||||
|
||||
BFD64_LIBS = archive64.lo
|
||||
|
||||
BFD32_LIBS_CFILES = \
|
||||
archive.c archures.c bfd.c bfdio.c bfdwin.c cache.c coff-bfd.c \
|
||||
compress.c corefile.c elf-properties.c format.c hash.c \
|
||||
init.c libbfd.c linker.c merge.c opncls.c reloc.c \
|
||||
init.c libbfd.c linker.c merge.c minidump-core.c opncls.c reloc.c \
|
||||
section.c simple.c stab-syms.c stabs.c syms.c targets.c \
|
||||
binary.c ihex.c srec.c tekhex.c verilog.c
|
||||
|
||||
|
||||
@@ -184,9 +184,9 @@ am__DEPENDENCIES_1 =
|
||||
am__objects_1 = archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \
|
||||
cache.lo coff-bfd.lo compress.lo corefile.lo elf-properties.lo \
|
||||
format.lo hash.lo init.lo libbfd.lo linker.lo merge.lo \
|
||||
opncls.lo reloc.lo section.lo simple.lo stab-syms.lo stabs.lo \
|
||||
syms.lo targets.lo binary.lo ihex.lo srec.lo tekhex.lo \
|
||||
verilog.lo
|
||||
minidump-core.lo opncls.lo reloc.lo section.lo simple.lo \
|
||||
stab-syms.lo stabs.lo syms.lo targets.lo binary.lo ihex.lo \
|
||||
srec.lo tekhex.lo verilog.lo
|
||||
am_libbfd_la_OBJECTS = $(am__objects_1)
|
||||
libbfd_la_OBJECTS = $(am_libbfd_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
@@ -497,15 +497,15 @@ BFD_H = bfd.h
|
||||
BFD32_LIBS = \
|
||||
archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo cache.lo \
|
||||
coff-bfd.lo compress.lo corefile.lo elf-properties.lo format.lo \
|
||||
hash.lo init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo \
|
||||
section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo \
|
||||
binary.lo ihex.lo srec.lo tekhex.lo verilog.lo
|
||||
hash.lo init.lo libbfd.lo linker.lo merge.lo minidump-core.lo \
|
||||
opncls.lo reloc.lo section.lo simple.lo stab-syms.lo stabs.lo syms.lo \
|
||||
targets.lo binary.lo ihex.lo srec.lo tekhex.lo verilog.lo
|
||||
|
||||
BFD64_LIBS = archive64.lo
|
||||
BFD32_LIBS_CFILES = \
|
||||
archive.c archures.c bfd.c bfdio.c bfdwin.c cache.c coff-bfd.c \
|
||||
compress.c corefile.c elf-properties.c format.c hash.c \
|
||||
init.c libbfd.c linker.c merge.c opncls.c reloc.c \
|
||||
init.c libbfd.c linker.c merge.c minidump-core.c opncls.c reloc.c \
|
||||
section.c simple.c stab-syms.c stabs.c syms.c targets.c \
|
||||
binary.c ihex.c srec.c tekhex.c verilog.c
|
||||
|
||||
@@ -1536,6 +1536,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach-o-x86-64.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach-o.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/merge.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minidump-core.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmo.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netbsd-core.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ns32knetbsd.Plo@am__quote@
|
||||
|
||||
@@ -6744,6 +6744,7 @@ struct bfd
|
||||
struct hppabsd_core_struct *hppabsd_core_data;
|
||||
struct sgi_core_struct *sgi_core_data;
|
||||
struct lynx_core_struct *lynx_core_data;
|
||||
struct minidump_core_struct *minidump_core_data;
|
||||
struct osf_core_struct *osf_core_data;
|
||||
struct cisco_core_struct *cisco_core_data;
|
||||
struct versados_data_struct *versados_data;
|
||||
|
||||
@@ -332,6 +332,7 @@ CODE_FRAGMENT
|
||||
. struct hppabsd_core_struct *hppabsd_core_data;
|
||||
. struct sgi_core_struct *sgi_core_data;
|
||||
. struct lynx_core_struct *lynx_core_data;
|
||||
. struct minidump_core_struct *minidump_core_data;
|
||||
. struct osf_core_struct *osf_core_data;
|
||||
. struct cisco_core_struct *cisco_core_data;
|
||||
. struct versados_data_struct *versados_data;
|
||||
|
||||
337
bfd/minidump-core.c
Normal file
337
bfd/minidump-core.c
Normal file
@@ -0,0 +1,337 @@
|
||||
/* BFD back-end for Windows minidump (.dmp) files.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
#include "libbfd.h"
|
||||
#include "minidump-format/minidump_format.h"
|
||||
|
||||
/* These are stored in the bfd's tdata */
|
||||
|
||||
/* .lwpid and .user_tid are only valid if PROC_INFO_HAS_THREAD_ID, else they
|
||||
are set to 0. Also, until HP-UX implements MxN threads, .user_tid and
|
||||
.lwpid are synonymous. */
|
||||
struct minidump_core_struct
|
||||
{
|
||||
int sig;
|
||||
int lwpid; /* Kernel thread ID. */
|
||||
unsigned long user_tid; /* User thread ID. */
|
||||
};
|
||||
|
||||
#define core_hdr(bfd) ((bfd)->tdata.minidump_core_data)
|
||||
#define core_signal(bfd) (core_hdr(bfd)->sig)
|
||||
#define core_kernel_thread_id(bfd) (core_hdr(bfd)->lwpid)
|
||||
#define core_user_thread_id(bfd) (core_hdr(bfd)->user_tid)
|
||||
#define minidump_core_core_file_matches_executable_p generic_core_file_matches_executable_p
|
||||
#define minidump_core_core_file_pid _bfd_nocore_core_file_pid
|
||||
|
||||
static const bfd_target *minidump_core_core_file_p (bfd *);
|
||||
static char *minidump_core_core_file_failing_command (bfd *);
|
||||
static int minidump_core_core_file_failing_signal (bfd *);
|
||||
static void swap_abort (void);
|
||||
|
||||
static asection *
|
||||
make_bfd_memory_asection (bfd *abfd, const char *name, flagword flags,
|
||||
char *data, size_t size,
|
||||
unsigned int alignment_power)
|
||||
{
|
||||
asection *asect;
|
||||
char *newname;
|
||||
flags |= SEC_IN_MEMORY;
|
||||
|
||||
newname = bfd_alloc (abfd, (bfd_size_type) strlen (name) + 1);
|
||||
if (!newname)
|
||||
return NULL;
|
||||
|
||||
strcpy (newname, name);
|
||||
|
||||
asect = bfd_make_section_anyway_with_flags (abfd, newname, flags);
|
||||
if (!asect)
|
||||
return NULL;
|
||||
|
||||
asect->size = size;
|
||||
//asect->vma = -1;
|
||||
//asect->filepos = -1;
|
||||
asect->contents = data; /* TODO: does this need to be freed? */
|
||||
asect->alignment_power = alignment_power;
|
||||
fprintf (stderr, "Making section at %lx len %lx\n", asect->filepos, asect->size);
|
||||
|
||||
return asect;
|
||||
}
|
||||
static asection *
|
||||
make_bfd_asection (bfd *abfd, const char *name, flagword flags,
|
||||
MDLocationDescriptor loc, bfd_vma vma,
|
||||
unsigned int alignment_power)
|
||||
{
|
||||
asection *asect;
|
||||
char *newname;
|
||||
|
||||
newname = bfd_alloc (abfd, (bfd_size_type) strlen (name) + 1);
|
||||
if (!newname)
|
||||
return NULL;
|
||||
|
||||
strcpy (newname, name);
|
||||
|
||||
asect = bfd_make_section_anyway_with_flags (abfd, newname, flags);
|
||||
if (!asect)
|
||||
return NULL;
|
||||
|
||||
asect->size = bfd_getl32 (&loc.data_size);
|
||||
asect->vma = vma;
|
||||
asect->filepos = bfd_getl32 (&loc.rva);
|
||||
asect->alignment_power = alignment_power;
|
||||
fprintf (stderr, "Making section at %lx len %lx\n", asect->filepos, asect->size);
|
||||
|
||||
return asect;
|
||||
}
|
||||
|
||||
static void
|
||||
handle_thread_ctx (bfd *abfd, int thread_id, MDLocationDescriptor location, int first)
|
||||
{
|
||||
MDRawContextAMD64 ctx; /* TODO: Make this work for other CPUs. */
|
||||
char *registers;
|
||||
|
||||
if (bfd_seek (abfd, location.rva, SEEK_SET) != 0)
|
||||
return;
|
||||
if (bfd_bread (&ctx, (bfd_size_type) sizeof ctx, abfd) != sizeof ctx)
|
||||
return;
|
||||
|
||||
/* TODO: Make this work for win/mac too */
|
||||
|
||||
registers = malloc (216); // TODO
|
||||
/* These need to match the offsets in amd64_linux_gregset_reg_offset */
|
||||
*(unsigned long *) registers = ctx.r15;
|
||||
*(unsigned long *) (registers + 8) = ctx.r14;
|
||||
*(unsigned long *) (registers + 2 * 8) = ctx.r13;
|
||||
*(unsigned long *) (registers + 3 * 8) = ctx.r12;
|
||||
*(unsigned long *) (registers + 4 * 8) = ctx.rbp;
|
||||
*(unsigned long *) (registers + 5 * 8) = ctx.rbx;
|
||||
*(unsigned long *) (registers + 6 * 8) = ctx.r11;
|
||||
*(unsigned long *) (registers + 7 * 8) = ctx.r10;
|
||||
*(unsigned long *) (registers + 8 * 8) = ctx.r9;
|
||||
*(unsigned long *) (registers + 9 * 8) = ctx.r8;
|
||||
*(unsigned long *) (registers + 10 * 8) = ctx.rax;
|
||||
*(unsigned long *) (registers + 11 * 8) = ctx.rcx;
|
||||
*(unsigned long *) (registers + 12 * 8) = ctx.rdx;
|
||||
*(unsigned long *) (registers + 13 * 8) = ctx.rsi;
|
||||
*(unsigned long *) (registers + 14 * 8) = ctx.rdi;
|
||||
/* skipping orig_rax */
|
||||
*(unsigned long *) (registers + 16 * 8) = ctx.rip;
|
||||
*(unsigned long *) (registers + 17 * 8) = ctx.cs;
|
||||
*(unsigned long *) (registers + 18 * 8) = ctx.eflags;
|
||||
*(unsigned long *) (registers + 19 * 8) = ctx.rsp;
|
||||
*(unsigned long *) (registers + 20 * 8) = ctx.ss;
|
||||
*(unsigned long *) (registers + 23 * 8) = ctx.ds;
|
||||
*(unsigned long *) (registers + 24 * 8) = ctx.es;
|
||||
*(unsigned long *) (registers + 25 * 8) = ctx.fs;
|
||||
*(unsigned long *) (registers + 26 * 8) = ctx.gs;
|
||||
|
||||
|
||||
/* TODO: Make this work for other threads. Use .reg/123 as section name */
|
||||
if (first)
|
||||
make_bfd_memory_asection (abfd, ".reg", SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS, registers, 216, 4);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_thread_list (bfd *abfd, MDLocationDescriptor location)
|
||||
{
|
||||
MDRawThreadList list;
|
||||
unsigned num_threads;
|
||||
unsigned cur_thread;
|
||||
|
||||
if (bfd_seek (abfd, location.rva, SEEK_SET) != 0)
|
||||
return;
|
||||
if (bfd_bread (&list, (bfd_size_type) MDRawThreadList_minsize, abfd) != MDRawThreadList_minsize)
|
||||
return;
|
||||
num_threads = bfd_getl32 (&list.number_of_threads);
|
||||
for (cur_thread = 0; cur_thread < num_threads; ++cur_thread)
|
||||
{
|
||||
MDRawThread thread;
|
||||
if (bfd_bread (&thread, (bfd_size_type) sizeof thread, abfd) != sizeof thread)
|
||||
return;
|
||||
|
||||
handle_thread_ctx (abfd, bfd_getl32 (&thread.thread_id), thread.thread_context, cur_thread == 0);
|
||||
}
|
||||
}
|
||||
static void
|
||||
handle_memory_list (bfd *abfd, MDLocationDescriptor location)
|
||||
{
|
||||
MDRawMemoryList list;
|
||||
unsigned num_ranges;
|
||||
unsigned cur_range;
|
||||
|
||||
if (bfd_seek (abfd, location.rva, SEEK_SET) != 0)
|
||||
return;
|
||||
if (bfd_bread (&list, (bfd_size_type) 4, abfd) != 4) /* FIXME - magic number */
|
||||
return;
|
||||
num_ranges = bfd_getl32 (&list.number_of_memory_ranges);
|
||||
for (cur_range = 0; cur_range < num_ranges; ++cur_range)
|
||||
{
|
||||
MDMemoryDescriptor desc;
|
||||
bfd_vma base_addr;
|
||||
if (bfd_bread (&desc, (bfd_size_type) sizeof desc, abfd) != sizeof desc)
|
||||
return;
|
||||
|
||||
base_addr = bfd_getl64 (&desc.start_of_memory_range);
|
||||
if (!make_bfd_asection (abfd, ".data",
|
||||
SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
|
||||
desc.memory, base_addr, 4))
|
||||
return; /* TODO: report error */
|
||||
}
|
||||
}
|
||||
|
||||
static const bfd_target *
|
||||
minidump_core_core_file_p (bfd *abfd)
|
||||
{
|
||||
MDRawHeader header;
|
||||
MDRawDirectory dir;
|
||||
unsigned stream_count;
|
||||
unsigned stream_directory_pos;
|
||||
if (bfd_bread (&header, (bfd_size_type) sizeof header, abfd) != sizeof header)
|
||||
return NULL;
|
||||
if (bfd_getl32 (&header.signature) != 0x504d444d)
|
||||
return NULL;
|
||||
stream_count = bfd_getl32 (&header.stream_count);
|
||||
if (stream_count == 0)
|
||||
return NULL;
|
||||
fprintf(stderr, "Valid DMP file!\n");
|
||||
|
||||
stream_directory_pos = bfd_getl32 (&header.stream_directory_rva);
|
||||
|
||||
/* TODO: support other CPUs */
|
||||
bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x86_64);
|
||||
|
||||
for (unsigned i = 0; i < stream_count; ++i)
|
||||
{
|
||||
unsigned stream_type;
|
||||
if (bfd_seek (abfd, stream_directory_pos + i * sizeof dir, SEEK_SET) != 0)
|
||||
return NULL;
|
||||
if (bfd_bread (&dir, (bfd_size_type) sizeof dir, abfd) != sizeof dir)
|
||||
return NULL;
|
||||
stream_type = bfd_getl32 (&dir.stream_type);
|
||||
fprintf (stderr, "Found dir %x\n", stream_type);
|
||||
switch (stream_type)
|
||||
{
|
||||
case MD_THREAD_LIST_STREAM:
|
||||
handle_thread_list (abfd, dir.location);
|
||||
break;
|
||||
case MD_MODULE_LIST_STREAM:
|
||||
break;
|
||||
case MD_MEMORY_LIST_STREAM:
|
||||
handle_memory_list (abfd, dir.location);
|
||||
break;
|
||||
case MD_EXCEPTION_STREAM:
|
||||
break;
|
||||
case MD_SYSTEM_INFO_STREAM:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
core_hdr (abfd) = (struct minidump_core_struct *)
|
||||
bfd_zalloc (abfd, (bfd_size_type) sizeof (struct minidump_core_struct));
|
||||
if (!core_hdr (abfd))
|
||||
return NULL;
|
||||
|
||||
return abfd->xvec;
|
||||
}
|
||||
|
||||
static char *
|
||||
minidump_core_core_file_failing_command (bfd *abfd)
|
||||
{
|
||||
return "placeholder";
|
||||
}
|
||||
|
||||
static int
|
||||
minidump_core_core_file_failing_signal (bfd *abfd)
|
||||
{
|
||||
return core_signal (abfd);
|
||||
}
|
||||
|
||||
|
||||
/* If somebody calls any byte-swapping routines, shoot them. */
|
||||
static void
|
||||
swap_abort (void)
|
||||
{
|
||||
abort(); /* This way doesn't require any declaration for ANSI to fuck up */
|
||||
}
|
||||
|
||||
#define NO_GET ((bfd_vma (*) (const void *)) swap_abort)
|
||||
#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort)
|
||||
#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort)
|
||||
#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort)
|
||||
#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort)
|
||||
#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort)
|
||||
|
||||
const bfd_target core_minidump_vec =
|
||||
{
|
||||
"minidump-core",
|
||||
bfd_target_unknown_flavour,
|
||||
BFD_ENDIAN_LITTLE, /* target byte order */
|
||||
BFD_ENDIAN_LITTLE, /* target headers byte order */
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* symbol prefix */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
0, /* match priority. */
|
||||
NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data */
|
||||
NO_GET, NO_GETS, NO_PUT, /* 32 bit data */
|
||||
NO_GET, NO_GETS, NO_PUT, /* 16 bit data */
|
||||
NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs */
|
||||
NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */
|
||||
NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */
|
||||
|
||||
{ /* bfd_check_format */
|
||||
_bfd_dummy_target, /* unknown format */
|
||||
_bfd_dummy_target, /* object file */
|
||||
_bfd_dummy_target, /* archive */
|
||||
minidump_core_core_file_p /* a core file */
|
||||
},
|
||||
{ /* bfd_set_format */
|
||||
_bfd_bool_bfd_false_error,
|
||||
_bfd_bool_bfd_false_error,
|
||||
_bfd_bool_bfd_false_error,
|
||||
_bfd_bool_bfd_false_error
|
||||
},
|
||||
{ /* bfd_write_contents */
|
||||
_bfd_bool_bfd_false_error,
|
||||
_bfd_bool_bfd_false_error,
|
||||
_bfd_bool_bfd_false_error,
|
||||
_bfd_bool_bfd_false_error
|
||||
},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (_bfd_generic),
|
||||
BFD_JUMP_TABLE_COPY (_bfd_generic),
|
||||
BFD_JUMP_TABLE_CORE (minidump_core),
|
||||
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
|
||||
BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
|
||||
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
|
||||
BFD_JUMP_TABLE_WRITE (_bfd_generic),
|
||||
BFD_JUMP_TABLE_LINK (_bfd_nolink),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
NULL,
|
||||
|
||||
NULL /* backend_data */
|
||||
};
|
||||
|
||||
62
bfd/minidump-format/breakpad_types.h
Normal file
62
bfd/minidump-format/breakpad_types.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* Header file for the format of Windows minidumps.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
Written by Google LLC.
|
||||
Relicensed with permission, original at:
|
||||
https://source.chromium.org/chromium/chromium/src/+/master:third_party/breakpad/breakpad/src/google_breakpad/common
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* breakpad_types.h: Precise-width types
|
||||
*
|
||||
* (This is C99 source, please don't corrupt it with C++.)
|
||||
*
|
||||
* This file ensures that types uintN_t are defined for N = 8, 16, 32, and
|
||||
* 64. Types of precise widths are crucial to the task of writing data
|
||||
* structures on one platform and reading them on another.
|
||||
*
|
||||
* Author: Mark Mentovai */
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_BREAKPAD_TYPES_H__
|
||||
#define GOOGLE_BREAKPAD_COMMON_BREAKPAD_TYPES_H__
|
||||
|
||||
#if (defined(_INTTYPES_H) || defined(_INTTYPES_H_)) && \
|
||||
!defined(__STDC_FORMAT_MACROS)
|
||||
#error "inttypes.h has already been included before this header file, but "
|
||||
#error "without __STDC_FORMAT_MACROS defined."
|
||||
#endif
|
||||
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#endif /* __STDC_FORMAT_MACROS */
|
||||
#include <inttypes.h>
|
||||
|
||||
typedef struct {
|
||||
uint64_t high;
|
||||
uint64_t low;
|
||||
} uint128_struct;
|
||||
|
||||
typedef uint64_t breakpad_time_t;
|
||||
|
||||
/* Try to get PRIx64 from inttypes.h, but if it's not defined, fall back to
|
||||
* llx, which is the format string for "long long" - this is a 64-bit
|
||||
* integral type on many systems. */
|
||||
#ifndef PRIx64
|
||||
#define PRIx64 "llx"
|
||||
#endif /* !PRIx64 */
|
||||
|
||||
#endif /* GOOGLE_BREAKPAD_COMMON_BREAKPAD_TYPES_H__ */
|
||||
229
bfd/minidump-format/minidump_cpu_amd64.h
Normal file
229
bfd/minidump-format/minidump_cpu_amd64.h
Normal file
@@ -0,0 +1,229 @@
|
||||
/* Header file for the format of Windows minidumps.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
Written by Google LLC.
|
||||
Relicensed with permission, original at:
|
||||
https://source.chromium.org/chromium/chromium/src/+/master:third_party/breakpad/breakpad/src/google_breakpad/common
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* minidump_format.h: A cross-platform reimplementation of minidump-related
|
||||
* portions of DbgHelp.h from the Windows Platform SDK.
|
||||
*
|
||||
* (This is C99 source, please don't corrupt it with C++.)
|
||||
*
|
||||
* This file contains the necessary definitions to read minidump files
|
||||
* produced on amd64. These files may be read on any platform provided
|
||||
* that the alignments of these structures on the processing system are
|
||||
* identical to the alignments of these structures on the producing system.
|
||||
* For this reason, precise-sized types are used. The structures defined
|
||||
* by this file have been laid out to minimize alignment problems by ensuring
|
||||
* ensuring that all members are aligned on their natural boundaries. In
|
||||
* In some cases, tail-padding may be significant when different ABIs specify
|
||||
* different tail-padding behaviors. To avoid problems when reading or
|
||||
* writing affected structures, MD_*_SIZE macros are provided where needed,
|
||||
* containing the useful size of the structures without padding.
|
||||
*
|
||||
* Structures that are defined by Microsoft to contain a zero-length array
|
||||
* are instead defined here to contain an array with one element, as
|
||||
* zero-length arrays are forbidden by standard C and C++. In these cases,
|
||||
* *_minsize constants are provided to be used in place of sizeof. For a
|
||||
* cleaner interface to these sizes when using C++, see minidump_size.h.
|
||||
*
|
||||
* These structures are also sufficient to populate minidump files.
|
||||
*
|
||||
* These definitions may be extended to support handling minidump files
|
||||
* for other CPUs and other operating systems.
|
||||
*
|
||||
* Because precise data type sizes are crucial for this implementation to
|
||||
* function properly and portably in terms of interoperability with minidumps
|
||||
* produced by DbgHelp on Windows, a set of primitive types with known sizes
|
||||
* are used as the basis of each structure defined by this file. DbgHelp
|
||||
* on Windows is assumed to be the reference implementation; this file
|
||||
* seeks to provide a cross-platform compatible implementation. To avoid
|
||||
* collisions with the types and values defined and used by DbgHelp in the
|
||||
* event that this implementation is used on Windows, each type and value
|
||||
* defined here is given a new name, beginning with "MD". Names of the
|
||||
* equivalent types and values in the Windows Platform SDK are given in
|
||||
* comments.
|
||||
*
|
||||
* Author: Mark Mentovai
|
||||
* Change to split into its own file: Neal Sidhwaney */
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_AMD64_H__
|
||||
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_AMD64_H__
|
||||
|
||||
|
||||
/*
|
||||
* AMD64 support, see WINNT.H
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
uint16_t control_word;
|
||||
uint16_t status_word;
|
||||
uint8_t tag_word;
|
||||
uint8_t reserved1;
|
||||
uint16_t error_opcode;
|
||||
uint32_t error_offset;
|
||||
uint16_t error_selector;
|
||||
uint16_t reserved2;
|
||||
uint32_t data_offset;
|
||||
uint16_t data_selector;
|
||||
uint16_t reserved3;
|
||||
uint32_t mx_csr;
|
||||
uint32_t mx_csr_mask;
|
||||
uint128_struct float_registers[8];
|
||||
uint128_struct xmm_registers[16];
|
||||
uint8_t reserved4[96];
|
||||
} MDXmmSaveArea32AMD64; /* XMM_SAVE_AREA32 */
|
||||
|
||||
#define MD_CONTEXT_AMD64_VR_COUNT 26
|
||||
|
||||
typedef struct {
|
||||
/*
|
||||
* Register parameter home addresses.
|
||||
*/
|
||||
uint64_t p1_home;
|
||||
uint64_t p2_home;
|
||||
uint64_t p3_home;
|
||||
uint64_t p4_home;
|
||||
uint64_t p5_home;
|
||||
uint64_t p6_home;
|
||||
|
||||
/* The next field determines the layout of the structure, and which parts
|
||||
* of it are populated */
|
||||
uint32_t context_flags;
|
||||
uint32_t mx_csr;
|
||||
|
||||
/* The next register is included with MD_CONTEXT_AMD64_CONTROL */
|
||||
uint16_t cs;
|
||||
|
||||
/* The next 4 registers are included with MD_CONTEXT_AMD64_SEGMENTS */
|
||||
uint16_t ds;
|
||||
uint16_t es;
|
||||
uint16_t fs;
|
||||
uint16_t gs;
|
||||
|
||||
/* The next 2 registers are included with MD_CONTEXT_AMD64_CONTROL */
|
||||
uint16_t ss;
|
||||
uint32_t eflags;
|
||||
|
||||
/* The next 6 registers are included with MD_CONTEXT_AMD64_DEBUG_REGISTERS */
|
||||
uint64_t dr0;
|
||||
uint64_t dr1;
|
||||
uint64_t dr2;
|
||||
uint64_t dr3;
|
||||
uint64_t dr6;
|
||||
uint64_t dr7;
|
||||
|
||||
/* The next 4 registers are included with MD_CONTEXT_AMD64_INTEGER */
|
||||
uint64_t rax;
|
||||
uint64_t rcx;
|
||||
uint64_t rdx;
|
||||
uint64_t rbx;
|
||||
|
||||
/* The next register is included with MD_CONTEXT_AMD64_CONTROL */
|
||||
uint64_t rsp;
|
||||
|
||||
/* The next 11 registers are included with MD_CONTEXT_AMD64_INTEGER */
|
||||
uint64_t rbp;
|
||||
uint64_t rsi;
|
||||
uint64_t rdi;
|
||||
uint64_t r8;
|
||||
uint64_t r9;
|
||||
uint64_t r10;
|
||||
uint64_t r11;
|
||||
uint64_t r12;
|
||||
uint64_t r13;
|
||||
uint64_t r14;
|
||||
uint64_t r15;
|
||||
|
||||
/* The next register is included with MD_CONTEXT_AMD64_CONTROL */
|
||||
uint64_t rip;
|
||||
|
||||
/* The next set of registers are included with
|
||||
* MD_CONTEXT_AMD64_FLOATING_POINT
|
||||
*/
|
||||
union {
|
||||
MDXmmSaveArea32AMD64 flt_save;
|
||||
struct {
|
||||
uint128_struct header[2];
|
||||
uint128_struct legacy[8];
|
||||
uint128_struct xmm0;
|
||||
uint128_struct xmm1;
|
||||
uint128_struct xmm2;
|
||||
uint128_struct xmm3;
|
||||
uint128_struct xmm4;
|
||||
uint128_struct xmm5;
|
||||
uint128_struct xmm6;
|
||||
uint128_struct xmm7;
|
||||
uint128_struct xmm8;
|
||||
uint128_struct xmm9;
|
||||
uint128_struct xmm10;
|
||||
uint128_struct xmm11;
|
||||
uint128_struct xmm12;
|
||||
uint128_struct xmm13;
|
||||
uint128_struct xmm14;
|
||||
uint128_struct xmm15;
|
||||
} sse_registers;
|
||||
};
|
||||
|
||||
uint128_struct vector_register[MD_CONTEXT_AMD64_VR_COUNT];
|
||||
uint64_t vector_control;
|
||||
|
||||
/* The next 5 registers are included with MD_CONTEXT_AMD64_DEBUG_REGISTERS */
|
||||
uint64_t debug_control;
|
||||
uint64_t last_branch_to_rip;
|
||||
uint64_t last_branch_from_rip;
|
||||
uint64_t last_exception_to_rip;
|
||||
uint64_t last_exception_from_rip;
|
||||
|
||||
} MDRawContextAMD64; /* CONTEXT */
|
||||
|
||||
/* For (MDRawContextAMD64).context_flags. These values indicate the type of
|
||||
* context stored in the structure. The high 24 bits identify the CPU, the
|
||||
* low 8 bits identify the type of context saved. */
|
||||
#define MD_CONTEXT_AMD64 0x00100000 /* CONTEXT_AMD64 */
|
||||
#define MD_CONTEXT_AMD64_CONTROL (MD_CONTEXT_AMD64 | 0x00000001)
|
||||
/* CONTEXT_CONTROL */
|
||||
#define MD_CONTEXT_AMD64_INTEGER (MD_CONTEXT_AMD64 | 0x00000002)
|
||||
/* CONTEXT_INTEGER */
|
||||
#define MD_CONTEXT_AMD64_SEGMENTS (MD_CONTEXT_AMD64 | 0x00000004)
|
||||
/* CONTEXT_SEGMENTS */
|
||||
#define MD_CONTEXT_AMD64_FLOATING_POINT (MD_CONTEXT_AMD64 | 0x00000008)
|
||||
/* CONTEXT_FLOATING_POINT */
|
||||
#define MD_CONTEXT_AMD64_DEBUG_REGISTERS (MD_CONTEXT_AMD64 | 0x00000010)
|
||||
/* CONTEXT_DEBUG_REGISTERS */
|
||||
#define MD_CONTEXT_AMD64_XSTATE (MD_CONTEXT_AMD64 | 0x00000040)
|
||||
/* CONTEXT_XSTATE */
|
||||
|
||||
/* WinNT.h refers to CONTEXT_MMX_REGISTERS but doesn't appear to define it
|
||||
* I think it really means CONTEXT_FLOATING_POINT.
|
||||
*/
|
||||
|
||||
#define MD_CONTEXT_AMD64_FULL (MD_CONTEXT_AMD64_CONTROL | \
|
||||
MD_CONTEXT_AMD64_INTEGER | \
|
||||
MD_CONTEXT_AMD64_FLOATING_POINT)
|
||||
/* CONTEXT_FULL */
|
||||
|
||||
#define MD_CONTEXT_AMD64_ALL (MD_CONTEXT_AMD64_FULL | \
|
||||
MD_CONTEXT_AMD64_SEGMENTS | \
|
||||
MD_CONTEXT_X86_DEBUG_REGISTERS)
|
||||
/* CONTEXT_ALL */
|
||||
|
||||
|
||||
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_AMD64_H__ */
|
||||
145
bfd/minidump-format/minidump_cpu_arm.h
Normal file
145
bfd/minidump-format/minidump_cpu_arm.h
Normal file
@@ -0,0 +1,145 @@
|
||||
/* Header file for the format of Windows minidumps.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
Written by Google LLC.
|
||||
Relicensed with permission, original at:
|
||||
https://source.chromium.org/chromium/chromium/src/+/master:third_party/breakpad/breakpad/src/google_breakpad/common
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* minidump_format.h: A cross-platform reimplementation of minidump-related
|
||||
* portions of DbgHelp.h from the Windows Platform SDK.
|
||||
*
|
||||
* (This is C99 source, please don't corrupt it with C++.)
|
||||
*
|
||||
* This file contains the necessary definitions to read minidump files
|
||||
* produced on ARM. These files may be read on any platform provided
|
||||
* that the alignments of these structures on the processing system are
|
||||
* identical to the alignments of these structures on the producing system.
|
||||
* For this reason, precise-sized types are used. The structures defined
|
||||
* by this file have been laid out to minimize alignment problems by
|
||||
* ensuring that all members are aligned on their natural boundaries.
|
||||
* In some cases, tail-padding may be significant when different ABIs specify
|
||||
* different tail-padding behaviors. To avoid problems when reading or
|
||||
* writing affected structures, MD_*_SIZE macros are provided where needed,
|
||||
* containing the useful size of the structures without padding.
|
||||
*
|
||||
* Structures that are defined by Microsoft to contain a zero-length array
|
||||
* are instead defined here to contain an array with one element, as
|
||||
* zero-length arrays are forbidden by standard C and C++. In these cases,
|
||||
* *_minsize constants are provided to be used in place of sizeof. For a
|
||||
* cleaner interface to these sizes when using C++, see minidump_size.h.
|
||||
*
|
||||
* These structures are also sufficient to populate minidump files.
|
||||
*
|
||||
* Because precise data type sizes are crucial for this implementation to
|
||||
* function properly and portably, a set of primitive types with known sizes
|
||||
* are used as the basis of each structure defined by this file.
|
||||
*
|
||||
* Author: Julian Seward
|
||||
*/
|
||||
|
||||
/*
|
||||
* ARM support
|
||||
*/
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM_H__
|
||||
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM_H__
|
||||
|
||||
#define MD_FLOATINGSAVEAREA_ARM_FPR_COUNT 32
|
||||
#define MD_FLOATINGSAVEAREA_ARM_FPEXTRA_COUNT 8
|
||||
|
||||
/*
|
||||
* Note that these structures *do not* map directly to the CONTEXT
|
||||
* structure defined in WinNT.h in the Windows Mobile SDK. That structure
|
||||
* does not accomodate VFPv3, and I'm unsure if it was ever used in the
|
||||
* wild anyway, as Windows CE only seems to produce "cedumps" which
|
||||
* are not exactly minidumps.
|
||||
*/
|
||||
typedef struct {
|
||||
uint64_t fpscr; /* FPU status register */
|
||||
|
||||
/* 32 64-bit floating point registers, d0 .. d31. */
|
||||
uint64_t regs[MD_FLOATINGSAVEAREA_ARM_FPR_COUNT];
|
||||
|
||||
/* Miscellaneous control words */
|
||||
uint32_t extra[MD_FLOATINGSAVEAREA_ARM_FPEXTRA_COUNT];
|
||||
} MDFloatingSaveAreaARM;
|
||||
|
||||
#define MD_CONTEXT_ARM_GPR_COUNT 16
|
||||
|
||||
typedef struct {
|
||||
/* The next field determines the layout of the structure, and which parts
|
||||
* of it are populated
|
||||
*/
|
||||
uint32_t context_flags;
|
||||
|
||||
/* 16 32-bit integer registers, r0 .. r15
|
||||
* Note the following fixed uses:
|
||||
* r13 is the stack pointer
|
||||
* r14 is the link register
|
||||
* r15 is the program counter
|
||||
*/
|
||||
uint32_t iregs[MD_CONTEXT_ARM_GPR_COUNT];
|
||||
|
||||
/* CPSR (flags, basically): 32 bits:
|
||||
bit 31 - N (negative)
|
||||
bit 30 - Z (zero)
|
||||
bit 29 - C (carry)
|
||||
bit 28 - V (overflow)
|
||||
bit 27 - Q (saturation flag, sticky)
|
||||
All other fields -- ignore */
|
||||
uint32_t cpsr;
|
||||
|
||||
/* The next field is included with MD_CONTEXT_ARM_FLOATING_POINT */
|
||||
MDFloatingSaveAreaARM float_save;
|
||||
|
||||
} MDRawContextARM;
|
||||
|
||||
/* Indices into iregs for registers with a dedicated or conventional
|
||||
* purpose.
|
||||
*/
|
||||
enum MDARMRegisterNumbers {
|
||||
MD_CONTEXT_ARM_REG_IOS_FP = 7,
|
||||
MD_CONTEXT_ARM_REG_FP = 11,
|
||||
MD_CONTEXT_ARM_REG_SP = 13,
|
||||
MD_CONTEXT_ARM_REG_LR = 14,
|
||||
MD_CONTEXT_ARM_REG_PC = 15
|
||||
};
|
||||
|
||||
/* For (MDRawContextARM).context_flags. These values indicate the type of
|
||||
* context stored in the structure. */
|
||||
/* CONTEXT_ARM from the Windows CE 5.0 SDK. This value isn't correct
|
||||
* because this bit can be used for flags. Presumably this value was
|
||||
* never actually used in minidumps, but only in "CEDumps" which
|
||||
* are a whole parallel minidump file format for Windows CE.
|
||||
* Therefore, Breakpad defines its own value for ARM CPUs.
|
||||
*/
|
||||
#define MD_CONTEXT_ARM_OLD 0x00000040
|
||||
/* This value was chosen to avoid likely conflicts with MD_CONTEXT_*
|
||||
* for other CPUs. */
|
||||
#define MD_CONTEXT_ARM 0x40000000
|
||||
#define MD_CONTEXT_ARM_INTEGER (MD_CONTEXT_ARM | 0x00000002)
|
||||
#define MD_CONTEXT_ARM_FLOATING_POINT (MD_CONTEXT_ARM | 0x00000004)
|
||||
|
||||
#define MD_CONTEXT_ARM_FULL (MD_CONTEXT_ARM_INTEGER | \
|
||||
MD_CONTEXT_ARM_FLOATING_POINT)
|
||||
|
||||
#define MD_CONTEXT_ARM_ALL (MD_CONTEXT_ARM_INTEGER | \
|
||||
MD_CONTEXT_ARM_FLOATING_POINT)
|
||||
|
||||
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM_H__ */
|
||||
186
bfd/minidump-format/minidump_cpu_arm64.h
Normal file
186
bfd/minidump-format/minidump_cpu_arm64.h
Normal file
@@ -0,0 +1,186 @@
|
||||
/* Header file for the format of Windows minidumps.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
Written by Google LLC.
|
||||
Relicensed with permission, original at:
|
||||
https://source.chromium.org/chromium/chromium/src/+/master:third_party/breakpad/breakpad/src/google_breakpad/common
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* minidump_format.h: A cross-platform reimplementation of minidump-related
|
||||
* portions of DbgHelp.h from the Windows Platform SDK.
|
||||
*
|
||||
* (This is C99 source, please don't corrupt it with C++.)
|
||||
*
|
||||
* This file contains the necessary definitions to read minidump files
|
||||
* produced on ARM. These files may be read on any platform provided
|
||||
* that the alignments of these structures on the processing system are
|
||||
* identical to the alignments of these structures on the producing system.
|
||||
* For this reason, precise-sized types are used. The structures defined
|
||||
* by this file have been laid out to minimize alignment problems by
|
||||
* ensuring that all members are aligned on their natural boundaries.
|
||||
* In some cases, tail-padding may be significant when different ABIs specify
|
||||
* different tail-padding behaviors. To avoid problems when reading or
|
||||
* writing affected structures, MD_*_SIZE macros are provided where needed,
|
||||
* containing the useful size of the structures without padding.
|
||||
*
|
||||
* Structures that are defined by Microsoft to contain a zero-length array
|
||||
* are instead defined here to contain an array with one element, as
|
||||
* zero-length arrays are forbidden by standard C and C++. In these cases,
|
||||
* *_minsize constants are provided to be used in place of sizeof. For a
|
||||
* cleaner interface to these sizes when using C++, see minidump_size.h.
|
||||
*
|
||||
* These structures are also sufficient to populate minidump files.
|
||||
*
|
||||
* Because precise data type sizes are crucial for this implementation to
|
||||
* function properly and portably, a set of primitive types with known sizes
|
||||
* are used as the basis of each structure defined by this file.
|
||||
*
|
||||
* Author: Colin Blundell
|
||||
*/
|
||||
|
||||
/*
|
||||
* ARM64 support
|
||||
*/
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM64_H__
|
||||
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM64_H__
|
||||
|
||||
#include "breakpad_types.h"
|
||||
|
||||
#define MD_FLOATINGSAVEAREA_ARM64_FPR_COUNT 32
|
||||
#define MD_CONTEXT_ARM64_GPR_COUNT 33
|
||||
|
||||
typedef struct {
|
||||
/* 32 128-bit floating point registers, d0 .. d31. */
|
||||
uint128_struct regs[MD_FLOATINGSAVEAREA_ARM64_FPR_COUNT];
|
||||
|
||||
uint32_t fpcr; /* FPU control register */
|
||||
uint32_t fpsr; /* FPU status register */
|
||||
} MDFloatingSaveAreaARM64;
|
||||
|
||||
/* For (MDRawContextARM64).context_flags. These values indicate the type of
|
||||
* context stored in the structure. */
|
||||
#define MD_CONTEXT_ARM64 0x00400000
|
||||
#define MD_CONTEXT_ARM64_CONTROL (MD_CONTEXT_ARM64 | 0x00000001)
|
||||
#define MD_CONTEXT_ARM64_INTEGER (MD_CONTEXT_ARM64 | 0x00000002)
|
||||
#define MD_CONTEXT_ARM64_FLOATING_POINT (MD_CONTEXT_ARM64 | 0x00000004)
|
||||
#define MD_CONTEXT_ARM64_DEBUG (MD_CONTEXT_ARM64 | 0x00000008)
|
||||
#define MD_CONTEXT_ARM64_FULL (MD_CONTEXT_ARM64_CONTROL | \
|
||||
MD_CONTEXT_ARM64_INTEGER | \
|
||||
MD_CONTEXT_ARM64_FLOATING_POINT)
|
||||
#define MD_CONTEXT_ARM64_ALL (MD_CONTEXT_ARM64_FULL | MD_CONTEXT_ARM64_DEBUG)
|
||||
|
||||
typedef struct {
|
||||
/* Determines which fields of this struct are populated */
|
||||
uint32_t context_flags;
|
||||
|
||||
/* CPSR (flags, basically): 32 bits:
|
||||
bit 31 - N (negative)
|
||||
bit 30 - Z (zero)
|
||||
bit 29 - C (carry)
|
||||
bit 28 - V (overflow)
|
||||
bit 27 - Q (saturation flag, sticky)
|
||||
All other fields -- ignore */
|
||||
uint32_t cpsr;
|
||||
|
||||
/* 33 64-bit integer registers, x0 .. x31 + the PC
|
||||
* Note the following fixed uses:
|
||||
* x29 is the frame pointer
|
||||
* x30 is the link register
|
||||
* x31 is the stack pointer
|
||||
* The PC is effectively x32.
|
||||
*/
|
||||
uint64_t iregs[MD_CONTEXT_ARM64_GPR_COUNT];
|
||||
|
||||
/* The next field is included with MD_CONTEXT64_ARM_FLOATING_POINT */
|
||||
MDFloatingSaveAreaARM64 float_save;
|
||||
|
||||
uint32_t bcr[8];
|
||||
uint64_t bvr[8];
|
||||
uint32_t wcr[2];
|
||||
uint64_t wvr[2];
|
||||
} MDRawContextARM64;
|
||||
|
||||
typedef struct {
|
||||
uint32_t fpsr; /* FPU status register */
|
||||
uint32_t fpcr; /* FPU control register */
|
||||
|
||||
/* 32 128-bit floating point registers, d0 .. d31. */
|
||||
uint128_struct regs[MD_FLOATINGSAVEAREA_ARM64_FPR_COUNT];
|
||||
} MDFloatingSaveAreaARM64_Old;
|
||||
|
||||
/* Use the same 32-bit alignment when accessing this structure from 64-bit code
|
||||
* as is used natively in 32-bit code. */
|
||||
#pragma pack(push, 4)
|
||||
|
||||
typedef struct {
|
||||
/* The next field determines the layout of the structure, and which parts
|
||||
* of it are populated
|
||||
*/
|
||||
uint64_t context_flags;
|
||||
|
||||
/* 33 64-bit integer registers, x0 .. x31 + the PC
|
||||
* Note the following fixed uses:
|
||||
* x29 is the frame pointer
|
||||
* x30 is the link register
|
||||
* x31 is the stack pointer
|
||||
* The PC is effectively x32.
|
||||
*/
|
||||
uint64_t iregs[MD_CONTEXT_ARM64_GPR_COUNT];
|
||||
|
||||
/* CPSR (flags, basically): 32 bits:
|
||||
bit 31 - N (negative)
|
||||
bit 30 - Z (zero)
|
||||
bit 29 - C (carry)
|
||||
bit 28 - V (overflow)
|
||||
bit 27 - Q (saturation flag, sticky)
|
||||
All other fields -- ignore */
|
||||
uint32_t cpsr;
|
||||
|
||||
/* The next field is included with MD_CONTEXT64_ARM_FLOATING_POINT */
|
||||
MDFloatingSaveAreaARM64_Old float_save;
|
||||
|
||||
} MDRawContextARM64_Old;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
/* Indices into iregs for registers with a dedicated or conventional
|
||||
* purpose.
|
||||
*/
|
||||
enum MDARM64RegisterNumbers {
|
||||
MD_CONTEXT_ARM64_REG_FP = 29,
|
||||
MD_CONTEXT_ARM64_REG_LR = 30,
|
||||
MD_CONTEXT_ARM64_REG_SP = 31,
|
||||
MD_CONTEXT_ARM64_REG_PC = 32
|
||||
};
|
||||
|
||||
/* For (MDRawContextARM64_Old).context_flags. These values indicate the type of
|
||||
* context stored in the structure. MD_CONTEXT_ARM64_OLD is Breakpad-defined.
|
||||
* This value was chosen to avoid likely conflicts with MD_CONTEXT_*
|
||||
* for other CPUs. */
|
||||
#define MD_CONTEXT_ARM64_OLD 0x80000000
|
||||
#define MD_CONTEXT_ARM64_INTEGER_OLD (MD_CONTEXT_ARM64_OLD | 0x00000002)
|
||||
#define MD_CONTEXT_ARM64_FLOATING_POINT_OLD (MD_CONTEXT_ARM64_OLD | 0x00000004)
|
||||
|
||||
#define MD_CONTEXT_ARM64_FULL_OLD (MD_CONTEXT_ARM64_INTEGER_OLD | \
|
||||
MD_CONTEXT_ARM64_FLOATING_POINT_OLD)
|
||||
|
||||
#define MD_CONTEXT_ARM64_ALL_OLD (MD_CONTEXT_ARM64_INTEGER_OLD | \
|
||||
MD_CONTEXT_ARM64_FLOATING_POINT_OLD)
|
||||
|
||||
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM64_H__ */
|
||||
170
bfd/minidump-format/minidump_cpu_mips.h
Normal file
170
bfd/minidump-format/minidump_cpu_mips.h
Normal file
@@ -0,0 +1,170 @@
|
||||
/* Header file for the format of Windows minidumps.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
Written by Google LLC.
|
||||
Relicensed with permission, original at:
|
||||
https://source.chromium.org/chromium/chromium/src/+/master:third_party/breakpad/breakpad/src/google_breakpad/common
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* minidump_format.h: A cross-platform reimplementation of minidump-related
|
||||
* portions of DbgHelp.h from the Windows Platform SDK.
|
||||
*
|
||||
* (This is C99 source, please don't corrupt it with C++.)
|
||||
*
|
||||
* This file contains the necessary definitions to read minidump files
|
||||
* produced on MIPS. These files may be read on any platform provided
|
||||
* that the alignments of these structures on the processing system are
|
||||
* identical to the alignments of these structures on the producing system.
|
||||
* For this reason, precise-sized types are used. The structures defined
|
||||
* by this file have been laid out to minimize alignment problems by
|
||||
* ensuring that all members are aligned on their natural boundaries.
|
||||
* In some cases, tail-padding may be significant when different ABIs specify
|
||||
* different tail-padding behaviors. To avoid problems when reading or
|
||||
* writing affected structures, MD_*_SIZE macros are provided where needed,
|
||||
* containing the useful size of the structures without padding.
|
||||
*
|
||||
* Structures that are defined by Microsoft to contain a zero-length array
|
||||
* are instead defined here to contain an array with one element, as
|
||||
* zero-length arrays are forbidden by standard C and C++. In these cases,
|
||||
* *_minsize constants are provided to be used in place of sizeof. For a
|
||||
* cleaner interface to these sizes when using C++, see minidump_size.h.
|
||||
*
|
||||
* These structures are also sufficient to populate minidump files.
|
||||
*
|
||||
* Because precise data type sizes are crucial for this implementation to
|
||||
* function properly and portably, a set of primitive types with known sizes
|
||||
* are used as the basis of each structure defined by this file.
|
||||
*
|
||||
* Author: Chris Dearman
|
||||
*/
|
||||
|
||||
/*
|
||||
* MIPS support
|
||||
*/
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_MIPS_H__
|
||||
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_MIPS_H__
|
||||
|
||||
#define MD_CONTEXT_MIPS_GPR_COUNT 32
|
||||
#define MD_FLOATINGSAVEAREA_MIPS_FPR_COUNT 32
|
||||
#define MD_CONTEXT_MIPS_DSP_COUNT 3
|
||||
|
||||
/*
|
||||
* Note that these structures *do not* map directly to the CONTEXT
|
||||
* structure defined in WinNT.h in the Windows Mobile SDK. That structure
|
||||
* does not accomodate VFPv3, and I'm unsure if it was ever used in the
|
||||
* wild anyway, as Windows CE only seems to produce "cedumps" which
|
||||
* are not exactly minidumps.
|
||||
*/
|
||||
typedef struct {
|
||||
/* 32 64-bit floating point registers, f0..f31 */
|
||||
uint64_t regs[MD_FLOATINGSAVEAREA_MIPS_FPR_COUNT];
|
||||
|
||||
uint32_t fpcsr; /* FPU status register. */
|
||||
uint32_t fir; /* FPU implementation register. */
|
||||
} MDFloatingSaveAreaMIPS;
|
||||
|
||||
typedef struct {
|
||||
/* The next field determines the layout of the structure, and which parts
|
||||
* of it are populated.
|
||||
*/
|
||||
uint32_t context_flags;
|
||||
uint32_t _pad0;
|
||||
|
||||
/* 32 64-bit integer registers, r0..r31.
|
||||
* Note the following fixed uses:
|
||||
* r29 is the stack pointer.
|
||||
* r31 is the return address.
|
||||
*/
|
||||
uint64_t iregs[MD_CONTEXT_MIPS_GPR_COUNT];
|
||||
|
||||
/* multiply/divide result. */
|
||||
uint64_t mdhi, mdlo;
|
||||
|
||||
/* DSP accumulators. */
|
||||
uint32_t hi[MD_CONTEXT_MIPS_DSP_COUNT];
|
||||
uint32_t lo[MD_CONTEXT_MIPS_DSP_COUNT];
|
||||
uint32_t dsp_control;
|
||||
uint32_t _pad1;
|
||||
|
||||
uint64_t epc;
|
||||
uint64_t badvaddr;
|
||||
uint32_t status;
|
||||
uint32_t cause;
|
||||
|
||||
/* The next field is included with MD_CONTEXT_MIPS_FLOATING_POINT. */
|
||||
MDFloatingSaveAreaMIPS float_save;
|
||||
|
||||
} MDRawContextMIPS;
|
||||
|
||||
/* Indices into iregs for registers with a dedicated or conventional
|
||||
* purpose.
|
||||
*/
|
||||
enum MDMIPSRegisterNumbers {
|
||||
MD_CONTEXT_MIPS_REG_S0 = 16,
|
||||
MD_CONTEXT_MIPS_REG_S1 = 17,
|
||||
MD_CONTEXT_MIPS_REG_S2 = 18,
|
||||
MD_CONTEXT_MIPS_REG_S3 = 19,
|
||||
MD_CONTEXT_MIPS_REG_S4 = 20,
|
||||
MD_CONTEXT_MIPS_REG_S5 = 21,
|
||||
MD_CONTEXT_MIPS_REG_S6 = 22,
|
||||
MD_CONTEXT_MIPS_REG_S7 = 23,
|
||||
MD_CONTEXT_MIPS_REG_GP = 28,
|
||||
MD_CONTEXT_MIPS_REG_SP = 29,
|
||||
MD_CONTEXT_MIPS_REG_FP = 30,
|
||||
MD_CONTEXT_MIPS_REG_RA = 31,
|
||||
};
|
||||
|
||||
/* For (MDRawContextMIPS).context_flags. These values indicate the type of
|
||||
* context stored in the structure. */
|
||||
/* CONTEXT_MIPS from the Windows CE 5.0 SDK. This value isn't correct
|
||||
* because this bit can be used for flags. Presumably this value was
|
||||
* never actually used in minidumps, but only in "CEDumps" which
|
||||
* are a whole parallel minidump file format for Windows CE.
|
||||
* Therefore, Breakpad defines its own value for MIPS CPUs.
|
||||
*/
|
||||
#define MD_CONTEXT_MIPS 0x00040000
|
||||
#define MD_CONTEXT_MIPS_INTEGER (MD_CONTEXT_MIPS | 0x00000002)
|
||||
#define MD_CONTEXT_MIPS_FLOATING_POINT (MD_CONTEXT_MIPS | 0x00000004)
|
||||
#define MD_CONTEXT_MIPS_DSP (MD_CONTEXT_MIPS | 0x00000008)
|
||||
|
||||
#define MD_CONTEXT_MIPS_FULL (MD_CONTEXT_MIPS_INTEGER | \
|
||||
MD_CONTEXT_MIPS_FLOATING_POINT | \
|
||||
MD_CONTEXT_MIPS_DSP)
|
||||
|
||||
#define MD_CONTEXT_MIPS_ALL (MD_CONTEXT_MIPS_INTEGER | \
|
||||
MD_CONTEXT_MIPS_FLOATING_POINT \
|
||||
MD_CONTEXT_MIPS_DSP)
|
||||
|
||||
/**
|
||||
* Breakpad defines for MIPS64
|
||||
*/
|
||||
#define MD_CONTEXT_MIPS64 0x00080000
|
||||
#define MD_CONTEXT_MIPS64_INTEGER (MD_CONTEXT_MIPS64 | 0x00000002)
|
||||
#define MD_CONTEXT_MIPS64_FLOATING_POINT (MD_CONTEXT_MIPS64 | 0x00000004)
|
||||
#define MD_CONTEXT_MIPS64_DSP (MD_CONTEXT_MIPS64 | 0x00000008)
|
||||
|
||||
#define MD_CONTEXT_MIPS64_FULL (MD_CONTEXT_MIPS64_INTEGER | \
|
||||
MD_CONTEXT_MIPS64_FLOATING_POINT | \
|
||||
MD_CONTEXT_MIPS64_DSP)
|
||||
|
||||
#define MD_CONTEXT_MIPS64_ALL (MD_CONTEXT_MIPS64_INTEGER | \
|
||||
MD_CONTEXT_MIPS64_FLOATING_POINT \
|
||||
MD_CONTEXT_MIPS64_DSP)
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_MIPS_H__
|
||||
162
bfd/minidump-format/minidump_cpu_ppc.h
Normal file
162
bfd/minidump-format/minidump_cpu_ppc.h
Normal file
@@ -0,0 +1,162 @@
|
||||
/* Header file for the format of Windows minidumps.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
Written by Google LLC.
|
||||
Relicensed with permission, original at:
|
||||
https://source.chromium.org/chromium/chromium/src/+/master:third_party/breakpad/breakpad/src/google_breakpad/common
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* minidump_format.h: A cross-platform reimplementation of minidump-related
|
||||
* portions of DbgHelp.h from the Windows Platform SDK.
|
||||
*
|
||||
* (This is C99 source, please don't corrupt it with C++.)
|
||||
*
|
||||
* This file contains the necessary definitions to read minidump files
|
||||
* produced on ppc. These files may be read on any platform provided
|
||||
* that the alignments of these structures on the processing system are
|
||||
* identical to the alignments of these structures on the producing system.
|
||||
* For this reason, precise-sized types are used. The structures defined
|
||||
* by this file have been laid out to minimize alignment problems by ensuring
|
||||
* ensuring that all members are aligned on their natural boundaries. In
|
||||
* In some cases, tail-padding may be significant when different ABIs specify
|
||||
* different tail-padding behaviors. To avoid problems when reading or
|
||||
* writing affected structures, MD_*_SIZE macros are provided where needed,
|
||||
* containing the useful size of the structures without padding.
|
||||
*
|
||||
* Structures that are defined by Microsoft to contain a zero-length array
|
||||
* are instead defined here to contain an array with one element, as
|
||||
* zero-length arrays are forbidden by standard C and C++. In these cases,
|
||||
* *_minsize constants are provided to be used in place of sizeof. For a
|
||||
* cleaner interface to these sizes when using C++, see minidump_size.h.
|
||||
*
|
||||
* These structures are also sufficient to populate minidump files.
|
||||
*
|
||||
* These definitions may be extended to support handling minidump files
|
||||
* for other CPUs and other operating systems.
|
||||
*
|
||||
* Because precise data type sizes are crucial for this implementation to
|
||||
* function properly and portably in terms of interoperability with minidumps
|
||||
* produced by DbgHelp on Windows, a set of primitive types with known sizes
|
||||
* are used as the basis of each structure defined by this file. DbgHelp
|
||||
* on Windows is assumed to be the reference implementation; this file
|
||||
* seeks to provide a cross-platform compatible implementation. To avoid
|
||||
* collisions with the types and values defined and used by DbgHelp in the
|
||||
* event that this implementation is used on Windows, each type and value
|
||||
* defined here is given a new name, beginning with "MD". Names of the
|
||||
* equivalent types and values in the Windows Platform SDK are given in
|
||||
* comments.
|
||||
*
|
||||
* Author: Mark Mentovai
|
||||
* Change to split into its own file: Neal Sidhwaney */
|
||||
|
||||
/*
|
||||
* Breakpad minidump extension for PowerPC support. Based on Darwin/Mac OS X'
|
||||
* mach/ppc/_types.h
|
||||
*/
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_PPC_H__
|
||||
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_PPC_H__
|
||||
|
||||
#define MD_FLOATINGSAVEAREA_PPC_FPR_COUNT 32
|
||||
|
||||
typedef struct {
|
||||
/* fpregs is a double[32] in mach/ppc/_types.h, but a uint64_t is used
|
||||
* here for precise sizing. */
|
||||
uint64_t fpregs[MD_FLOATINGSAVEAREA_PPC_FPR_COUNT];
|
||||
uint32_t fpscr_pad;
|
||||
uint32_t fpscr; /* Status/control */
|
||||
} MDFloatingSaveAreaPPC; /* Based on ppc_float_state */
|
||||
|
||||
|
||||
#define MD_VECTORSAVEAREA_PPC_VR_COUNT 32
|
||||
|
||||
typedef struct {
|
||||
/* Vector registers (including vscr) are 128 bits, but mach/ppc/_types.h
|
||||
* exposes them as four 32-bit quantities. */
|
||||
uint128_struct save_vr[MD_VECTORSAVEAREA_PPC_VR_COUNT];
|
||||
uint128_struct save_vscr; /* Status/control */
|
||||
uint32_t save_pad5[4];
|
||||
uint32_t save_vrvalid; /* Indicates which vector registers are saved */
|
||||
uint32_t save_pad6[7];
|
||||
} MDVectorSaveAreaPPC; /* ppc_vector_state */
|
||||
|
||||
|
||||
#define MD_CONTEXT_PPC_GPR_COUNT 32
|
||||
|
||||
/* Use the same 32-bit alignment when accessing this structure from 64-bit code
|
||||
* as is used natively in 32-bit code. #pragma pack is a MSVC extension
|
||||
* supported by gcc. */
|
||||
#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||
#pragma pack(4)
|
||||
#else
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
/* context_flags is not present in ppc_thread_state, but it aids
|
||||
* identification of MDRawContextPPC among other raw context types,
|
||||
* and it guarantees alignment when we get to float_save. */
|
||||
uint32_t context_flags;
|
||||
|
||||
uint32_t srr0; /* Machine status save/restore: stores pc
|
||||
* (instruction) */
|
||||
uint32_t srr1; /* Machine status save/restore: stores msr
|
||||
* (ps, program/machine state) */
|
||||
/* ppc_thread_state contains 32 fields, r0 .. r31. Here, an array is
|
||||
* used for brevity. */
|
||||
uint32_t gpr[MD_CONTEXT_PPC_GPR_COUNT];
|
||||
uint32_t cr; /* Condition */
|
||||
uint32_t xer; /* Integer (fiXed-point) exception */
|
||||
uint32_t lr; /* Link */
|
||||
uint32_t ctr; /* Count */
|
||||
uint32_t mq; /* Multiply/Quotient (PPC 601, POWER only) */
|
||||
uint32_t vrsave; /* Vector save */
|
||||
|
||||
/* float_save and vector_save aren't present in ppc_thread_state, but
|
||||
* are represented in separate structures that still define a thread's
|
||||
* context. */
|
||||
MDFloatingSaveAreaPPC float_save;
|
||||
MDVectorSaveAreaPPC vector_save;
|
||||
} MDRawContextPPC; /* Based on ppc_thread_state */
|
||||
|
||||
/* Indices into gpr for registers with a dedicated or conventional purpose. */
|
||||
enum MDPPCRegisterNumbers {
|
||||
MD_CONTEXT_PPC_REG_SP = 1
|
||||
};
|
||||
|
||||
#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||
#pragma pack(0)
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
/* For (MDRawContextPPC).context_flags. These values indicate the type of
|
||||
* context stored in the structure. MD_CONTEXT_PPC is Breakpad-defined. Its
|
||||
* value was chosen to avoid likely conflicts with MD_CONTEXT_* for other
|
||||
* CPUs. */
|
||||
#define MD_CONTEXT_PPC 0x20000000
|
||||
#define MD_CONTEXT_PPC_BASE (MD_CONTEXT_PPC | 0x00000001)
|
||||
#define MD_CONTEXT_PPC_FLOATING_POINT (MD_CONTEXT_PPC | 0x00000008)
|
||||
#define MD_CONTEXT_PPC_VECTOR (MD_CONTEXT_PPC | 0x00000020)
|
||||
|
||||
#define MD_CONTEXT_PPC_FULL MD_CONTEXT_PPC_BASE
|
||||
#define MD_CONTEXT_PPC_ALL (MD_CONTEXT_PPC_FULL | \
|
||||
MD_CONTEXT_PPC_FLOATING_POINT | \
|
||||
MD_CONTEXT_PPC_VECTOR)
|
||||
|
||||
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_PPC_H__ */
|
||||
128
bfd/minidump-format/minidump_cpu_ppc64.h
Normal file
128
bfd/minidump-format/minidump_cpu_ppc64.h
Normal file
@@ -0,0 +1,128 @@
|
||||
/* Header file for the format of Windows minidumps.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
Written by Google LLC.
|
||||
Relicensed with permission, original at:
|
||||
https://source.chromium.org/chromium/chromium/src/+/master:third_party/breakpad/breakpad/src/google_breakpad/common
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* minidump_format.h: A cross-platform reimplementation of minidump-related
|
||||
* portions of DbgHelp.h from the Windows Platform SDK.
|
||||
*
|
||||
* (This is C99 source, please don't corrupt it with C++.)
|
||||
*
|
||||
* This file contains the necessary definitions to read minidump files
|
||||
* produced on ppc64. These files may be read on any platform provided
|
||||
* that the alignments of these structures on the processing system are
|
||||
* identical to the alignments of these structures on the producing system.
|
||||
* For this reason, precise-sized types are used. The structures defined
|
||||
* by this file have been laid out to minimize alignment problems by ensuring
|
||||
* ensuring that all members are aligned on their natural boundaries. In
|
||||
* In some cases, tail-padding may be significant when different ABIs specify
|
||||
* different tail-padding behaviors. To avoid problems when reading or
|
||||
* writing affected structures, MD_*_SIZE macros are provided where needed,
|
||||
* containing the useful size of the structures without padding.
|
||||
*
|
||||
* Structures that are defined by Microsoft to contain a zero-length array
|
||||
* are instead defined here to contain an array with one element, as
|
||||
* zero-length arrays are forbidden by standard C and C++. In these cases,
|
||||
* *_minsize constants are provided to be used in place of sizeof. For a
|
||||
* cleaner interface to these sizes when using C++, see minidump_size.h.
|
||||
*
|
||||
* These structures are also sufficient to populate minidump files.
|
||||
*
|
||||
* These definitions may be extended to support handling minidump files
|
||||
* for other CPUs and other operating systems.
|
||||
*
|
||||
* Because precise data type sizes are crucial for this implementation to
|
||||
* function properly and portably in terms of interoperability with minidumps
|
||||
* produced by DbgHelp on Windows, a set of primitive types with known sizes
|
||||
* are used as the basis of each structure defined by this file. DbgHelp
|
||||
* on Windows is assumed to be the reference implementation; this file
|
||||
* seeks to provide a cross-platform compatible implementation. To avoid
|
||||
* collisions with the types and values defined and used by DbgHelp in the
|
||||
* event that this implementation is used on Windows, each type and value
|
||||
* defined here is given a new name, beginning with "MD". Names of the
|
||||
* equivalent types and values in the Windows Platform SDK are given in
|
||||
* comments.
|
||||
*
|
||||
* Author: Neal Sidhwaney */
|
||||
|
||||
|
||||
/*
|
||||
* Breakpad minidump extension for PPC64 support. Based on Darwin/Mac OS X'
|
||||
* mach/ppc/_types.h
|
||||
*/
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_PPC64_H__
|
||||
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_PPC64_H__
|
||||
|
||||
#include "minidump_cpu_ppc.h"
|
||||
|
||||
// these types are the same in ppc64 & ppc
|
||||
typedef MDFloatingSaveAreaPPC MDFloatingSaveAreaPPC64;
|
||||
typedef MDVectorSaveAreaPPC MDVectorSaveAreaPPC64;
|
||||
|
||||
#define MD_CONTEXT_PPC64_GPR_COUNT MD_CONTEXT_PPC_GPR_COUNT
|
||||
|
||||
typedef struct {
|
||||
/* context_flags is not present in ppc_thread_state, but it aids
|
||||
* identification of MDRawContextPPC among other raw context types,
|
||||
* and it guarantees alignment when we get to float_save. */
|
||||
uint64_t context_flags;
|
||||
|
||||
uint64_t srr0; /* Machine status save/restore: stores pc
|
||||
* (instruction) */
|
||||
uint64_t srr1; /* Machine status save/restore: stores msr
|
||||
* (ps, program/machine state) */
|
||||
/* ppc_thread_state contains 32 fields, r0 .. r31. Here, an array is
|
||||
* used for brevity. */
|
||||
uint64_t gpr[MD_CONTEXT_PPC64_GPR_COUNT];
|
||||
uint64_t cr; /* Condition */
|
||||
uint64_t xer; /* Integer (fiXed-point) exception */
|
||||
uint64_t lr; /* Link */
|
||||
uint64_t ctr; /* Count */
|
||||
uint64_t vrsave; /* Vector save */
|
||||
|
||||
/* float_save and vector_save aren't present in ppc_thread_state, but
|
||||
* are represented in separate structures that still define a thread's
|
||||
* context. */
|
||||
MDFloatingSaveAreaPPC float_save;
|
||||
MDVectorSaveAreaPPC vector_save;
|
||||
} MDRawContextPPC64; /* Based on ppc_thread_state */
|
||||
|
||||
/* Indices into gpr for registers with a dedicated or conventional purpose. */
|
||||
enum MDPPC64RegisterNumbers {
|
||||
MD_CONTEXT_PPC64_REG_SP = 1
|
||||
};
|
||||
|
||||
/* For (MDRawContextPPC).context_flags. These values indicate the type of
|
||||
* context stored in the structure. MD_CONTEXT_PPC is Breakpad-defined. Its
|
||||
* value was chosen to avoid likely conflicts with MD_CONTEXT_* for other
|
||||
* CPUs. */
|
||||
#define MD_CONTEXT_PPC64 0x01000000
|
||||
#define MD_CONTEXT_PPC64_BASE (MD_CONTEXT_PPC64 | 0x00000001)
|
||||
#define MD_CONTEXT_PPC64_FLOATING_POINT (MD_CONTEXT_PPC64 | 0x00000008)
|
||||
#define MD_CONTEXT_PPC64_VECTOR (MD_CONTEXT_PPC64 | 0x00000020)
|
||||
|
||||
#define MD_CONTEXT_PPC64_FULL MD_CONTEXT_PPC64_BASE
|
||||
#define MD_CONTEXT_PPC64_ALL (MD_CONTEXT_PPC64_FULL | \
|
||||
MD_CONTEXT_PPC64_FLOATING_POINT | \
|
||||
MD_CONTEXT_PPC64_VECTOR)
|
||||
|
||||
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_PPC64_H__ */
|
||||
157
bfd/minidump-format/minidump_cpu_sparc.h
Normal file
157
bfd/minidump-format/minidump_cpu_sparc.h
Normal file
@@ -0,0 +1,157 @@
|
||||
/* Header file for the format of Windows minidumps.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
Written by Google LLC.
|
||||
Relicensed with permission, original at:
|
||||
https://source.chromium.org/chromium/chromium/src/+/master:third_party/breakpad/breakpad/src/google_breakpad/common
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* minidump_format.h: A cross-platform reimplementation of minidump-related
|
||||
* portions of DbgHelp.h from the Windows Platform SDK.
|
||||
*
|
||||
* (This is C99 source, please don't corrupt it with C++.)
|
||||
*
|
||||
* This file contains the necessary definitions to read minidump files
|
||||
* produced on sparc. These files may be read on any platform provided
|
||||
* that the alignments of these structures on the processing system are
|
||||
* identical to the alignments of these structures on the producing system.
|
||||
* For this reason, precise-sized types are used. The structures defined
|
||||
* by this file have been laid out to minimize alignment problems by ensuring
|
||||
* ensuring that all members are aligned on their natural boundaries. In
|
||||
* In some cases, tail-padding may be significant when different ABIs specify
|
||||
* different tail-padding behaviors. To avoid problems when reading or
|
||||
* writing affected structures, MD_*_SIZE macros are provided where needed,
|
||||
* containing the useful size of the structures without padding.
|
||||
*
|
||||
* Structures that are defined by Microsoft to contain a zero-length array
|
||||
* are instead defined here to contain an array with one element, as
|
||||
* zero-length arrays are forbidden by standard C and C++. In these cases,
|
||||
* *_minsize constants are provided to be used in place of sizeof. For a
|
||||
* cleaner interface to these sizes when using C++, see minidump_size.h.
|
||||
*
|
||||
* These structures are also sufficient to populate minidump files.
|
||||
*
|
||||
* These definitions may be extended to support handling minidump files
|
||||
* for other CPUs and other operating systems.
|
||||
*
|
||||
* Because precise data type sizes are crucial for this implementation to
|
||||
* function properly and portably in terms of interoperability with minidumps
|
||||
* produced by DbgHelp on Windows, a set of primitive types with known sizes
|
||||
* are used as the basis of each structure defined by this file. DbgHelp
|
||||
* on Windows is assumed to be the reference implementation; this file
|
||||
* seeks to provide a cross-platform compatible implementation. To avoid
|
||||
* collisions with the types and values defined and used by DbgHelp in the
|
||||
* event that this implementation is used on Windows, each type and value
|
||||
* defined here is given a new name, beginning with "MD". Names of the
|
||||
* equivalent types and values in the Windows Platform SDK are given in
|
||||
* comments.
|
||||
*
|
||||
* Author: Mark Mentovai
|
||||
* Change to split into its own file: Neal Sidhwaney */
|
||||
|
||||
/*
|
||||
* SPARC support, see (solaris)sys/procfs_isa.h also
|
||||
*/
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_SPARC_H__
|
||||
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_SPARC_H__
|
||||
|
||||
#define MD_FLOATINGSAVEAREA_SPARC_FPR_COUNT 32
|
||||
|
||||
typedef struct {
|
||||
|
||||
/* FPU floating point regs */
|
||||
uint64_t regs[MD_FLOATINGSAVEAREA_SPARC_FPR_COUNT];
|
||||
|
||||
uint64_t filler;
|
||||
uint64_t fsr; /* FPU status register */
|
||||
} MDFloatingSaveAreaSPARC; /* FLOATING_SAVE_AREA */
|
||||
|
||||
#define MD_CONTEXT_SPARC_GPR_COUNT 32
|
||||
|
||||
typedef struct {
|
||||
/* The next field determines the layout of the structure, and which parts
|
||||
* of it are populated
|
||||
*/
|
||||
uint32_t context_flags;
|
||||
uint32_t flag_pad;
|
||||
/*
|
||||
* General register access (SPARC).
|
||||
* Don't confuse definitions here with definitions in <sys/regset.h>.
|
||||
* Registers are 32 bits for ILP32, 64 bits for LP64.
|
||||
* SPARC V7/V8 is for 32bit, SPARC V9 is for 64bit
|
||||
*/
|
||||
|
||||
/* 32 Integer working registers */
|
||||
|
||||
/* g_r[0-7] global registers(g0-g7)
|
||||
* g_r[8-15] out registers(o0-o7)
|
||||
* g_r[16-23] local registers(l0-l7)
|
||||
* g_r[24-31] in registers(i0-i7)
|
||||
*/
|
||||
uint64_t g_r[MD_CONTEXT_SPARC_GPR_COUNT];
|
||||
|
||||
/* several control registers */
|
||||
|
||||
/* Processor State register(PSR) for SPARC V7/V8
|
||||
* Condition Code register (CCR) for SPARC V9
|
||||
*/
|
||||
uint64_t ccr;
|
||||
|
||||
uint64_t pc; /* Program Counter register (PC) */
|
||||
uint64_t npc; /* Next Program Counter register (nPC) */
|
||||
uint64_t y; /* Y register (Y) */
|
||||
|
||||
/* Address Space Identifier register (ASI) for SPARC V9
|
||||
* WIM for SPARC V7/V8
|
||||
*/
|
||||
uint64_t asi;
|
||||
|
||||
/* Floating-Point Registers State register (FPRS) for SPARC V9
|
||||
* TBR for for SPARC V7/V8
|
||||
*/
|
||||
uint64_t fprs;
|
||||
|
||||
/* The next field is included with MD_CONTEXT_SPARC_FLOATING_POINT */
|
||||
MDFloatingSaveAreaSPARC float_save;
|
||||
|
||||
} MDRawContextSPARC; /* CONTEXT_SPARC */
|
||||
|
||||
/* Indices into g_r for registers with a dedicated or conventional purpose. */
|
||||
enum MDSPARCRegisterNumbers {
|
||||
MD_CONTEXT_SPARC_REG_SP = 14
|
||||
};
|
||||
|
||||
/* For (MDRawContextSPARC).context_flags. These values indicate the type of
|
||||
* context stored in the structure. MD_CONTEXT_SPARC is Breakpad-defined. Its
|
||||
* value was chosen to avoid likely conflicts with MD_CONTEXT_* for other
|
||||
* CPUs. */
|
||||
#define MD_CONTEXT_SPARC 0x10000000
|
||||
#define MD_CONTEXT_SPARC_CONTROL (MD_CONTEXT_SPARC | 0x00000001)
|
||||
#define MD_CONTEXT_SPARC_INTEGER (MD_CONTEXT_SPARC | 0x00000002)
|
||||
#define MD_CONTEXT_SAPARC_FLOATING_POINT (MD_CONTEXT_SPARC | 0x00000004)
|
||||
#define MD_CONTEXT_SAPARC_EXTRA (MD_CONTEXT_SPARC | 0x00000008)
|
||||
|
||||
#define MD_CONTEXT_SPARC_FULL (MD_CONTEXT_SPARC_CONTROL | \
|
||||
MD_CONTEXT_SPARC_INTEGER)
|
||||
|
||||
#define MD_CONTEXT_SPARC_ALL (MD_CONTEXT_SPARC_FULL | \
|
||||
MD_CONTEXT_SAPARC_FLOATING_POINT | \
|
||||
MD_CONTEXT_SAPARC_EXTRA)
|
||||
|
||||
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_SPARC_H__ */
|
||||
168
bfd/minidump-format/minidump_cpu_x86.h
Normal file
168
bfd/minidump-format/minidump_cpu_x86.h
Normal file
@@ -0,0 +1,168 @@
|
||||
/* Header file for the format of Windows minidumps.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
Written by Google LLC.
|
||||
Relicensed with permission, original at:
|
||||
https://source.chromium.org/chromium/chromium/src/+/master:third_party/breakpad/breakpad/src/google_breakpad/common
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* minidump_format.h: A cross-platform reimplementation of minidump-related
|
||||
* portions of DbgHelp.h from the Windows Platform SDK.
|
||||
*
|
||||
* (This is C99 source, please don't corrupt it with C++.)
|
||||
*
|
||||
* This file contains the necessary definitions to read minidump files
|
||||
* produced on x86. These files may be read on any platform provided
|
||||
* that the alignments of these structures on the processing system are
|
||||
* identical to the alignments of these structures on the producing system.
|
||||
* For this reason, precise-sized types are used. The structures defined
|
||||
* by this file have been laid out to minimize alignment problems by ensuring
|
||||
* ensuring that all members are aligned on their natural boundaries. In
|
||||
* In some cases, tail-padding may be significant when different ABIs specify
|
||||
* different tail-padding behaviors. To avoid problems when reading or
|
||||
* writing affected structures, MD_*_SIZE macros are provided where needed,
|
||||
* containing the useful size of the structures without padding.
|
||||
*
|
||||
* Structures that are defined by Microsoft to contain a zero-length array
|
||||
* are instead defined here to contain an array with one element, as
|
||||
* zero-length arrays are forbidden by standard C and C++. In these cases,
|
||||
* *_minsize constants are provided to be used in place of sizeof. For a
|
||||
* cleaner interface to these sizes when using C++, see minidump_size.h.
|
||||
*
|
||||
* These structures are also sufficient to populate minidump files.
|
||||
*
|
||||
* These definitions may be extended to support handling minidump files
|
||||
* for other CPUs and other operating systems.
|
||||
*
|
||||
* Because precise data type sizes are crucial for this implementation to
|
||||
* function properly and portably in terms of interoperability with minidumps
|
||||
* produced by DbgHelp on Windows, a set of primitive types with known sizes
|
||||
* are used as the basis of each structure defined by this file. DbgHelp
|
||||
* on Windows is assumed to be the reference implementation; this file
|
||||
* seeks to provide a cross-platform compatible implementation. To avoid
|
||||
* collisions with the types and values defined and used by DbgHelp in the
|
||||
* event that this implementation is used on Windows, each type and value
|
||||
* defined here is given a new name, beginning with "MD". Names of the
|
||||
* equivalent types and values in the Windows Platform SDK are given in
|
||||
* comments.
|
||||
*
|
||||
* Author: Mark Mentovai */
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_X86_H__
|
||||
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_X86_H__
|
||||
|
||||
#define MD_FLOATINGSAVEAREA_X86_REGISTERAREA_SIZE 80
|
||||
/* SIZE_OF_80387_REGISTERS */
|
||||
|
||||
typedef struct {
|
||||
uint32_t control_word;
|
||||
uint32_t status_word;
|
||||
uint32_t tag_word;
|
||||
uint32_t error_offset;
|
||||
uint32_t error_selector;
|
||||
uint32_t data_offset;
|
||||
uint32_t data_selector;
|
||||
|
||||
/* register_area contains eight 80-bit (x87 "long double") quantities for
|
||||
* floating-point registers %st0 (%mm0) through %st7 (%mm7). */
|
||||
uint8_t register_area[MD_FLOATINGSAVEAREA_X86_REGISTERAREA_SIZE];
|
||||
uint32_t cr0_npx_state;
|
||||
} MDFloatingSaveAreaX86; /* FLOATING_SAVE_AREA */
|
||||
|
||||
|
||||
#define MD_CONTEXT_X86_EXTENDED_REGISTERS_SIZE 512
|
||||
/* MAXIMUM_SUPPORTED_EXTENSION */
|
||||
|
||||
typedef struct {
|
||||
/* The next field determines the layout of the structure, and which parts
|
||||
* of it are populated */
|
||||
uint32_t context_flags;
|
||||
|
||||
/* The next 6 registers are included with MD_CONTEXT_X86_DEBUG_REGISTERS */
|
||||
uint32_t dr0;
|
||||
uint32_t dr1;
|
||||
uint32_t dr2;
|
||||
uint32_t dr3;
|
||||
uint32_t dr6;
|
||||
uint32_t dr7;
|
||||
|
||||
/* The next field is included with MD_CONTEXT_X86_FLOATING_POINT */
|
||||
MDFloatingSaveAreaX86 float_save;
|
||||
|
||||
/* The next 4 registers are included with MD_CONTEXT_X86_SEGMENTS */
|
||||
uint32_t gs;
|
||||
uint32_t fs;
|
||||
uint32_t es;
|
||||
uint32_t ds;
|
||||
/* The next 6 registers are included with MD_CONTEXT_X86_INTEGER */
|
||||
uint32_t edi;
|
||||
uint32_t esi;
|
||||
uint32_t ebx;
|
||||
uint32_t edx;
|
||||
uint32_t ecx;
|
||||
uint32_t eax;
|
||||
|
||||
/* The next 6 registers are included with MD_CONTEXT_X86_CONTROL */
|
||||
uint32_t ebp;
|
||||
uint32_t eip;
|
||||
uint32_t cs; /* WinNT.h says "must be sanitized" */
|
||||
uint32_t eflags; /* WinNT.h says "must be sanitized" */
|
||||
uint32_t esp;
|
||||
uint32_t ss;
|
||||
|
||||
/* The next field is included with MD_CONTEXT_X86_EXTENDED_REGISTERS.
|
||||
* It contains vector (MMX/SSE) registers. It it laid out in the
|
||||
* format used by the fxsave and fsrstor instructions, so it includes
|
||||
* a copy of the x87 floating-point registers as well. See FXSAVE in
|
||||
* "Intel Architecture Software Developer's Manual, Volume 2." */
|
||||
uint8_t extended_registers[
|
||||
MD_CONTEXT_X86_EXTENDED_REGISTERS_SIZE];
|
||||
} MDRawContextX86; /* CONTEXT */
|
||||
|
||||
/* For (MDRawContextX86).context_flags. These values indicate the type of
|
||||
* context stored in the structure. The high 24 bits identify the CPU, the
|
||||
* low 8 bits identify the type of context saved. */
|
||||
#define MD_CONTEXT_X86 0x00010000
|
||||
/* CONTEXT_i386, CONTEXT_i486: identifies CPU */
|
||||
#define MD_CONTEXT_X86_CONTROL (MD_CONTEXT_X86 | 0x00000001)
|
||||
/* CONTEXT_CONTROL */
|
||||
#define MD_CONTEXT_X86_INTEGER (MD_CONTEXT_X86 | 0x00000002)
|
||||
/* CONTEXT_INTEGER */
|
||||
#define MD_CONTEXT_X86_SEGMENTS (MD_CONTEXT_X86 | 0x00000004)
|
||||
/* CONTEXT_SEGMENTS */
|
||||
#define MD_CONTEXT_X86_FLOATING_POINT (MD_CONTEXT_X86 | 0x00000008)
|
||||
/* CONTEXT_FLOATING_POINT */
|
||||
#define MD_CONTEXT_X86_DEBUG_REGISTERS (MD_CONTEXT_X86 | 0x00000010)
|
||||
/* CONTEXT_DEBUG_REGISTERS */
|
||||
#define MD_CONTEXT_X86_EXTENDED_REGISTERS (MD_CONTEXT_X86 | 0x00000020)
|
||||
/* CONTEXT_EXTENDED_REGISTERS */
|
||||
#define MD_CONTEXT_X86_XSTATE (MD_CONTEXT_X86 | 0x00000040)
|
||||
/* CONTEXT_XSTATE */
|
||||
|
||||
#define MD_CONTEXT_X86_FULL (MD_CONTEXT_X86_CONTROL | \
|
||||
MD_CONTEXT_X86_INTEGER | \
|
||||
MD_CONTEXT_X86_SEGMENTS)
|
||||
/* CONTEXT_FULL */
|
||||
|
||||
#define MD_CONTEXT_X86_ALL (MD_CONTEXT_X86_FULL | \
|
||||
MD_CONTEXT_X86_FLOATING_POINT | \
|
||||
MD_CONTEXT_X86_DEBUG_REGISTERS | \
|
||||
MD_CONTEXT_X86_EXTENDED_REGISTERS)
|
||||
/* CONTEXT_ALL */
|
||||
|
||||
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_X86_H__ */
|
||||
52
bfd/minidump-format/minidump_exception_fuchsia.h
Normal file
52
bfd/minidump-format/minidump_exception_fuchsia.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* Header file for the format of Windows minidumps.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
Written by Google LLC.
|
||||
Relicensed with permission, original at:
|
||||
https://source.chromium.org/chromium/chromium/src/+/master:third_party/breakpad/breakpad/src/google_breakpad/common
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* minidump_exception_fuchsia.h: A definition of exception codes for Fuchsia.
|
||||
*
|
||||
* Author: Ivan Penkov */
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_FUCHSIA_H_
|
||||
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_FUCHSIA_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "breakpad_types.h"
|
||||
|
||||
// Based on zircon/system/public/zircon/syscalls/exception.h
|
||||
typedef enum {
|
||||
// Architectural exceptions
|
||||
MD_EXCEPTION_CODE_FUCHSIA_GENERAL = 0x8,
|
||||
MD_EXCEPTION_CODE_FUCHSIA_FATAL_PAGE_FAULT = 0x108,
|
||||
MD_EXCEPTION_CODE_FUCHSIA_UNDEFINED_INSTRUCTION = 0x208,
|
||||
MD_EXCEPTION_CODE_FUCHSIA_SW_BREAKPOINT = 0x308,
|
||||
MD_EXCEPTION_CODE_FUCHSIA_HW_BREAKPOINT = 0x408,
|
||||
MD_EXCEPTION_CODE_FUCHSIA_UNALIGNED_ACCESS = 0x508,
|
||||
//
|
||||
// Synthetic exceptions
|
||||
MD_EXCEPTION_CODE_FUCHSIA_THREAD_STARTING = 0x8008,
|
||||
MD_EXCEPTION_CODE_FUCHSIA_THREAD_EXITING = 0x8108,
|
||||
MD_EXCEPTION_CODE_FUCHSIA_POLICY_ERROR = 0x8208,
|
||||
MD_EXCEPTION_CODE_FUCHSIA_PROCESS_STARTING = 0x8308,
|
||||
} MDExceptionCodeFuchsia;
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_FUCHSIA_H_
|
||||
119
bfd/minidump-format/minidump_exception_linux.h
Normal file
119
bfd/minidump-format/minidump_exception_linux.h
Normal file
@@ -0,0 +1,119 @@
|
||||
/* Header file for the format of Windows minidumps.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
Written by Google LLC.
|
||||
Relicensed with permission, original at:
|
||||
https://source.chromium.org/chromium/chromium/src/+/master:third_party/breakpad/breakpad/src/google_breakpad/common
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* minidump_exception_linux.h: A definition of exception codes for
|
||||
* Linux
|
||||
*
|
||||
* (This is C99 source, please don't corrupt it with C++.)
|
||||
*
|
||||
* Author: Mark Mentovai
|
||||
* Split into its own file: Neal Sidhwaney */
|
||||
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_LINUX_H__
|
||||
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_LINUX_H__
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "breakpad_types.h"
|
||||
|
||||
|
||||
/* For (MDException).exception_code. These values come from bits/signum.h.
|
||||
*/
|
||||
typedef enum {
|
||||
MD_EXCEPTION_CODE_LIN_SIGHUP = 1, /* Hangup (POSIX) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGINT = 2, /* Interrupt (ANSI) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGQUIT = 3, /* Quit (POSIX) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGILL = 4, /* Illegal instruction (ANSI) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGTRAP = 5, /* Trace trap (POSIX) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGABRT = 6, /* Abort (ANSI) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGBUS = 7, /* BUS error (4.2 BSD) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGFPE = 8, /* Floating-point exception (ANSI) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGKILL = 9, /* Kill, unblockable (POSIX) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGUSR1 = 10, /* User-defined signal 1 (POSIX). */
|
||||
MD_EXCEPTION_CODE_LIN_SIGSEGV = 11, /* Segmentation violation (ANSI) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGUSR2 = 12, /* User-defined signal 2 (POSIX) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGPIPE = 13, /* Broken pipe (POSIX) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGALRM = 14, /* Alarm clock (POSIX) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGTERM = 15, /* Termination (ANSI) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGSTKFLT = 16, /* Stack faultd */
|
||||
MD_EXCEPTION_CODE_LIN_SIGCHLD = 17, /* Child status has changed (POSIX) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGCONT = 18, /* Continue (POSIX) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGSTOP = 19, /* Stop, unblockable (POSIX) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGTSTP = 20, /* Keyboard stop (POSIX) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGTTIN = 21, /* Background read from tty (POSIX) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGTTOU = 22, /* Background write to tty (POSIX) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGURG = 23,
|
||||
/* Urgent condition on socket (4.2 BSD) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGXCPU = 24, /* CPU limit exceeded (4.2 BSD) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGXFSZ = 25,
|
||||
/* File size limit exceeded (4.2 BSD) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGVTALRM = 26, /* Virtual alarm clock (4.2 BSD) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGPROF = 27, /* Profiling alarm clock (4.2 BSD) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGWINCH = 28, /* Window size change (4.3 BSD, Sun) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGIO = 29, /* I/O now possible (4.2 BSD) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGPWR = 30, /* Power failure restart (System V) */
|
||||
MD_EXCEPTION_CODE_LIN_SIGSYS = 31, /* Bad system call */
|
||||
MD_EXCEPTION_CODE_LIN_DUMP_REQUESTED = 0xFFFFFFFF /* No exception,
|
||||
dump requested. */
|
||||
} MDExceptionCodeLinux;
|
||||
|
||||
/* For (MDException).exception_flags. These values come from
|
||||
* asm-generic/siginfo.h.
|
||||
*/
|
||||
typedef enum {
|
||||
/* SIGILL */
|
||||
MD_EXCEPTION_FLAG_LIN_ILL_ILLOPC = 1,
|
||||
MD_EXCEPTION_FLAG_LIN_ILL_ILLOPN = 2,
|
||||
MD_EXCEPTION_FLAG_LIN_ILL_ILLADR = 3,
|
||||
MD_EXCEPTION_FLAG_LIN_ILL_ILLTRP = 4,
|
||||
MD_EXCEPTION_FLAG_LIN_ILL_PRVOPC = 5,
|
||||
MD_EXCEPTION_FLAG_LIN_ILL_PRVREG = 6,
|
||||
MD_EXCEPTION_FLAG_LIN_ILL_COPROC = 7,
|
||||
MD_EXCEPTION_FLAG_LIN_ILL_BADSTK = 8,
|
||||
|
||||
/* SIGFPE */
|
||||
MD_EXCEPTION_FLAG_LIN_FPE_INTDIV = 1,
|
||||
MD_EXCEPTION_FLAG_LIN_FPE_INTOVF = 2,
|
||||
MD_EXCEPTION_FLAG_LIN_FPE_FLTDIV = 3,
|
||||
MD_EXCEPTION_FLAG_LIN_FPE_FLTOVF = 4,
|
||||
MD_EXCEPTION_FLAG_LIN_FPE_FLTUND = 5,
|
||||
MD_EXCEPTION_FLAG_LIN_FPE_FLTRES = 6,
|
||||
MD_EXCEPTION_FLAG_LIN_FPE_FLTINV = 7,
|
||||
MD_EXCEPTION_FLAG_LIN_FPE_FLTSUB = 8,
|
||||
|
||||
/* SIGSEGV */
|
||||
MD_EXCEPTION_FLAG_LIN_SEGV_MAPERR = 1,
|
||||
MD_EXCEPTION_FLAG_LIN_SEGV_ACCERR = 2,
|
||||
MD_EXCEPTION_FLAG_LIN_SEGV_BNDERR = 3,
|
||||
MD_EXCEPTION_FLAG_LIN_SEGV_PKUERR = 4,
|
||||
|
||||
/* SIGBUS */
|
||||
MD_EXCEPTION_FLAG_LIN_BUS_ADRALN = 1,
|
||||
MD_EXCEPTION_FLAG_LIN_BUS_ADRERR = 2,
|
||||
MD_EXCEPTION_FLAG_LIN_BUS_OBJERR = 3,
|
||||
MD_EXCEPTION_FLAG_LIN_BUS_MCEERR_AR = 4,
|
||||
MD_EXCEPTION_FLAG_LIN_BUS_MCEERR_AO = 5,
|
||||
} MDExceptionFlagLinux;
|
||||
|
||||
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_LINUX_H__ */
|
||||
203
bfd/minidump-format/minidump_exception_mac.h
Normal file
203
bfd/minidump-format/minidump_exception_mac.h
Normal file
@@ -0,0 +1,203 @@
|
||||
/* Header file for the format of Windows minidumps.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
Written by Google LLC.
|
||||
Relicensed with permission, original at:
|
||||
https://source.chromium.org/chromium/chromium/src/+/master:third_party/breakpad/breakpad/src/google_breakpad/common
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* minidump_exception_mac.h: A definition of exception codes for Mac
|
||||
* OS X
|
||||
*
|
||||
* (This is C99 source, please don't corrupt it with C++.)
|
||||
*
|
||||
* Author: Mark Mentovai
|
||||
* Split into its own file: Neal Sidhwaney */
|
||||
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_MAC_H__
|
||||
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_MAC_H__
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "breakpad_types.h"
|
||||
|
||||
/* For (MDException).exception_code. Breakpad minidump extension for Mac OS X
|
||||
* support. Based on Darwin/Mac OS X' mach/exception_types.h. This is
|
||||
* what Mac OS X calls an "exception", not a "code". */
|
||||
typedef enum {
|
||||
/* Exception code. The high 16 bits of exception_code contains one of
|
||||
* these values. */
|
||||
MD_EXCEPTION_MAC_BAD_ACCESS = 1, /* code can be a kern_return_t */
|
||||
/* EXC_BAD_ACCESS */
|
||||
MD_EXCEPTION_MAC_BAD_INSTRUCTION = 2, /* code is CPU-specific */
|
||||
/* EXC_BAD_INSTRUCTION */
|
||||
MD_EXCEPTION_MAC_ARITHMETIC = 3, /* code is CPU-specific */
|
||||
/* EXC_ARITHMETIC */
|
||||
MD_EXCEPTION_MAC_EMULATION = 4, /* code is CPU-specific */
|
||||
/* EXC_EMULATION */
|
||||
MD_EXCEPTION_MAC_SOFTWARE = 5,
|
||||
/* EXC_SOFTWARE */
|
||||
MD_EXCEPTION_MAC_BREAKPOINT = 6, /* code is CPU-specific */
|
||||
/* EXC_BREAKPOINT */
|
||||
MD_EXCEPTION_MAC_SYSCALL = 7,
|
||||
/* EXC_SYSCALL */
|
||||
MD_EXCEPTION_MAC_MACH_SYSCALL = 8,
|
||||
/* EXC_MACH_SYSCALL */
|
||||
MD_EXCEPTION_MAC_RPC_ALERT = 9,
|
||||
/* EXC_RPC_ALERT */
|
||||
MD_EXCEPTION_MAC_SIMULATED = 0x43507378
|
||||
/* Fake exception code used by Crashpad's SimulateCrash ('CPsx'). */
|
||||
} MDExceptionMac;
|
||||
|
||||
/* For (MDException).exception_flags. Breakpad minidump extension for Mac OS X
|
||||
* support. Based on Darwin/Mac OS X' mach/ppc/exception.h and
|
||||
* mach/i386/exception.h. This is what Mac OS X calls a "code". */
|
||||
typedef enum {
|
||||
/* With MD_EXCEPTION_BAD_ACCESS. These are relevant kern_return_t values
|
||||
* from mach/kern_return.h. */
|
||||
MD_EXCEPTION_CODE_MAC_INVALID_ADDRESS = 1,
|
||||
/* KERN_INVALID_ADDRESS */
|
||||
MD_EXCEPTION_CODE_MAC_PROTECTION_FAILURE = 2,
|
||||
/* KERN_PROTECTION_FAILURE */
|
||||
MD_EXCEPTION_CODE_MAC_NO_ACCESS = 8,
|
||||
/* KERN_NO_ACCESS */
|
||||
MD_EXCEPTION_CODE_MAC_MEMORY_FAILURE = 9,
|
||||
/* KERN_MEMORY_FAILURE */
|
||||
MD_EXCEPTION_CODE_MAC_MEMORY_ERROR = 10,
|
||||
/* KERN_MEMORY_ERROR */
|
||||
MD_EXCEPTION_CODE_MAC_CODESIGN_ERROR = 50,
|
||||
/* KERN_CODESIGN_ERROR */
|
||||
|
||||
/* With MD_EXCEPTION_SOFTWARE */
|
||||
MD_EXCEPTION_CODE_MAC_BAD_SYSCALL = 0x00010000, /* Mach SIGSYS */
|
||||
MD_EXCEPTION_CODE_MAC_BAD_PIPE = 0x00010001, /* Mach SIGPIPE */
|
||||
MD_EXCEPTION_CODE_MAC_ABORT = 0x00010002, /* Mach SIGABRT */
|
||||
/* Custom values */
|
||||
MD_EXCEPTION_CODE_MAC_NS_EXCEPTION = 0xDEADC0DE, /* uncaught NSException */
|
||||
|
||||
/* With MD_EXCEPTION_MAC_BAD_ACCESS on arm */
|
||||
MD_EXCEPTION_CODE_MAC_ARM_DA_ALIGN = 0x0101, /* EXC_ARM_DA_ALIGN */
|
||||
MD_EXCEPTION_CODE_MAC_ARM_DA_DEBUG = 0x0102, /* EXC_ARM_DA_DEBUG */
|
||||
|
||||
/* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on arm */
|
||||
MD_EXCEPTION_CODE_MAC_ARM_UNDEFINED = 1, /* EXC_ARM_UNDEFINED */
|
||||
|
||||
/* With MD_EXCEPTION_MAC_BREAKPOINT on arm */
|
||||
MD_EXCEPTION_CODE_MAC_ARM_BREAKPOINT = 1, /* EXC_ARM_BREAKPOINT */
|
||||
|
||||
/* With MD_EXCEPTION_MAC_BAD_ACCESS on ppc */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_VM_PROT_READ = 0x0101,
|
||||
/* EXC_PPC_VM_PROT_READ */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_BADSPACE = 0x0102,
|
||||
/* EXC_PPC_BADSPACE */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_UNALIGNED = 0x0103,
|
||||
/* EXC_PPC_UNALIGNED */
|
||||
|
||||
/* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on ppc */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_INVALID_SYSCALL = 1,
|
||||
/* EXC_PPC_INVALID_SYSCALL */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_UNIMPLEMENTED_INSTRUCTION = 2,
|
||||
/* EXC_PPC_UNIPL_INST */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_PRIVILEGED_INSTRUCTION = 3,
|
||||
/* EXC_PPC_PRIVINST */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_PRIVILEGED_REGISTER = 4,
|
||||
/* EXC_PPC_PRIVREG */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_TRACE = 5,
|
||||
/* EXC_PPC_TRACE */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_PERFORMANCE_MONITOR = 6,
|
||||
/* EXC_PPC_PERFMON */
|
||||
|
||||
/* With MD_EXCEPTION_MAC_ARITHMETIC on ppc */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_OVERFLOW = 1,
|
||||
/* EXC_PPC_OVERFLOW */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_ZERO_DIVIDE = 2,
|
||||
/* EXC_PPC_ZERO_DIVIDE */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_FLOAT_INEXACT = 3,
|
||||
/* EXC_FLT_INEXACT */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_FLOAT_ZERO_DIVIDE = 4,
|
||||
/* EXC_PPC_FLT_ZERO_DIVIDE */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_FLOAT_UNDERFLOW = 5,
|
||||
/* EXC_PPC_FLT_UNDERFLOW */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_FLOAT_OVERFLOW = 6,
|
||||
/* EXC_PPC_FLT_OVERFLOW */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_FLOAT_NOT_A_NUMBER = 7,
|
||||
/* EXC_PPC_FLT_NOT_A_NUMBER */
|
||||
|
||||
/* With MD_EXCEPTION_MAC_EMULATION on ppc */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_NO_EMULATION = 8,
|
||||
/* EXC_PPC_NOEMULATION */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_ALTIVEC_ASSIST = 9,
|
||||
/* EXC_PPC_ALTIVECASSIST */
|
||||
|
||||
/* With MD_EXCEPTION_MAC_SOFTWARE on ppc */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_TRAP = 0x00000001, /* EXC_PPC_TRAP */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_MIGRATE = 0x00010100, /* EXC_PPC_MIGRATE */
|
||||
|
||||
/* With MD_EXCEPTION_MAC_BREAKPOINT on ppc */
|
||||
MD_EXCEPTION_CODE_MAC_PPC_BREAKPOINT = 1, /* EXC_PPC_BREAKPOINT */
|
||||
|
||||
/* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on x86, see also x86 interrupt
|
||||
* values below. */
|
||||
MD_EXCEPTION_CODE_MAC_X86_INVALID_OPERATION = 1, /* EXC_I386_INVOP */
|
||||
|
||||
/* With MD_EXCEPTION_MAC_ARITHMETIC on x86 */
|
||||
MD_EXCEPTION_CODE_MAC_X86_DIV = 1, /* EXC_I386_DIV */
|
||||
MD_EXCEPTION_CODE_MAC_X86_INTO = 2, /* EXC_I386_INTO */
|
||||
MD_EXCEPTION_CODE_MAC_X86_NOEXT = 3, /* EXC_I386_NOEXT */
|
||||
MD_EXCEPTION_CODE_MAC_X86_EXTOVR = 4, /* EXC_I386_EXTOVR */
|
||||
MD_EXCEPTION_CODE_MAC_X86_EXTERR = 5, /* EXC_I386_EXTERR */
|
||||
MD_EXCEPTION_CODE_MAC_X86_EMERR = 6, /* EXC_I386_EMERR */
|
||||
MD_EXCEPTION_CODE_MAC_X86_BOUND = 7, /* EXC_I386_BOUND */
|
||||
MD_EXCEPTION_CODE_MAC_X86_SSEEXTERR = 8, /* EXC_I386_SSEEXTERR */
|
||||
|
||||
/* With MD_EXCEPTION_MAC_BREAKPOINT on x86 */
|
||||
MD_EXCEPTION_CODE_MAC_X86_SGL = 1, /* EXC_I386_SGL */
|
||||
MD_EXCEPTION_CODE_MAC_X86_BPT = 2, /* EXC_I386_BPT */
|
||||
|
||||
/* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on x86. These are the raw
|
||||
* x86 interrupt codes. Most of these are mapped to other Mach
|
||||
* exceptions and codes, are handled, or should not occur in user space.
|
||||
* A few of these will do occur with MD_EXCEPTION_MAC_BAD_INSTRUCTION. */
|
||||
/* EXC_I386_DIVERR = 0: mapped to EXC_ARITHMETIC/EXC_I386_DIV */
|
||||
/* EXC_I386_SGLSTP = 1: mapped to EXC_BREAKPOINT/EXC_I386_SGL */
|
||||
/* EXC_I386_NMIFLT = 2: should not occur in user space */
|
||||
/* EXC_I386_BPTFLT = 3: mapped to EXC_BREAKPOINT/EXC_I386_BPT */
|
||||
/* EXC_I386_INTOFLT = 4: mapped to EXC_ARITHMETIC/EXC_I386_INTO */
|
||||
/* EXC_I386_BOUNDFLT = 5: mapped to EXC_ARITHMETIC/EXC_I386_BOUND */
|
||||
/* EXC_I386_INVOPFLT = 6: mapped to EXC_BAD_INSTRUCTION/EXC_I386_INVOP */
|
||||
/* EXC_I386_NOEXTFLT = 7: should be handled by the kernel */
|
||||
/* EXC_I386_DBLFLT = 8: should be handled (if possible) by the kernel */
|
||||
/* EXC_I386_EXTOVRFLT = 9: mapped to EXC_BAD_ACCESS/(PROT_READ|PROT_EXEC) */
|
||||
MD_EXCEPTION_CODE_MAC_X86_INVALID_TASK_STATE_SEGMENT = 10,
|
||||
/* EXC_INVTSSFLT */
|
||||
MD_EXCEPTION_CODE_MAC_X86_SEGMENT_NOT_PRESENT = 11,
|
||||
/* EXC_SEGNPFLT */
|
||||
MD_EXCEPTION_CODE_MAC_X86_STACK_FAULT = 12,
|
||||
/* EXC_STKFLT */
|
||||
MD_EXCEPTION_CODE_MAC_X86_GENERAL_PROTECTION_FAULT = 13,
|
||||
/* EXC_GPFLT */
|
||||
/* EXC_I386_PGFLT = 14: should not occur in user space */
|
||||
/* EXC_I386_EXTERRFLT = 16: mapped to EXC_ARITHMETIC/EXC_I386_EXTERR */
|
||||
MD_EXCEPTION_CODE_MAC_X86_ALIGNMENT_FAULT = 17
|
||||
/* EXC_ALIGNFLT (for vector operations) */
|
||||
/* EXC_I386_ENOEXTFLT = 32: should be handled by the kernel */
|
||||
/* EXC_I386_ENDPERR = 33: should not occur */
|
||||
} MDExceptionCodeMac;
|
||||
|
||||
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_MAC_OSX_H__ */
|
||||
61
bfd/minidump-format/minidump_exception_ps3.h
Normal file
61
bfd/minidump-format/minidump_exception_ps3.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/* Header file for the format of Windows minidumps.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
Written by Google LLC.
|
||||
Relicensed with permission, original at:
|
||||
https://source.chromium.org/chromium/chromium/src/+/master:third_party/breakpad/breakpad/src/google_breakpad/common
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* minidump_exception_ps3.h: A definition of exception codes for
|
||||
* PS3 */
|
||||
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_PS3_H__
|
||||
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_PS3_H__
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "breakpad_types.h"
|
||||
|
||||
typedef enum {
|
||||
MD_EXCEPTION_CODE_PS3_UNKNOWN = 0,
|
||||
MD_EXCEPTION_CODE_PS3_TRAP_EXCEP = 1,
|
||||
MD_EXCEPTION_CODE_PS3_PRIV_INSTR = 2,
|
||||
MD_EXCEPTION_CODE_PS3_ILLEGAL_INSTR = 3,
|
||||
MD_EXCEPTION_CODE_PS3_INSTR_STORAGE = 4,
|
||||
MD_EXCEPTION_CODE_PS3_INSTR_SEGMENT = 5,
|
||||
MD_EXCEPTION_CODE_PS3_DATA_STORAGE = 6,
|
||||
MD_EXCEPTION_CODE_PS3_DATA_SEGMENT = 7,
|
||||
MD_EXCEPTION_CODE_PS3_FLOAT_POINT = 8,
|
||||
MD_EXCEPTION_CODE_PS3_DABR_MATCH = 9,
|
||||
MD_EXCEPTION_CODE_PS3_ALIGN_EXCEP = 10,
|
||||
MD_EXCEPTION_CODE_PS3_MEMORY_ACCESS = 11,
|
||||
MD_EXCEPTION_CODE_PS3_COPRO_ALIGN = 12,
|
||||
MD_EXCEPTION_CODE_PS3_COPRO_INVALID_COM = 13,
|
||||
MD_EXCEPTION_CODE_PS3_COPRO_ERR = 14,
|
||||
MD_EXCEPTION_CODE_PS3_COPRO_FIR = 15,
|
||||
MD_EXCEPTION_CODE_PS3_COPRO_DATA_SEGMENT = 16,
|
||||
MD_EXCEPTION_CODE_PS3_COPRO_DATA_STORAGE = 17,
|
||||
MD_EXCEPTION_CODE_PS3_COPRO_STOP_INSTR = 18,
|
||||
MD_EXCEPTION_CODE_PS3_COPRO_HALT_INSTR = 19,
|
||||
MD_EXCEPTION_CODE_PS3_COPRO_HALTINST_UNKNOWN = 20,
|
||||
MD_EXCEPTION_CODE_PS3_COPRO_MEMORY_ACCESS = 21,
|
||||
MD_EXCEPTION_CODE_PS3_GRAPHIC = 22
|
||||
} MDExceptionCodePS3;
|
||||
|
||||
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_PS3_H__ */
|
||||
88
bfd/minidump-format/minidump_exception_solaris.h
Normal file
88
bfd/minidump-format/minidump_exception_solaris.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/* Header file for the format of Windows minidumps.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
Written by Google LLC.
|
||||
Relicensed with permission, original at:
|
||||
https://source.chromium.org/chromium/chromium/src/+/master:third_party/breakpad/breakpad/src/google_breakpad/common
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* minidump_exception_solaris.h: A definition of exception codes for
|
||||
* Solaris
|
||||
*
|
||||
* (This is C99 source, please don't corrupt it with C++.)
|
||||
*
|
||||
* Author: Mark Mentovai
|
||||
* Split into its own file: Neal Sidhwaney */
|
||||
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_SOLARIS_H__
|
||||
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_SOLARIS_H__
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "breakpad_types.h"
|
||||
|
||||
/* For (MDException).exception_code. These values come from sys/iso/signal_iso.h
|
||||
*/
|
||||
typedef enum {
|
||||
MD_EXCEPTION_CODE_SOL_SIGHUP = 1, /* Hangup */
|
||||
MD_EXCEPTION_CODE_SOL_SIGINT = 2, /* interrupt (rubout) */
|
||||
MD_EXCEPTION_CODE_SOL_SIGQUIT = 3, /* quit (ASCII FS) */
|
||||
MD_EXCEPTION_CODE_SOL_SIGILL = 4, /* illegal instruction (not reset when caught) */
|
||||
MD_EXCEPTION_CODE_SOL_SIGTRAP = 5, /* trace trap (not reset when caught) */
|
||||
MD_EXCEPTION_CODE_SOL_SIGIOT = 6, /* IOT instruction */
|
||||
MD_EXCEPTION_CODE_SOL_SIGABRT = 6, /* used by abort, replace SIGIOT in the future */
|
||||
MD_EXCEPTION_CODE_SOL_SIGEMT = 7, /* EMT instruction */
|
||||
MD_EXCEPTION_CODE_SOL_SIGFPE = 8, /* floating point exception */
|
||||
MD_EXCEPTION_CODE_SOL_SIGKILL = 9, /* kill (cannot be caught or ignored) */
|
||||
MD_EXCEPTION_CODE_SOL_SIGBUS = 10, /* bus error */
|
||||
MD_EXCEPTION_CODE_SOL_SIGSEGV = 11, /* segmentation violation */
|
||||
MD_EXCEPTION_CODE_SOL_SIGSYS = 12, /* bad argument to system call */
|
||||
MD_EXCEPTION_CODE_SOL_SIGPIPE = 13, /* write on a pipe with no one to read it */
|
||||
MD_EXCEPTION_CODE_SOL_SIGALRM = 14, /* alarm clock */
|
||||
MD_EXCEPTION_CODE_SOL_SIGTERM = 15, /* software termination signal from kill */
|
||||
MD_EXCEPTION_CODE_SOL_SIGUSR1 = 16, /* user defined signal 1 */
|
||||
MD_EXCEPTION_CODE_SOL_SIGUSR2 = 17, /* user defined signal 2 */
|
||||
MD_EXCEPTION_CODE_SOL_SIGCLD = 18, /* child status change */
|
||||
MD_EXCEPTION_CODE_SOL_SIGCHLD = 18, /* child status change alias (POSIX) */
|
||||
MD_EXCEPTION_CODE_SOL_SIGPWR = 19, /* power-fail restart */
|
||||
MD_EXCEPTION_CODE_SOL_SIGWINCH = 20, /* window size change */
|
||||
MD_EXCEPTION_CODE_SOL_SIGURG = 21, /* urgent socket condition */
|
||||
MD_EXCEPTION_CODE_SOL_SIGPOLL = 22, /* pollable event occurred */
|
||||
MD_EXCEPTION_CODE_SOL_SIGIO = 22, /* socket I/O possible (SIGPOLL alias) */
|
||||
MD_EXCEPTION_CODE_SOL_SIGSTOP = 23, /* stop (cannot be caught or ignored) */
|
||||
MD_EXCEPTION_CODE_SOL_SIGTSTP = 24, /* user stop requested from tty */
|
||||
MD_EXCEPTION_CODE_SOL_SIGCONT = 25, /* stopped process has been continued */
|
||||
MD_EXCEPTION_CODE_SOL_SIGTTIN = 26, /* background tty read attempted */
|
||||
MD_EXCEPTION_CODE_SOL_SIGTTOU = 27, /* background tty write attempted */
|
||||
MD_EXCEPTION_CODE_SOL_SIGVTALRM = 28, /* virtual timer expired */
|
||||
MD_EXCEPTION_CODE_SOL_SIGPROF = 29, /* profiling timer expired */
|
||||
MD_EXCEPTION_CODE_SOL_SIGXCPU = 30, /* exceeded cpu limit */
|
||||
MD_EXCEPTION_CODE_SOL_SIGXFSZ = 31, /* exceeded file size limit */
|
||||
MD_EXCEPTION_CODE_SOL_SIGWAITING = 32, /* reserved signal no longer used by threading code */
|
||||
MD_EXCEPTION_CODE_SOL_SIGLWP = 33, /* reserved signal no longer used by threading code */
|
||||
MD_EXCEPTION_CODE_SOL_SIGFREEZE = 34, /* special signal used by CPR */
|
||||
MD_EXCEPTION_CODE_SOL_SIGTHAW = 35, /* special signal used by CPR */
|
||||
MD_EXCEPTION_CODE_SOL_SIGCANCEL = 36, /* reserved signal for thread cancellation */
|
||||
MD_EXCEPTION_CODE_SOL_SIGLOST = 37, /* resource lost (eg, record-lock lost) */
|
||||
MD_EXCEPTION_CODE_SOL_SIGXRES = 38, /* resource control exceeded */
|
||||
MD_EXCEPTION_CODE_SOL_SIGJVM1 = 39, /* reserved signal for Java Virtual Machine */
|
||||
MD_EXCEPTION_CODE_SOL_SIGJVM2 = 40 /* reserved signal for Java Virtual Machine */
|
||||
} MDExceptionCodeSolaris;
|
||||
|
||||
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_SOLARIS_H__ */
|
||||
2263
bfd/minidump-format/minidump_exception_win32.h
Normal file
2263
bfd/minidump-format/minidump_exception_win32.h
Normal file
File diff suppressed because it is too large
Load Diff
1093
bfd/minidump-format/minidump_format.h
Normal file
1093
bfd/minidump-format/minidump_format.h
Normal file
File diff suppressed because it is too large
Load Diff
107
bfd/minidump-format/minidump_size.h
Normal file
107
bfd/minidump-format/minidump_size.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/* Header file for the format of Windows minidumps.
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
Written by Google LLC.
|
||||
Relicensed with permission, original at:
|
||||
https://source.chromium.org/chromium/chromium/src/+/master:third_party/breakpad/breakpad/src/google_breakpad/common
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
// minidump_size.h: Provides a C++ template for programmatic access to
|
||||
// the sizes of various types defined in minidump_format.h.
|
||||
//
|
||||
// Author: Mark Mentovai
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_SIZE_H__
|
||||
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_SIZE_H__
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "minidump_format.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
template<typename T>
|
||||
class minidump_size {
|
||||
public:
|
||||
static size_t size() { return sizeof(T); }
|
||||
};
|
||||
|
||||
// Explicit specializations for variable-length types. The size returned
|
||||
// for these should be the size for an object without its variable-length
|
||||
// section.
|
||||
|
||||
template<>
|
||||
class minidump_size<MDString> {
|
||||
public:
|
||||
static size_t size() { return MDString_minsize; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class minidump_size<MDRawThreadList> {
|
||||
public:
|
||||
static size_t size() { return MDRawThreadList_minsize; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class minidump_size<MDCVInfoPDB20> {
|
||||
public:
|
||||
static size_t size() { return MDCVInfoPDB20_minsize; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class minidump_size<MDCVInfoPDB70> {
|
||||
public:
|
||||
static size_t size() { return MDCVInfoPDB70_minsize; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class minidump_size<MDCVInfoELF> {
|
||||
public:
|
||||
static size_t size() { return MDCVInfoELF_minsize; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class minidump_size<MDImageDebugMisc> {
|
||||
public:
|
||||
static size_t size() { return MDImageDebugMisc_minsize; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class minidump_size<MDRawModuleList> {
|
||||
public:
|
||||
static size_t size() { return MDRawModuleList_minsize; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class minidump_size<MDRawMemoryList> {
|
||||
public:
|
||||
static size_t size() { return MDRawMemoryList_minsize; }
|
||||
};
|
||||
|
||||
// Explicit specialization for MDRawModule, for which sizeof may include
|
||||
// tail-padding on some architectures but not others.
|
||||
|
||||
template<>
|
||||
class minidump_size<MDRawModule> {
|
||||
public:
|
||||
static size_t size() { return MD_MODULE_SIZE; }
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_COMMON_MINIDUMP_SIZE_H__
|
||||
@@ -949,6 +949,7 @@ extern const bfd_target core_cisco_le_vec;
|
||||
extern const bfd_target core_hppabsd_vec;
|
||||
extern const bfd_target core_hpux_vec;
|
||||
extern const bfd_target core_irix_vec;
|
||||
extern const bfd_target core_minidump_vec;
|
||||
extern const bfd_target core_netbsd_vec;
|
||||
extern const bfd_target core_osf_vec;
|
||||
extern const bfd_target core_ptrace_vec;
|
||||
@@ -1387,6 +1388,7 @@ static const bfd_target * const _bfd_target_vector[] =
|
||||
&core_cisco_be_vec,
|
||||
&core_cisco_le_vec,
|
||||
#endif
|
||||
&core_minidump_vec,
|
||||
#ifdef HPPABSD_CORE
|
||||
&core_hppabsd_vec,
|
||||
#endif
|
||||
|
||||
@@ -617,8 +617,8 @@ core_target::get_core_register_section (struct regcache *regcache,
|
||||
}
|
||||
if (size != section_min_size && !variable_size_section)
|
||||
{
|
||||
warning (_("Unexpected size of section `%s' in core file."),
|
||||
section_name.c_str ());
|
||||
warning (_("Unexpected size of section `%s' in core file, expected `%i'."),
|
||||
section_name.c_str (), section_min_size);
|
||||
}
|
||||
|
||||
gdb::byte_vector contents (size);
|
||||
|
||||
Reference in New Issue
Block a user