Move dead submodules in-tree

Signed-off-by: swurl <swurl@swurl.xyz>
This commit is contained in:
swurl 2025-05-31 02:33:02 -04:00
parent c0cceff365
commit 6c655321e6
No known key found for this signature in database
GPG key ID: A5A7629F109C8FD1
4081 changed files with 1185566 additions and 45 deletions

View file

@ -0,0 +1,67 @@
/* Copyright 2006 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* 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__ */

View file

@ -0,0 +1,234 @@
/* Copyright 2006 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* 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_AMD64_DEBUG_REGISTERS)
/* CONTEXT_ALL */
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_AMD64_H__ */

View file

@ -0,0 +1,150 @@
/* Copyright 2009 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* 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__ */

View file

@ -0,0 +1,191 @@
/* Copyright 2013 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* 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 "google_breakpad/common/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__ */

View file

@ -0,0 +1,175 @@
/* Copyright 2013 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* 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__

View file

@ -0,0 +1,167 @@
/* Copyright 2006 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* 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__ */

View file

@ -0,0 +1,133 @@
/* Copyright 2008 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* 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__ */

View file

@ -0,0 +1,156 @@
/* 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 RISCV and RISCV64. 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: Iacopo Colonnelli
*/
/*
* RISCV and RISCV64 support
*/
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_RISCV_H__
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_RISCV_H__
#include "google_breakpad/common/breakpad_types.h"
#define MD_CONTEXT_RISCV_GPR_COUNT 32
#define MD_CONTEXT_RISCV_FPR_COUNT 32
enum MDRISCVRegisterNumbers {
MD_CONTEXT_RISCV_REG_PC = 0,
MD_CONTEXT_RISCV_REG_RA = 1,
MD_CONTEXT_RISCV_REG_SP = 2,
};
/* For (MDRawContextRISCV).context_flags. These values indicate the type of
* context stored in the structure. */
#define MD_CONTEXT_RISCV 0x00800000
#define MD_CONTEXT_RISCV_INTEGER (MD_CONTEXT_RISCV | 0x00000001)
#define MD_CONTEXT_RISCV_FLOATING_POINT (MD_CONTEXT_RISCV | 0x00000002)
#define MD_CONTEXT_RISCV_FULL (MD_CONTEXT_RISCV_INTEGER | \
MD_CONTEXT_RISCV_FLOATING_POINT)
typedef struct {
/* Determines which fields of this struct are populated */
uint32_t context_flags;
uint32_t version;
uint32_t pc;
uint32_t ra;
uint32_t sp;
uint32_t gp;
uint32_t tp;
uint32_t t0;
uint32_t t1;
uint32_t t2;
uint32_t s0;
uint32_t s1;
uint32_t a0;
uint32_t a1;
uint32_t a2;
uint32_t a3;
uint32_t a4;
uint32_t a5;
uint32_t a6;
uint32_t a7;
uint32_t s2;
uint32_t s3;
uint32_t s4;
uint32_t s5;
uint32_t s6;
uint32_t s7;
uint32_t s8;
uint32_t s9;
uint32_t s10;
uint32_t s11;
uint32_t t3;
uint32_t t4;
uint32_t t5;
uint32_t t6;
/* 32 floating point registers, f0 .. f31. Breakpad only supports RISCV32
* with 32 bit floating point. */
uint32_t fpregs[MD_CONTEXT_RISCV_FPR_COUNT];
uint32_t fcsr;
} MDRawContextRISCV;
/* For (MDRawContextRISCV64).context_flags. These values indicate the type of
* context stored in the structure. */
#define MD_CONTEXT_RISCV64 0x08000000
#define MD_CONTEXT_RISCV64_INTEGER (MD_CONTEXT_RISCV64 | 0x00000001)
#define MD_CONTEXT_RISCV64_FLOATING_POINT (MD_CONTEXT_RISCV64 | 0x00000002)
#define MD_CONTEXT_RISCV64_FULL (MD_CONTEXT_RISCV64_INTEGER | \
MD_CONTEXT_RISCV64_FLOATING_POINT)
typedef struct {
/* Determines which fields of this struct are populated */
uint32_t context_flags;
uint32_t version;
uint64_t pc;
uint64_t ra;
uint64_t sp;
uint64_t gp;
uint64_t tp;
uint64_t t0;
uint64_t t1;
uint64_t t2;
uint64_t s0;
uint64_t s1;
uint64_t a0;
uint64_t a1;
uint64_t a2;
uint64_t a3;
uint64_t a4;
uint64_t a5;
uint64_t a6;
uint64_t a7;
uint64_t s2;
uint64_t s3;
uint64_t s4;
uint64_t s5;
uint64_t s6;
uint64_t s7;
uint64_t s8;
uint64_t s9;
uint64_t s10;
uint64_t s11;
uint64_t t3;
uint64_t t4;
uint64_t t5;
uint64_t t6;
/* 32 floating point registers, f0 .. f31. Breakpad only supports RISCV64 with
* 64 bit floating point. */
uint64_t fpregs[MD_CONTEXT_RISCV_FPR_COUNT];
uint32_t fcsr;
} MDRawContextRISCV64;
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_RISCV_H__ */

View file

@ -0,0 +1,162 @@
/* Copyright 2006 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* 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__ */

View file

@ -0,0 +1,173 @@
/* Copyright 2006 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* 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__ */

View file

@ -0,0 +1,57 @@
/* Copyright 2019 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* 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 "google_breakpad/common/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_

View file

@ -0,0 +1,129 @@
/* Copyright 2006 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* 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 "google_breakpad/common/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,
MD_EXCEPTION_FLAG_LIN_SEGV_ACCADI = 5,
MD_EXCEPTION_FLAG_LIN_SEGV_ADIDERR = 6,
MD_EXCEPTION_FLAG_LIN_SEGV_ADIPERR = 7,
MD_EXCEPTION_FLAG_LIN_SEGV_MTEAERR = 8,
MD_EXCEPTION_FLAG_LIN_SEGV_MTESERR = 9,
/* 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__ */

View file

@ -0,0 +1,214 @@
/* Copyright 2006 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* 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 "google_breakpad/common/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_RESOURCE */
MD_EXCEPTION_MAC_RESOURCE = 11,
/* EXC_GUARD */
MD_EXCEPTION_MAC_GUARD = 12,
/* EXC_RPC_ALERT */
MD_EXCEPTION_MAC_SIMULATED = 0x43507378,
/* Fake exception code used by Crashpad's SimulateCrash ('CPsx'). */
MD_NS_EXCEPTION_SIMULATED = 0x43506E78
/* Fake exception code used by Crashpad's uncaught exceptions ('CPnx'). */
} 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__ */

View file

@ -0,0 +1,66 @@
/* Copyright 2013 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* 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 "google_breakpad/common/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__ */

View file

@ -0,0 +1,93 @@
/* Copyright 2006 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* 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 "google_breakpad/common/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__ */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,112 @@
// Copyright 2007 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
// 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 "google_breakpad/common/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__

View file

@ -0,0 +1,183 @@
// Copyright 2010 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// basic_source_line_resolver.h: BasicSourceLineResolver is derived from
// SourceLineResolverBase, and is a concrete implementation of
// SourceLineResolverInterface, using address map files produced by a
// compatible writer, e.g. PDBSourceLineWriter.
//
// see "processor/source_line_resolver_base.h"
// and "source_line_resolver_interface.h" for more documentation.
#ifndef GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__
#define GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__
#include <map>
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "google_breakpad/processor/source_line_resolver_base.h"
namespace google_breakpad {
using std::map;
class BasicSourceLineResolver : public SourceLineResolverBase {
public:
BasicSourceLineResolver();
virtual ~BasicSourceLineResolver() { }
using SourceLineResolverBase::LoadModule;
using SourceLineResolverBase::LoadModuleUsingMapBuffer;
using SourceLineResolverBase::LoadModuleUsingMemoryBuffer;
using SourceLineResolverBase::ShouldDeleteMemoryBufferAfterLoadModule;
using SourceLineResolverBase::UnloadModule;
using SourceLineResolverBase::HasModule;
using SourceLineResolverBase::IsModuleCorrupt;
using SourceLineResolverBase::FillSourceLineInfo;
using SourceLineResolverBase::FindWindowsFrameInfo;
using SourceLineResolverBase::FindCFIFrameInfo;
private:
// friend declarations:
friend class BasicModuleFactory;
friend class ModuleComparer;
friend class ModuleSerializer;
template<class> friend class SimpleSerializer;
// Function derives from SourceLineResolverBase::Function.
struct Function;
// Module implements SourceLineResolverBase::Module interface.
class Module;
// Disallow unwanted copy ctor and assignment operator
BasicSourceLineResolver(const BasicSourceLineResolver&);
void operator=(const BasicSourceLineResolver&);
};
// Helper class, containing useful methods for parsing of Breakpad symbol files.
class SymbolParseHelper {
public:
using MemAddr = SourceLineResolverInterface::MemAddr;
// Parses a |file_line| declaration. Returns true on success.
// Format: FILE <id> <filename>.
// Notice, that this method modifies the input |file_line| which is why it
// can't be const. On success, <id>, and <filename> are stored in |*index|,
// and |*filename|. No allocation is done, |*filename| simply points inside
// |file_line|.
static bool ParseFile(char* file_line, // in
long* index, // out
char** filename); // out
// Parses a |inline_origin_line| declaration. Returns true on success.
// Old Format: INLINE_ORIGIN <origin_id> <file_id> <name>.
// New Format: INLINE_ORIGIN <origin_id> <name>.
// Notice, that this method modifies the input |inline_origin_line| which is
// why it can't be const. On success, <has_file_id>, <origin_id>, <file_id>
// and <name> are stored in |*has_file_id*|, |*origin_id|, |*file_id|, and
// |*name|. No allocation is done, |*name| simply points inside
// |inline_origin_line|.
static bool ParseInlineOrigin(char* inline_origin_line, // in
bool* has_file_id, // out
long* origin_id, // out
long* file_id, // out
char** name); // out
// Parses a |inline| declaration. Returns true on success.
// Old Format: INLINE <inline_nest_level> <call_site_line> <origin_id>
// [<address> <size>]+
// New Format: INLINE <inline_nest_level> <call_site_line> <call_site_file_id>
// <origin_id> [<address> <size>]+
// Notice, that this method modifies the input |inline|
// which is why it can't be const. On success, <has_call_site_file_id>,
// <inline_nest_level>, <call_site_line> and <origin_id> are stored in
// |*has_call_site_file_id*|, |*inline_nest_level|, |*call_site_line|, and
// |*origin_id|, and all pairs of (<address>, <size>) are added into ranges.
static bool ParseInline(
char* inline_line, // in
bool* has_call_site_file_id, // out
long* inline_nest_level, // out
long* call_site_line, // out
long* call_site_file_id, // out
long* origin_id, // out
std::vector<std::pair<MemAddr, MemAddr>>* ranges); // out
// Parses a |function_line| declaration. Returns true on success.
// Format: FUNC [<multiple>] <address> <size> <stack_param_size> <name>.
// Notice, that this method modifies the input |function_line| which is why it
// can't be const. On success, the presence of <multiple>, <address>, <size>,
// <stack_param_size>, and <name> are stored in |*is_multiple|, |*address|,
// |*size|, |*stack_param_size|, and |*name|. No allocation is done, |*name|
// simply points inside |function_line|.
static bool ParseFunction(char* function_line, // in
bool* is_multiple, // out
uint64_t* address, // out
uint64_t* size, // out
long* stack_param_size, // out
char** name); // out
// Parses a |line| declaration. Returns true on success.
// Format: <address> <size> <line number> <source file id>
// Notice, that this method modifies the input |function_line| which is why
// it can't be const. On success, <address>, <size>, <line number>, and
// <source file id> are stored in |*address|, |*size|, |*line_number|, and
// |*source_file|.
static bool ParseLine(char* line_line, // in
uint64_t* address, // out
uint64_t* size, // out
long* line_number, // out
long* source_file); // out
// Parses a |public_line| declaration. Returns true on success.
// Format: PUBLIC [<multiple>] <address> <stack_param_size> <name>
// Notice, that this method modifies the input |function_line| which is why
// it can't be const. On success, the presence of <multiple>, <address>,
// <stack_param_size>, <name> are stored in |*is_multiple|, |*address|,
// |*stack_param_size|, and |*name|. No allocation is done, |*name| simply
// points inside |public_line|.
static bool ParsePublicSymbol(char* public_line, // in
bool* is_multiple, // out
uint64_t* address, // out
long* stack_param_size, // out
char** name); // out
private:
// Used for success checks after strtoull and strtol.
static bool IsValidAfterNumber(char* after_number);
// Only allow static methods.
SymbolParseHelper();
SymbolParseHelper(const SymbolParseHelper&);
void operator=(const SymbolParseHelper&);
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__

View file

@ -0,0 +1,86 @@
// Copyright 2006 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// call_stack.h: A call stack comprised of stack frames.
//
// This class manages a vector of stack frames. It is used instead of
// exposing the vector directly to allow the CallStack to own StackFrame
// pointers without having to publicly export the linked_ptr class. A
// CallStack must be composed of pointers instead of objects to allow for
// CPU-specific StackFrame subclasses.
//
// By convention, the stack frame at index 0 is the innermost callee frame,
// and the frame at the highest index in a call stack is the outermost
// caller. CallStack only allows stacks to be built by pushing frames,
// beginning with the innermost callee frame.
//
// Author: Mark Mentovai
#ifndef GOOGLE_BREAKPAD_PROCESSOR_CALL_STACK_H__
#define GOOGLE_BREAKPAD_PROCESSOR_CALL_STACK_H__
#include <cstdint>
#include <vector>
namespace google_breakpad {
using std::vector;
struct StackFrame;
template<typename T> class linked_ptr;
class CallStack {
public:
CallStack() { Clear(); }
~CallStack();
// Resets the CallStack to its initial empty state
void Clear();
const vector<StackFrame*>* frames() const { return &frames_; }
// Set the TID associated with this call stack.
void set_tid(uint32_t tid) { tid_ = tid; }
uint32_t tid() const { return tid_; }
private:
// Stackwalker is responsible for building the frames_ vector.
friend class Stackwalker;
// Storage for pushed frames.
vector<StackFrame*> frames_;
// The TID associated with this call stack. Default to 0 if it's not
// available.
uint32_t tid_;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCSSOR_CALL_STACK_H__

View file

@ -0,0 +1,103 @@
// Copyright 2006 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// code_module.h: Carries information about code modules that are loaded
// into a process.
//
// Author: Mark Mentovai
#ifndef GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULE_H__
#define GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULE_H__
#include <string>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
class CodeModule {
public:
virtual ~CodeModule() {}
// The base address of this code module as it was loaded by the process.
// (uint64_t)-1 on error.
virtual uint64_t base_address() const = 0;
// The size of the code module. 0 on error.
virtual uint64_t size() const = 0;
// The path or file name that the code module was loaded from. Empty on
// error.
virtual string code_file() const = 0;
// An identifying string used to discriminate between multiple versions and
// builds of the same code module. This may contain a uuid, timestamp,
// version number, or any combination of this or other information, in an
// implementation-defined format. Empty on error.
virtual string code_identifier() const = 0;
// The filename containing debugging information associated with the code
// module. If debugging information is stored in a file separate from the
// code module itself (as is the case when .pdb or .dSYM files are used),
// this will be different from code_file. If debugging information is
// stored in the code module itself (possibly prior to stripping), this
// will be the same as code_file. Empty on error.
virtual string debug_file() const = 0;
// An identifying string similar to code_identifier, but identifies a
// specific version and build of the associated debug file. This may be
// the same as code_identifier when the debug_file and code_file are
// identical or when the same identifier is used to identify distinct
// debug and code files.
virtual string debug_identifier() const = 0;
// A human-readable representation of the code module's version. Empty on
// error.
virtual string version() const = 0;
// Creates a new copy of this CodeModule object, which the caller takes
// ownership of. The new CodeModule may be of a different concrete class
// than the CodeModule being copied, but will behave identically to the
// copied CodeModule as far as the CodeModule interface is concerned.
virtual CodeModule* Copy() const = 0;
// Getter and setter for shrink_down_delta. This is used when the address
// range for a module is shrunk down due to address range conflicts with
// other modules. The base_address and size fields are not updated and they
// should always reflect the original values (reported in the minidump).
virtual uint64_t shrink_down_delta() const = 0;
virtual void SetShrinkDownDelta(uint64_t shrink_down_delta) = 0;
// Whether the module was unloaded from memory.
virtual bool is_unloaded() const = 0;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULE_H__

View file

@ -0,0 +1,107 @@
// Copyright 2006 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// code_modules.h: Contains all of the CodeModule objects that were loaded
// into a single process.
//
// Author: Mark Mentovai
#ifndef GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULES_H__
#define GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULES_H__
#include <stddef.h>
#include <vector>
#include "google_breakpad/common/breakpad_types.h"
#include "processor/linked_ptr.h"
namespace google_breakpad {
class CodeModule;
class CodeModules {
public:
virtual ~CodeModules() {}
// The number of contained CodeModule objects.
virtual unsigned int module_count() const = 0;
// Random access to modules. Returns the module whose code is present
// at the address indicated by |address|. If no module is present at this
// address, returns NULL. Ownership of the returned CodeModule is retained
// by the CodeModules object; pointers returned by this method are valid for
// comparison with pointers returned by the other Get methods.
virtual const CodeModule* GetModuleForAddress(uint64_t address) const = 0;
// Returns the module corresponding to the main executable. If there is
// no main executable, returns NULL. Ownership of the returned CodeModule
// is retained by the CodeModules object; pointers returned by this method
// are valid for comparison with pointers returned by the other Get
// methods.
virtual const CodeModule* GetMainModule() const = 0;
// Sequential access to modules. A sequence number of 0 corresponds to the
// module residing lowest in memory. If the sequence number is out of
// range, returns NULL. Ownership of the returned CodeModule is retained
// by the CodeModules object; pointers returned by this method are valid for
// comparison with pointers returned by the other Get methods.
virtual const CodeModule* GetModuleAtSequence(
unsigned int sequence) const = 0;
// Sequential access to modules. This is similar to GetModuleAtSequence,
// except no ordering requirement is enforced. A CodeModules implementation
// may return CodeModule objects from GetModuleAtIndex in any order it
// wishes, provided that the order remain the same throughout the life of
// the CodeModules object. Typically, GetModuleAtIndex would be used by
// a caller to enumerate all CodeModule objects quickly when the enumeration
// does not require any ordering. If the index argument is out of range,
// returns NULL. Ownership of the returned CodeModule is retained by
// the CodeModules object; pointers returned by this method are valid for
// comparison with pointers returned by the other Get methods.
virtual const CodeModule* GetModuleAtIndex(unsigned int index) const = 0;
// Creates a new copy of this CodeModules object, which the caller takes
// ownership of. The new object will also contain copies of the existing
// object's child CodeModule objects. The new CodeModules object may be of
// a different concrete class than the object being copied, but will behave
// identically to the copied object as far as the CodeModules and CodeModule
// interfaces are concerned, except that the order that GetModuleAtIndex
// returns objects in may differ between a copy and the original CodeModules
// object.
virtual const CodeModules* Copy() const = 0;
// Returns a vector of all modules which address ranges needed to be shrunk
// down due to address range conflicts with other modules.
virtual std::vector<linked_ptr<const CodeModule> >
GetShrunkRangeModules() const = 0;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULES_H__

View file

@ -0,0 +1,121 @@
// Copyright 2014 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// dump_context.h: A (mini/micro) dump CPU-specific context.
#ifndef GOOGLE_BREAKPAD_PROCESSOR_DUMP_CONTEXT_H__
#define GOOGLE_BREAKPAD_PROCESSOR_DUMP_CONTEXT_H__
#include "google_breakpad/common/minidump_format.h"
#include "google_breakpad/processor/dump_object.h"
namespace google_breakpad {
// DumpContext carries a CPU-specific MDRawContext structure, which contains CPU
// context such as register states.
class DumpContext : public DumpObject {
public:
virtual ~DumpContext();
// Returns an MD_CONTEXT_* value such as MD_CONTEXT_X86 or MD_CONTEXT_PPC
// identifying the CPU type that the context was collected from. The
// returned value will identify the CPU only, and will have any other
// MD_CONTEXT_* bits masked out. Returns 0 on failure.
uint32_t GetContextCPU() const;
// Return the raw value of |context_flags_|
uint32_t GetContextFlags() const;
// Returns raw CPU-specific context data for the named CPU type. If the
// context data does not match the CPU type or does not exist, returns NULL.
const MDRawContextAMD64* GetContextAMD64() const;
const MDRawContextARM* GetContextARM() const;
const MDRawContextARM64* GetContextARM64() const;
const MDRawContextMIPS* GetContextMIPS() const;
const MDRawContextPPC* GetContextPPC() const;
const MDRawContextPPC64* GetContextPPC64() const;
const MDRawContextSPARC* GetContextSPARC() const;
const MDRawContextX86* GetContextX86() const;
const MDRawContextRISCV* GetContextRISCV() const;
const MDRawContextRISCV64* GetContextRISCV64() const;
// A convenience method to get the instruction pointer out of the
// MDRawContext, since it varies per-CPU architecture.
bool GetInstructionPointer(uint64_t* ip) const;
// Similar to the GetInstructionPointer method, this method gets the stack
// pointer for all CPU architectures.
bool GetStackPointer(uint64_t* sp) const;
// Print a human-readable representation of the object to stdout.
void Print();
protected:
DumpContext();
// Sets row CPU-specific context data for the names CPU type.
void SetContextFlags(uint32_t context_flags);
void SetContextX86(MDRawContextX86* x86);
void SetContextPPC(MDRawContextPPC* ppc);
void SetContextPPC64(MDRawContextPPC64* ppc64);
void SetContextAMD64(MDRawContextAMD64* amd64);
void SetContextSPARC(MDRawContextSPARC* ctx_sparc);
void SetContextARM(MDRawContextARM* arm);
void SetContextARM64(MDRawContextARM64* arm64);
void SetContextMIPS(MDRawContextMIPS* ctx_mips);
void SetContextRISCV(MDRawContextRISCV* riscv);
void SetContextRISCV64(MDRawContextRISCV64* riscv64);
// Free the CPU-specific context structure.
void FreeContext();
private:
// The CPU-specific context structure.
union {
MDRawContextBase* base;
MDRawContextX86* x86;
MDRawContextPPC* ppc;
MDRawContextPPC64* ppc64;
MDRawContextAMD64* amd64;
// on Solaris SPARC, sparc is defined as a numeric constant,
// so variables can NOT be named as sparc
MDRawContextSPARC* ctx_sparc;
MDRawContextARM* arm;
MDRawContextARM64* arm64;
MDRawContextMIPS* ctx_mips;
MDRawContextRISCV* riscv;
MDRawContextRISCV64* riscv64;
} context_;
// Store this separately because of the weirdo AMD64 context
uint32_t context_flags_;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_DUMP_CONTEXT_H__

View file

@ -0,0 +1,52 @@
// Copyright 2014 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// dump_object.h: A base class for all mini/micro dump object.
#ifndef GOOGLE_BREAKPAD_PROCESSOR_DUMP_OBJECT_H__
#define GOOGLE_BREAKPAD_PROCESSOR_DUMP_OBJECT_H__
namespace google_breakpad {
// DumpObject is the base of various mini/micro dump's objects.
class DumpObject {
public:
DumpObject();
bool valid() const { return valid_; }
protected:
// DumpObjects are not valid when created. When a subclass populates its own
// fields, it can set valid_ to true. Accessors and mutators may wish to
// consider or alter the valid_ state as they interact with objects.
bool valid_;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_DUMP_OBJECT_H__

View file

@ -0,0 +1,123 @@
// Copyright 2019 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// exception_record.h: A snapshot of an exception record.
//
// Author: Ivan Penkov
#ifndef THIRD_PARTY_BREAKPAD_SRC_GOOGLE_BREAKPAD_PROCESSOR_EXCEPTION_RECORD_H_
#define THIRD_PARTY_BREAKPAD_SRC_GOOGLE_BREAKPAD_PROCESSOR_EXCEPTION_RECORD_H_
#include <vector>
namespace google_breakpad {
// Additional argument that describes the exception.
class ExceptionParameter {
public:
ExceptionParameter(uint64_t value, const string& description)
: value_(value), description_(description) {}
// Accessors. See the data declarations below.
uint64_t value() const { return value_; }
void set_value(uint64_t value) { value_ = value; }
const string& description() const { return description_; }
void set_description(const string& description) {
description_ = description;
}
private:
// Parameter value.
uint64_t value_;
// Human readable description/interpretation of the above value.
string description_;
};
// A snapshot of an exception record. Contains exception record details: code,
// flags, address, parameters.
class ExceptionRecord {
public:
// Accessors. See the data declarations below.
uint32_t code() const { return code_; }
const string& code_description() const { return code_description_; }
void set_code(uint32_t code, const string& description) {
code_ = code;
code_description_ = description;
}
uint32_t flags() const { return flags_; }
const string& flags_description() const { return flags_description_; }
void set_flags(uint32_t flags, const string& description) {
flags_ = flags;
flags_description_ = description;
}
uint64_t nested_exception_record_address() const {
return nested_exception_record_address_;
}
void set_nested_exception_record_address(
uint64_t nested_exception_record_address) {
nested_exception_record_address_ = nested_exception_record_address;
}
uint64_t address() const { return address_; }
void set_address(uint64_t address) { address_ = address; }
const std::vector<ExceptionParameter>* parameters() const {
return &parameters_;
}
void add_parameter(uint64_t value, const string& description) {
parameters_.push_back(ExceptionParameter(value, description));
}
private:
// Exception code.
uint32_t code_;
string code_description_;
// Exception flags.
uint32_t flags_;
string flags_description_;
// The address of an associated MDException structure. Exception records can
// be chained together to provide additional information when nested
// exceptions occur.
uint64_t nested_exception_record_address_;
// The memory address that caused the exception. For data access errors,
// this will be the data address that caused the fault. For code errors,
// this will be the address of the instruction that caused the fault.
uint64_t address_;
// An array of additional arguments that describe the exception.
std::vector<ExceptionParameter> parameters_;
};
} // namespace google_breakpad
#endif // THIRD_PARTY_BREAKPAD_SRC_GOOGLE_BREAKPAD_PROCESSOR_EXCEPTION_RECORD_H_

View file

@ -0,0 +1,81 @@
// Copyright 2010 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// exploitability_engine.h: Generic exploitability engine.
//
// The Exploitability class is an abstract base class providing common
// generic methods that apply to exploitability engines for specific platforms.
// Specific implementations will extend this class by providing run
// methods to fill in the exploitability_ enumeration of the ProcessState
// for a crash.
//
// Author: Cris Neckar
#ifndef GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_H_
#define GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_H_
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/minidump.h"
#include "google_breakpad/processor/process_state.h"
namespace google_breakpad {
class Exploitability {
public:
virtual ~Exploitability() {}
static Exploitability *ExploitabilityForPlatform(Minidump *dump,
ProcessState *process_state);
// The boolean parameter signals whether the exploitability engine is
// enabled to call out to objdump for disassembly. This is disabled by
// default. It is used to check the identity of the instruction that
// caused the program to crash. This should not be enabled if there are
// portability concerns.
static Exploitability *ExploitabilityForPlatform(Minidump *dump,
ProcessState *process_state,
bool enable_objdump);
ExploitabilityRating CheckExploitability();
bool AddressIsAscii(uint64_t);
protected:
Exploitability(Minidump *dump,
ProcessState *process_state);
Minidump *dump_;
ProcessState *process_state_;
SystemInfo *system_info_;
private:
virtual ExploitabilityRating CheckPlatformExploitability() = 0;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_H_

View file

@ -0,0 +1,101 @@
// Copyright 2010 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// fast_source_line_resolver.h: FastSourceLineResolver is derived from
// SourceLineResolverBase, and is a concrete implementation of
// SourceLineResolverInterface.
//
// FastSourceLineResolver is a sibling class of BasicSourceLineResolver. The
// difference is FastSourceLineResolver loads a serialized memory chunk of data
// which can be used directly a Module without parsing or copying of underlying
// data. Therefore loading a symbol in FastSourceLineResolver is much faster
// and more memory-efficient than BasicSourceLineResolver.
//
// See "source_line_resolver_base.h" and
// "google_breakpad/source_line_resolver_interface.h" for more reference.
//
// Author: Siyang Xie (lambxsy@google.com)
#ifndef GOOGLE_BREAKPAD_PROCESSOR_FAST_SOURCE_LINE_RESOLVER_H__
#define GOOGLE_BREAKPAD_PROCESSOR_FAST_SOURCE_LINE_RESOLVER_H__
#include <map>
#include <string>
#include "google_breakpad/processor/source_line_resolver_base.h"
namespace google_breakpad {
using std::map;
class FastSourceLineResolver : public SourceLineResolverBase {
public:
FastSourceLineResolver();
virtual ~FastSourceLineResolver() { }
using SourceLineResolverBase::FillSourceLineInfo;
using SourceLineResolverBase::FindCFIFrameInfo;
using SourceLineResolverBase::FindWindowsFrameInfo;
using SourceLineResolverBase::HasModule;
using SourceLineResolverBase::IsModuleCorrupt;
using SourceLineResolverBase::LoadModule;
using SourceLineResolverBase::LoadModuleUsingMapBuffer;
using SourceLineResolverBase::LoadModuleUsingMemoryBuffer;
using SourceLineResolverBase::UnloadModule;
private:
// Friend declarations.
friend class ModuleComparer;
friend class ModuleSerializer;
friend class FastModuleFactory;
// Nested types that will derive from corresponding nested types defined in
// SourceLineResolverBase.
struct Line;
struct Function;
struct Inline;
struct InlineOrigin;
struct PublicSymbol;
class Module;
// Deserialize raw memory data to construct a WindowsFrameInfo object.
static WindowsFrameInfo CopyWFI(const char *raw_memory);
// FastSourceLineResolver requires the memory buffer stays alive during the
// lifetime of a corresponding module, therefore it needs to redefine this
// virtual method.
virtual bool ShouldDeleteMemoryBufferAfterLoadModule();
// Disallow unwanted copy ctor and assignment operator
FastSourceLineResolver(const FastSourceLineResolver&);
void operator=(const FastSourceLineResolver&);
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_FAST_SOURCE_LINE_RESOLVER_H__

View file

@ -0,0 +1,78 @@
// Copyright 2010 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// memory_region.h: Access to memory regions.
//
// A MemoryRegion provides virtual access to a range of memory. It is an
// abstraction allowing the actual source of memory to be independent of
// methods which need to access a virtual memory space.
//
// Author: Mark Mentovai
#ifndef GOOGLE_BREAKPAD_PROCESSOR_MEMORY_REGION_H__
#define GOOGLE_BREAKPAD_PROCESSOR_MEMORY_REGION_H__
#include "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
class MemoryRegion {
public:
virtual ~MemoryRegion() {}
// The base address of this memory region.
virtual uint64_t GetBase() const = 0;
// The size of this memory region.
virtual uint32_t GetSize() const = 0;
// Access to data of various sizes within the memory region. address
// is a pointer to read, and it must lie within the memory region as
// defined by its base address and size. The location pointed to by
// value is set to the value at address. Byte-swapping is performed
// if necessary so that the value is appropriate for the running
// program. Returns true on success. Fails and returns false if address
// is out of the region's bounds (after considering the width of value),
// or for other types of errors.
virtual bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const = 0;
virtual bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const = 0;
virtual bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const = 0;
virtual bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const = 0;
// Print a human-readable representation of the object to stdout.
virtual void Print() const = 0;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_MEMORY_REGION_H__

View file

@ -0,0 +1,134 @@
// Copyright 2014 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// microdump.h: A microdump reader. Microdump is a minified variant of a
// minidump (see minidump.h for documentation) which contains the minimum
// amount of information required to get a stack trace for the crashing thread.
// The information contained in a microdump is:
// - the crashing thread stack
// - system information (os type / version)
// - cpu context (state of the registers)
// - list of mmaps
#ifndef GOOGLE_BREAKPAD_PROCESSOR_MICRODUMP_H__
#define GOOGLE_BREAKPAD_PROCESSOR_MICRODUMP_H__
#include <string>
#include <vector>
#include "common/scoped_ptr.h"
#include "common/using_std_string.h"
#include "google_breakpad/processor/dump_context.h"
#include "google_breakpad/processor/memory_region.h"
#include "google_breakpad/processor/system_info.h"
#include "processor/basic_code_modules.h"
namespace google_breakpad {
// MicrodumpModuleList contains all of the loaded code modules for a process
// in the form of MicrodumpModules. It maintains a vector of these modules
// and provides access to a code module corresponding to a specific address.
class MicrodumpModules : public BasicCodeModules {
public:
// Takes over ownership of |module|.
void Add(const CodeModule* module);
// Enables/disables module address range shrink.
void SetEnableModuleShrink(bool is_enabled);
};
// MicrodumpContext carries a CPU-specific context.
// See dump_context.h for documentation.
class MicrodumpContext : public DumpContext {
public:
virtual void SetContextARM(MDRawContextARM* arm);
virtual void SetContextARM64(MDRawContextARM64* arm64);
virtual void SetContextX86(MDRawContextX86* x86);
virtual void SetContextMIPS(MDRawContextMIPS* mips32);
virtual void SetContextMIPS64(MDRawContextMIPS* mips64);
};
// This class provides access to microdump memory regions.
// See memory_region.h for documentation.
class MicrodumpMemoryRegion : public MemoryRegion {
public:
MicrodumpMemoryRegion();
virtual ~MicrodumpMemoryRegion() {}
// Set this region's address and contents. If we have placed an
// instance of this class in a test fixture class, individual tests
// can use this to provide the region's contents.
void Init(uint64_t base_address, const std::vector<uint8_t>& contents);
virtual uint64_t GetBase() const;
virtual uint32_t GetSize() const;
virtual bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const;
virtual bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const;
virtual bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const;
virtual bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const;
// Print a human-readable representation of the object to stdout.
virtual void Print() const;
private:
// Fetch a little-endian value from ADDRESS in contents_ whose size
// is BYTES, and store it in *VALUE. Returns true on success.
template<typename ValueType>
bool GetMemoryLittleEndian(uint64_t address, ValueType* value) const;
uint64_t base_address_;
std::vector<uint8_t> contents_;
};
// Microdump is the user's interface to a microdump file. It provides access to
// the microdump's context, memory regions and modules.
class Microdump {
public:
explicit Microdump(const string& contents);
virtual ~Microdump() {}
DumpContext* GetContext() { return context_.get(); }
MicrodumpMemoryRegion* GetMemory() { return stack_region_.get(); }
MicrodumpModules* GetModules() { return modules_.get(); }
SystemInfo* GetSystemInfo() { return system_info_.get(); }
string GetCrashReason() { return crash_reason_; }
uint64_t GetCrashAddress() { return crash_address_; }
private:
scoped_ptr<MicrodumpContext> context_;
scoped_ptr<MicrodumpMemoryRegion> stack_region_;
scoped_ptr<MicrodumpModules> modules_;
scoped_ptr<SystemInfo> system_info_;
string crash_reason_;
uint64_t crash_address_;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_MICRODUMP_H__

View file

@ -0,0 +1,63 @@
// Copyright 2014 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// The processor for microdump (a reduced dump containing only the state of the
// crashing thread). See crbug.com/410294 for more info and design docs.
#ifndef GOOGLE_BREAKPAD_PROCESSOR_MICRODUMP_PROCESSOR_H__
#define GOOGLE_BREAKPAD_PROCESSOR_MICRODUMP_PROCESSOR_H__
#include <string>
#include "common/using_std_string.h"
#include "google_breakpad/processor/process_result.h"
namespace google_breakpad {
class Microdump;
class ProcessState;
class StackFrameSymbolizer;
class MicrodumpProcessor {
public:
// Initializes the MicrodumpProcessor with a stack frame symbolizer.
// Does not take ownership of frame_symbolizer, which must NOT be NULL.
explicit MicrodumpProcessor(StackFrameSymbolizer* frame_symbolizer);
virtual ~MicrodumpProcessor();
// Processes the microdump contents and fills process_state with the result.
google_breakpad::ProcessResult Process(Microdump* microdump,
ProcessState* process_state);
private:
StackFrameSymbolizer* frame_symbolizer_;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_MICRODUMP_PROCESSOR_H__

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,164 @@
// Copyright 2006 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_PROCESSOR_H__
#define GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_PROCESSOR_H__
#include <assert.h>
#include <string>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/process_result.h"
namespace google_breakpad {
class Minidump;
class ProcessState;
class StackFrameSymbolizer;
class SourceLineResolverInterface;
class SymbolSupplier;
struct SystemInfo;
class MinidumpProcessor {
public:
// Initializes this MinidumpProcessor. supplier should be an
// implementation of the SymbolSupplier abstract base class.
MinidumpProcessor(SymbolSupplier* supplier,
SourceLineResolverInterface* resolver);
// Initializes the MinidumpProcessor with the option of
// enabling the exploitability framework to analyze dumps
// for probable security relevance.
MinidumpProcessor(SymbolSupplier* supplier,
SourceLineResolverInterface* resolver,
bool enable_exploitability);
// Initializes the MinidumpProcessor with source line resolver helper, and
// the option of enabling the exploitability framework to analyze dumps
// for probable security relevance.
// Does not take ownership of resolver_helper, which must NOT be NULL.
MinidumpProcessor(StackFrameSymbolizer* stack_frame_symbolizer,
bool enable_exploitability);
~MinidumpProcessor();
// Processes the minidump file and fills process_state with the result.
ProcessResult Process(const string& minidump_file,
ProcessState* process_state);
// Processes the minidump structure and fills process_state with the
// result.
ProcessResult Process(Minidump* minidump,
ProcessState* process_state);
// Populates the cpu_* fields of the |info| parameter with textual
// representations of the CPU type that the minidump in |dump| was
// produced on. Returns false if this information is not available in
// the minidump.
static bool GetCPUInfo(Minidump* dump, SystemInfo* info);
// Populates the os_* fields of the |info| parameter with textual
// representations of the operating system that the minidump in |dump|
// was produced on. Returns false if this information is not available in
// the minidump.
static bool GetOSInfo(Minidump* dump, SystemInfo* info);
// Populates the |process_create_time| parameter with the create time of the
// crashed process. Returns false if this information is not available in
// the minidump |dump|.
static bool GetProcessCreateTime(Minidump* dump,
uint32_t* process_create_time);
// Returns a textual representation of the reason that a crash occurred,
// if the minidump in dump was produced as a result of a crash. Returns
// an empty string if this information cannot be determined. If address
// is non-NULL, it will be set to contain the address that caused the
// exception, if this information is available. This will be a code
// address when the crash was caused by problems such as illegal
// instructions or divisions by zero, or a data address when the crash
// was caused by a memory access violation. If enable_objdump is set, this
// may use disassembly to compute the faulting address.
static string GetCrashReason(Minidump* dump, uint64_t* address,
bool enable_objdump);
// This function returns true if the passed-in error code is
// something unrecoverable(i.e. retry should not happen). For
// instance, if the minidump is corrupt, then it makes no sense to
// retry as we won't be able to glean additional information.
// However, as an example of the other case, the symbol supplier can
// return an error code indicating it was 'interrupted', which can
// happen of the symbols are fetched from a remote store, and a
// retry might be successful later on.
// You should not call this method with PROCESS_OK! Test for
// that separately before calling this.
static bool IsErrorUnrecoverable(ProcessResult p) {
assert(p != PROCESS_OK);
return (p != PROCESS_SYMBOL_SUPPLIER_INTERRUPTED);
}
// Returns a textual representation of an assertion included
// in the minidump. Returns an empty string if this information
// does not exist or cannot be determined.
static string GetAssertion(Minidump* dump);
// Sets the flag to enable/disable use of objdump during normal crash
// processing. This is independent from the flag for use of objdump during
// exploitability analysis.
void set_enable_objdump(bool enabled) { enable_objdump_ = enabled; }
// Sets the flag to enable/disable use of objdump during exploitability
// analysis. This is independent from the flag for use of objdump during
// normal crash processing.
void set_enable_objdump_for_exploitability(bool enabled) {
enable_objdump_for_exploitability_ = enabled;
}
private:
StackFrameSymbolizer* frame_symbolizer_;
// Indicate whether resolver_helper_ is owned by this instance.
bool own_frame_symbolizer_;
// This flag enables the exploitability scanner which attempts to
// guess how likely it is that the crash represents an exploitable
// memory corruption issue.
bool enable_exploitability_;
// This flag permits the processor to shell out to objdump for purposes of
// disassembly during normal crash processing, but not during exploitability
// analysis.
bool enable_objdump_;
// This flag permits the exploitability scanner to shell out to objdump for
// purposes of disassembly. This results in significantly more overhead than
// the enable_objdump_ flag.
bool enable_objdump_for_exploitability_;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_PROCESSOR_H__

View file

@ -0,0 +1,60 @@
// Copyright 2013 Google LLC
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_DEBUG_PROC_MAPS_LINUX_H_
#define BASE_DEBUG_PROC_MAPS_LINUX_H_
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
// Describes a region of mapped memory and the path of the file mapped.
struct MappedMemoryRegion {
enum Permission {
READ = 1 << 0,
WRITE = 1 << 1,
EXECUTE = 1 << 2,
PRIVATE = 1 << 3, // If set, region is private, otherwise it is shared.
};
// The address range [start,end) of mapped memory.
uint64_t start;
uint64_t end;
// Byte offset into |path| of the range mapped into memory.
uint64_t offset;
// Bitmask of read/write/execute/private/shared permissions.
uint8_t permissions;
// Major and minor devices.
uint8_t major_device;
uint8_t minor_device;
// Value of the inode.
uint64_t inode;
// Name of the file mapped into memory.
//
// NOTE: path names aren't guaranteed to point at valid files. For example,
// "[heap]" and "[stack]" are used to represent the location of the process'
// heap and stack, respectively.
string path;
// The line from /proc/<pid>/maps that this struct represents.
string line;
};
// Parses /proc/<pid>/maps input data and stores in |regions|. Returns true
// and updates |regions| if and only if all of |input| was successfully parsed.
bool ParseProcMaps(const string& input,
std::vector<MappedMemoryRegion>* regions);
} // namespace google_breakpad
#endif // BASE_DEBUG_PROC_MAPS_LINUX_H_

View file

@ -0,0 +1,69 @@
// Copyright 2014 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef GOOGLE_BREAKPAD_PROCESSOR_PROCESS_RESULT_H__
#define GOOGLE_BREAKPAD_PROCESSOR_PROCESS_RESULT_H__
namespace google_breakpad {
// Return type for MinidumpProcessor or MicrodumpProcessor's Process()
enum ProcessResult {
PROCESS_OK, // The dump was processed
// successfully.
PROCESS_ERROR_MINIDUMP_NOT_FOUND, // The minidump file was not
// found.
PROCESS_ERROR_NO_MINIDUMP_HEADER, // The minidump file had no
// header.
PROCESS_ERROR_NO_THREAD_LIST, // The minidump file has no
// thread list.
PROCESS_ERROR_GETTING_THREAD, // There was an error getting one
// thread's data from th dump.
PROCESS_ERROR_GETTING_THREAD_ID, // There was an error getting a
// thread id from the thread's
// data.
PROCESS_ERROR_DUPLICATE_REQUESTING_THREADS, // There was more than one
// requesting thread.
PROCESS_SYMBOL_SUPPLIER_INTERRUPTED, // The dump processing was
// interrupted by the
// SymbolSupplier(not fatal).
PROCESS_ERROR_GETTING_THREAD_NAME, // There was an error getting one
// thread's name from the dump.
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_PROCESS_RESULT_H__

View file

@ -0,0 +1,214 @@
// Copyright 2006 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// process_state.h: A snapshot of a process, in a fully-digested state.
//
// Author: Mark Mentovai
#ifndef GOOGLE_BREAKPAD_PROCESSOR_PROCESS_STATE_H__
#define GOOGLE_BREAKPAD_PROCESSOR_PROCESS_STATE_H__
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/code_modules.h"
#include "google_breakpad/processor/exception_record.h"
#include "google_breakpad/processor/minidump.h"
#include "google_breakpad/processor/system_info.h"
#include "processor/linked_ptr.h"
namespace google_breakpad {
using std::vector;
class CallStack;
class CodeModules;
enum ExploitabilityRating {
EXPLOITABILITY_HIGH, // The crash likely represents
// a exploitable memory corruption
// vulnerability.
EXPLOITABILITY_MEDIUM, // The crash appears to corrupt
// memory in a way which may be
// exploitable in some situations.
EXPLOITABLITY_MEDIUM = EXPLOITABILITY_MEDIUM, // an old misspelling
EXPLOITABILITY_LOW, // The crash either does not corrupt
// memory directly or control over
// the affected data is limited. The
// issue may still be exploitable
// on certain platforms or situations.
EXPLOITABILITY_INTERESTING, // The crash does not appear to be
// directly exploitable. However it
// represents a condition which should
// be further analyzed.
EXPLOITABILITY_NONE, // The crash does not appear to represent
// an exploitable condition.
EXPLOITABILITY_NOT_ANALYZED, // The crash was not analyzed for
// exploitability because the engine
// was disabled.
EXPLOITABILITY_ERR_NOENGINE, // The supplied minidump's platform does
// not have a exploitability engine
// associated with it.
EXPLOITABILITY_ERR_PROCESSING // An error occured within the
// exploitability engine and no rating
// was calculated.
};
class ProcessState {
public:
ProcessState() : modules_(NULL), unloaded_modules_(NULL) { Clear(); }
~ProcessState();
// Resets the ProcessState to its default values
void Clear();
// Accessors. See the data declarations below.
uint32_t time_date_stamp() const { return time_date_stamp_; }
uint32_t process_create_time() const { return process_create_time_; }
bool crashed() const { return crashed_; }
string crash_reason() const { return crash_reason_; }
uint64_t crash_address() const { return crash_address_; }
string assertion() const { return assertion_; }
int requesting_thread() const { return requesting_thread_; }
const ExceptionRecord* exception_record() const { return &exception_record_; }
const vector<CallStack*>* threads() const { return &threads_; }
const vector<MemoryRegion*>* thread_memory_regions() const {
return &thread_memory_regions_;
}
const vector<string>* thread_names() const { return &thread_names_; }
const SystemInfo* system_info() const { return &system_info_; }
const CodeModules* modules() const { return modules_; }
const CodeModules* unloaded_modules() const { return unloaded_modules_; }
const vector<linked_ptr<const CodeModule> >* shrunk_range_modules() const {
return &shrunk_range_modules_;
}
const vector<const CodeModule*>* modules_without_symbols() const {
return &modules_without_symbols_;
}
const vector<const CodeModule*>* modules_with_corrupt_symbols() const {
return &modules_with_corrupt_symbols_;
}
ExploitabilityRating exploitability() const { return exploitability_; }
private:
// MinidumpProcessor and MicrodumpProcessor are responsible for building
// ProcessState objects.
friend class MinidumpProcessor;
friend class MicrodumpProcessor;
// The time-date stamp of the minidump (time_t format)
uint32_t time_date_stamp_;
// The time-date stamp when the process was created (time_t format)
uint32_t process_create_time_;
// True if the process crashed, false if the dump was produced outside
// of an exception handler.
bool crashed_;
// If the process crashed, the type of crash. OS- and possibly CPU-
// specific. For example, "EXCEPTION_ACCESS_VIOLATION" (Windows),
// "EXC_BAD_ACCESS / KERN_INVALID_ADDRESS" (Mac OS X), "SIGSEGV"
// (other Unix).
string crash_reason_;
// If the process crashed, and if crash_reason implicates memory,
// the memory address that caused the crash. For data access errors,
// this will be the data address that caused the fault. For code errors,
// this will be the address of the instruction that caused the fault.
uint64_t crash_address_;
// If there was an assertion that was hit, a textual representation
// of that assertion, possibly including the file and line at which
// it occurred.
string assertion_;
// The index of the thread that requested a dump be written in the
// threads vector. If a dump was produced as a result of a crash, this
// will point to the thread that crashed. If the dump was produced as
// by user code without crashing, and the dump contains extended Breakpad
// information, this will point to the thread that requested the dump.
// If the dump was not produced as a result of an exception and no
// extended Breakpad information is present, this field will be set to -1,
// indicating that the dump thread is not available.
int requesting_thread_;
// Exception record details: code, flags, address, parameters.
ExceptionRecord exception_record_;
// Stacks for each thread (except possibly the exception handler
// thread) at the time of the crash.
vector<CallStack*> threads_;
vector<MemoryRegion*> thread_memory_regions_;
// Names of each thread at the time of the crash, one for each entry in
// threads_. Note that a thread's name might be empty if there was no
// corresponding ThreadNamesStream in the minidump, or if a particular thread
// ID was not present in the THREAD_NAME_LIST.
vector<string> thread_names_;
// OS and CPU information.
SystemInfo system_info_;
// The modules that were loaded into the process represented by the
// ProcessState.
const CodeModules *modules_;
// The modules that have been unloaded from the process represented by the
// ProcessState.
const CodeModules *unloaded_modules_;
// The modules which virtual address ranges were shrunk down due to
// virtual address conflicts.
vector<linked_ptr<const CodeModule> > shrunk_range_modules_;
// The modules that didn't have symbols when the report was processed.
vector<const CodeModule*> modules_without_symbols_;
// The modules that had corrupt symbols when the report was processed.
vector<const CodeModule*> modules_with_corrupt_symbols_;
// The exploitability rating as determined by the exploitability
// engine. When the exploitability engine is not enabled this
// defaults to EXPLOITABILITY_NOT_ANALYZED.
ExploitabilityRating exploitability_;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_PROCESS_STATE_H__

View file

@ -0,0 +1,132 @@
// Copyright 2010 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// source_line_resolver_base.h: SourceLineResolverBase, an (incomplete)
// implementation of SourceLineResolverInterface. It serves as a common base
// class for concrete implementations: FastSourceLineResolver and
// BasicSourceLineResolver. It is designed for refactoring that removes
// code redundancy in the two concrete source line resolver classes.
//
// See "google_breakpad/processor/source_line_resolver_interface.h" for more
// documentation.
// Author: Siyang Xie (lambxsy@google.com)
#ifndef GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_BASE_H__
#define GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_BASE_H__
#include <deque>
#include <map>
#include <set>
#include <string>
#include "google_breakpad/processor/source_line_resolver_interface.h"
namespace google_breakpad {
using std::map;
using std::set;
// Forward declaration.
// ModuleFactory is a simple factory interface for creating a Module instance
// at run-time.
class ModuleFactory;
class SourceLineResolverBase : public SourceLineResolverInterface {
public:
// Read the symbol_data from a file with given file_name.
// The part of code was originally in BasicSourceLineResolver::Module's
// LoadMap() method.
// Place dynamically allocated heap buffer in symbol_data. Caller has the
// ownership of the buffer, and should call delete [] to free the buffer.
static bool ReadSymbolFile(const string& file_name,
char** symbol_data,
size_t* symbol_data_size);
protected:
// Users are not allowed create SourceLineResolverBase instance directly.
SourceLineResolverBase(ModuleFactory* module_factory);
virtual ~SourceLineResolverBase();
// Virtual methods inherited from SourceLineResolverInterface.
virtual bool LoadModule(const CodeModule* module, const string& map_file);
virtual bool LoadModuleUsingMapBuffer(const CodeModule* module,
const string& map_buffer);
virtual bool LoadModuleUsingMemoryBuffer(const CodeModule* module,
char* memory_buffer,
size_t memory_buffer_size);
virtual bool ShouldDeleteMemoryBufferAfterLoadModule();
virtual void UnloadModule(const CodeModule* module);
virtual bool HasModule(const CodeModule* module);
virtual bool IsModuleCorrupt(const CodeModule* module);
virtual void FillSourceLineInfo(
StackFrame* frame,
std::deque<std::unique_ptr<StackFrame>>* inlined_frames);
virtual WindowsFrameInfo* FindWindowsFrameInfo(const StackFrame* frame);
virtual CFIFrameInfo* FindCFIFrameInfo(const StackFrame* frame);
// Nested structs and classes.
struct InlineOrigin;
struct Inline;
struct Line;
struct Function;
struct PublicSymbol;
struct CompareString {
bool operator()(const string& s1, const string& s2) const;
};
// Module is an interface for an in-memory symbol file.
class Module;
class AutoFileCloser;
// All of the modules that are loaded.
typedef map<string, Module*, CompareString> ModuleMap;
ModuleMap* modules_;
// The loaded modules that were detecting to be corrupt during load.
typedef set<string, CompareString> ModuleSet;
ModuleSet* corrupt_modules_;
// All of heap-allocated buffers that are owned locally by resolver.
typedef std::map<string, char*, CompareString> MemoryMap;
MemoryMap* memory_buffers_;
// Creates a concrete module at run-time.
ModuleFactory* module_factory_;
private:
// ModuleFactory needs to have access to protected type Module.
friend class ModuleFactory;
// Disallow unwanted copy ctor and assignment operator
SourceLineResolverBase(const SourceLineResolverBase&);
void operator=(const SourceLineResolverBase&);
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_BASE_H__

View file

@ -0,0 +1,123 @@
// -*- mode: C++ -*-
// Copyright 2010 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Abstract interface to return function/file/line info for a memory address.
#ifndef GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
#define GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
#include <deque>
#include <memory>
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/code_module.h"
namespace google_breakpad {
struct StackFrame;
struct WindowsFrameInfo;
class CFIFrameInfo;
class SourceLineResolverInterface {
public:
typedef uint64_t MemAddr;
virtual ~SourceLineResolverInterface() {}
// Adds a module to this resolver, returning true on success.
//
// module should have at least the code_file, debug_file,
// and debug_identifier members populated.
//
// map_file should contain line/address mappings for this module.
virtual bool LoadModule(const CodeModule* module,
const string& map_file) = 0;
// Same as above, but takes the contents of a pre-read map buffer
virtual bool LoadModuleUsingMapBuffer(const CodeModule* module,
const string& map_buffer) = 0;
// Add an interface to load symbol using C-String data instead of string.
// This is useful in the optimization design for avoiding unnecessary copying
// of symbol data, in order to improve memory efficiency.
// LoadModuleUsingMemoryBuffer() does NOT take ownership of memory_buffer.
// LoadModuleUsingMemoryBuffer() null terminates the passed in buffer, if
// the last character is not a null terminator.
virtual bool LoadModuleUsingMemoryBuffer(const CodeModule* module,
char* memory_buffer,
size_t memory_buffer_size) = 0;
// Return true if the memory buffer should be deleted immediately after
// LoadModuleUsingMemoryBuffer(). Return false if the memory buffer has to be
// alive during the lifetime of the corresponding Module.
virtual bool ShouldDeleteMemoryBufferAfterLoadModule() = 0;
// Request that the specified module be unloaded from this resolver.
// A resolver may choose to ignore such a request.
virtual void UnloadModule(const CodeModule* module) = 0;
// Returns true if the module has been loaded.
virtual bool HasModule(const CodeModule* module) = 0;
// Returns true if the module has been loaded and it is corrupt.
virtual bool IsModuleCorrupt(const CodeModule* module) = 0;
// Fills in the function_base, function_name, source_file_name,
// and source_line fields of the StackFrame. The instruction and
// module_name fields must already be filled in. If inlined_frames is not
// nullptr, it will try to construct inlined frames by adding them into
// inlined_frames in an order from outermost frame to inner most frame.
virtual void FillSourceLineInfo(
StackFrame* frame,
std::deque<std::unique_ptr<StackFrame>>* inlined_frames) = 0;
// If Windows stack walking information is available covering
// FRAME's instruction address, return a WindowsFrameInfo structure
// describing it. If the information is not available, returns NULL.
// A NULL return value does not indicate an error. The caller takes
// ownership of any returned WindowsFrameInfo object.
virtual WindowsFrameInfo* FindWindowsFrameInfo(const StackFrame* frame) = 0;
// If CFI stack walking information is available covering ADDRESS,
// return a CFIFrameInfo structure describing it. If the information
// is not available, return NULL. The caller takes ownership of any
// returned CFIFrameInfo object.
virtual CFIFrameInfo* FindCFIFrameInfo(const StackFrame* frame) = 0;
protected:
// SourceLineResolverInterface cannot be instantiated except by subclasses
SourceLineResolverInterface() {}
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__

View file

@ -0,0 +1,158 @@
// Copyright 2006 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__
#define GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__
#include <string>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
class CodeModule;
struct StackFrame {
// Indicates how well the instruction pointer derived during
// stack walking is trusted. Since the stack walker can resort to
// stack scanning, it can wind up with dubious frames.
// In rough order of "trust metric".
enum FrameTrust {
FRAME_TRUST_NONE, // Unknown
FRAME_TRUST_SCAN, // Scanned the stack, found this
FRAME_TRUST_CFI_SCAN, // Found while scanning stack using call frame info
FRAME_TRUST_FP, // Derived from frame pointer
FRAME_TRUST_CFI, // Derived from call frame info
// Explicitly provided by some external stack walker.
FRAME_TRUST_PREWALKED,
FRAME_TRUST_CONTEXT, // Given as instruction pointer in a context
FRAME_TRUST_INLINE, // Found by inline records in symbol files.
// Derived from leaf function by simulating a return.
FRAME_TRUST_LEAF,
};
StackFrame()
: instruction(),
module(NULL),
function_name(),
function_base(),
source_file_name(),
source_line(0),
source_line_base(),
trust(FRAME_TRUST_NONE),
is_multiple(false) {}
virtual ~StackFrame() {}
// Return a string describing how this stack frame was found
// by the stackwalker.
string trust_description() const {
switch (trust) {
case StackFrame::FRAME_TRUST_CONTEXT:
return "given as instruction pointer in context";
case StackFrame::FRAME_TRUST_PREWALKED:
return "recovered by external stack walker";
case StackFrame::FRAME_TRUST_CFI:
return "call frame info";
case StackFrame::FRAME_TRUST_CFI_SCAN:
return "call frame info with scanning";
case StackFrame::FRAME_TRUST_FP:
return "previous frame's frame pointer";
case StackFrame::FRAME_TRUST_SCAN:
return "stack scanning";
case StackFrame::FRAME_TRUST_INLINE:
return "inline record";
case StackFrame::FRAME_TRUST_LEAF:
return "simulating a return from leaf function";
default:
return "unknown";
}
}
// Return the actual return address, as saved on the stack or in a
// register. See the comments for 'instruction', below, for details.
virtual uint64_t ReturnAddress() const { return instruction; }
// The program counter location as an absolute virtual address.
//
// - For the innermost called frame in a stack, this will be an exact
// program counter or instruction pointer value.
//
// - For all other frames, this address is within the instruction that
// caused execution to branch to this frame's callee (although it may
// not point to the exact beginning of that instruction). This ensures
// that, when we look up the source code location for this frame, we
// get the source location of the call, not of the point at which
// control will resume when the call returns, which may be on the next
// line. (If the compiler knows the callee never returns, it may even
// place the call instruction at the very end of the caller's machine
// code, such that the "return address" (which will never be used)
// immediately after the call instruction is in an entirely different
// function, perhaps even from a different source file.)
//
// On some architectures, the return address as saved on the stack or in
// a register is fine for looking up the point of the call. On others, it
// requires adjustment. ReturnAddress returns the address as saved by the
// machine.
uint64_t instruction;
// The module in which the instruction resides.
const CodeModule *module;
// The function name, may be omitted if debug symbols are not available.
string function_name;
// The start address of the function, may be omitted if debug symbols
// are not available.
uint64_t function_base;
// The source file name, may be omitted if debug symbols are not available.
string source_file_name;
// The (1-based) source line number, may be omitted if debug symbols are
// not available.
int source_line;
// The start address of the source line, may be omitted if debug symbols
// are not available.
uint64_t source_line_base;
// Amount of trust the stack walker has in the instruction pointer
// of this frame.
FrameTrust trust;
// True if the frame corresponds to multiple functions, for example as the
// result of identical code folding by the linker. In that case the function
// name, filename, etc. information above represents the state of an arbitrary
// one of these functions.
bool is_multiple;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__

View file

@ -0,0 +1,519 @@
// -*- mode: c++ -*-
// Copyright 2010 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// stack_frame_cpu.h: CPU-specific StackFrame extensions.
//
// These types extend the StackFrame structure to carry CPU-specific register
// state. They are defined in this header instead of stack_frame.h to
// avoid the need to include minidump_format.h when only the generic
// StackFrame type is needed.
//
// Author: Mark Mentovai
#ifndef GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_CPU_H__
#define GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_CPU_H__
#include "google_breakpad/common/minidump_format.h"
#include "google_breakpad/processor/stack_frame.h"
namespace google_breakpad {
struct WindowsFrameInfo;
class CFIFrameInfo;
struct StackFrameX86 : public StackFrame {
// ContextValidity has one entry for each relevant hardware pointer
// register (%eip and %esp) and one entry for each general-purpose
// register. It's worthwhile having validity flags for caller-saves
// registers: they are valid in the youngest frame, and such a frame
// might save a callee-saves register in a caller-saves register, but
// SimpleCFIWalker won't touch registers unless they're marked as valid.
enum ContextValidity {
CONTEXT_VALID_NONE = 0,
CONTEXT_VALID_EIP = 1 << 0,
CONTEXT_VALID_ESP = 1 << 1,
CONTEXT_VALID_EBP = 1 << 2,
CONTEXT_VALID_EAX = 1 << 3,
CONTEXT_VALID_EBX = 1 << 4,
CONTEXT_VALID_ECX = 1 << 5,
CONTEXT_VALID_EDX = 1 << 6,
CONTEXT_VALID_ESI = 1 << 7,
CONTEXT_VALID_EDI = 1 << 8,
CONTEXT_VALID_ALL = -1
};
StackFrameX86()
: context(),
context_validity(CONTEXT_VALID_NONE),
windows_frame_info(NULL),
cfi_frame_info(NULL) {}
~StackFrameX86();
// Overriden to return the return address as saved on the stack.
virtual uint64_t ReturnAddress() const;
// Register state. This is only fully valid for the topmost frame in a
// stack. In other frames, the values of nonvolatile registers may be
// present, given sufficient debugging information. Refer to
// context_validity.
MDRawContextX86 context;
// context_validity is actually ContextValidity, but int is used because
// the OR operator doesn't work well with enumerated types. This indicates
// which fields in context are valid.
int context_validity;
// Any stack walking information we found describing this.instruction.
// These may be NULL if there is no such information for that address.
WindowsFrameInfo *windows_frame_info;
CFIFrameInfo *cfi_frame_info;
};
struct StackFramePPC : public StackFrame {
// ContextValidity should eventually contain entries for the validity of
// other nonvolatile (callee-save) registers as in
// StackFrameX86::ContextValidity, but the ppc stackwalker doesn't currently
// locate registers other than the ones listed here.
enum ContextValidity {
CONTEXT_VALID_NONE = 0,
CONTEXT_VALID_SRR0 = 1 << 0,
CONTEXT_VALID_GPR1 = 1 << 1,
CONTEXT_VALID_ALL = -1
};
StackFramePPC() : context(), context_validity(CONTEXT_VALID_NONE) {}
// Register state. This is only fully valid for the topmost frame in a
// stack. In other frames, the values of nonvolatile registers may be
// present, given sufficient debugging information. Refer to
// context_validity.
MDRawContextPPC context;
// context_validity is actually ContextValidity, but int is used because
// the OR operator doesn't work well with enumerated types. This indicates
// which fields in context are valid.
int context_validity;
};
struct StackFramePPC64 : public StackFrame {
// ContextValidity should eventually contain entries for the validity of
// other nonvolatile (callee-save) registers as in
// StackFrameX86::ContextValidity, but the ppc stackwalker doesn't currently
// locate registers other than the ones listed here.
enum ContextValidity {
CONTEXT_VALID_NONE = 0,
CONTEXT_VALID_SRR0 = 1 << 0,
CONTEXT_VALID_GPR1 = 1 << 1,
CONTEXT_VALID_ALL = -1
};
StackFramePPC64() : context(), context_validity(CONTEXT_VALID_NONE) {}
// Register state. This is only fully valid for the topmost frame in a
// stack. In other frames, the values of nonvolatile registers may be
// present, given sufficient debugging information. Refer to
// context_validity.
MDRawContextPPC64 context;
// context_validity is actually ContextValidity, but int is used because
// the OR operator doesn't work well with enumerated types. This indicates
// which fields in context are valid.
int context_validity;
};
struct StackFrameAMD64 : public StackFrame {
// ContextValidity has one entry for each register that we might be able
// to recover.
enum ContextValidity {
CONTEXT_VALID_NONE = 0,
CONTEXT_VALID_RAX = 1 << 0,
CONTEXT_VALID_RDX = 1 << 1,
CONTEXT_VALID_RCX = 1 << 2,
CONTEXT_VALID_RBX = 1 << 3,
CONTEXT_VALID_RSI = 1 << 4,
CONTEXT_VALID_RDI = 1 << 5,
CONTEXT_VALID_RBP = 1 << 6,
CONTEXT_VALID_RSP = 1 << 7,
CONTEXT_VALID_R8 = 1 << 8,
CONTEXT_VALID_R9 = 1 << 9,
CONTEXT_VALID_R10 = 1 << 10,
CONTEXT_VALID_R11 = 1 << 11,
CONTEXT_VALID_R12 = 1 << 12,
CONTEXT_VALID_R13 = 1 << 13,
CONTEXT_VALID_R14 = 1 << 14,
CONTEXT_VALID_R15 = 1 << 15,
CONTEXT_VALID_RIP = 1 << 16,
CONTEXT_VALID_ALL = -1
};
StackFrameAMD64() : context(), context_validity(CONTEXT_VALID_NONE) {}
// Overriden to return the return address as saved on the stack.
virtual uint64_t ReturnAddress() const;
// Register state. This is only fully valid for the topmost frame in a
// stack. In other frames, which registers are present depends on what
// debugging information we had available. Refer to context_validity.
MDRawContextAMD64 context;
// For each register in context whose value has been recovered, we set
// the corresponding CONTEXT_VALID_ bit in context_validity.
//
// context_validity's type should actually be ContextValidity, but
// we use int instead because the bitwise inclusive or operator
// yields an int when applied to enum values, and C++ doesn't
// silently convert from ints to enums.
int context_validity;
};
struct StackFrameSPARC : public StackFrame {
// to be confirmed
enum ContextValidity {
CONTEXT_VALID_NONE = 0,
CONTEXT_VALID_PC = 1 << 0,
CONTEXT_VALID_SP = 1 << 1,
CONTEXT_VALID_FP = 1 << 2,
CONTEXT_VALID_ALL = -1
};
StackFrameSPARC() : context(), context_validity(CONTEXT_VALID_NONE) {}
// Register state. This is only fully valid for the topmost frame in a
// stack. In other frames, the values of nonvolatile registers may be
// present, given sufficient debugging information. Refer to
// context_validity.
MDRawContextSPARC context;
// context_validity is actually ContextValidity, but int is used because
// the OR operator doesn't work well with enumerated types. This indicates
// which fields in context are valid.
int context_validity;
};
struct StackFrameARM : public StackFrame {
// A flag for each register we might know.
enum ContextValidity {
CONTEXT_VALID_NONE = 0,
CONTEXT_VALID_R0 = 1 << 0,
CONTEXT_VALID_R1 = 1 << 1,
CONTEXT_VALID_R2 = 1 << 2,
CONTEXT_VALID_R3 = 1 << 3,
CONTEXT_VALID_R4 = 1 << 4,
CONTEXT_VALID_R5 = 1 << 5,
CONTEXT_VALID_R6 = 1 << 6,
CONTEXT_VALID_R7 = 1 << 7,
CONTEXT_VALID_R8 = 1 << 8,
CONTEXT_VALID_R9 = 1 << 9,
CONTEXT_VALID_R10 = 1 << 10,
CONTEXT_VALID_R11 = 1 << 11,
CONTEXT_VALID_R12 = 1 << 12,
CONTEXT_VALID_R13 = 1 << 13,
CONTEXT_VALID_R14 = 1 << 14,
CONTEXT_VALID_R15 = 1 << 15,
CONTEXT_VALID_ALL = ~CONTEXT_VALID_NONE,
// Aliases for registers with dedicated or conventional roles.
CONTEXT_VALID_FP = CONTEXT_VALID_R11,
CONTEXT_VALID_SP = CONTEXT_VALID_R13,
CONTEXT_VALID_LR = CONTEXT_VALID_R14,
CONTEXT_VALID_PC = CONTEXT_VALID_R15
};
StackFrameARM() : context(), context_validity(CONTEXT_VALID_NONE) {}
// Return the ContextValidity flag for register rN.
static ContextValidity RegisterValidFlag(int n) {
if (0 <= n && n <= 15) {
return ContextValidity(1 << n);
}
return CONTEXT_VALID_NONE;
}
// Register state. This is only fully valid for the topmost frame in a
// stack. In other frames, the values of nonvolatile registers may be
// present, given sufficient debugging information. Refer to
// context_validity.
MDRawContextARM context;
// For each register in context whose value has been recovered, we set
// the corresponding CONTEXT_VALID_ bit in context_validity.
//
// context_validity's type should actually be ContextValidity, but
// we use int instead because the bitwise inclusive or operator
// yields an int when applied to enum values, and C++ doesn't
// silently convert from ints to enums.
int context_validity;
};
struct StackFrameARM64 : public StackFrame {
// A flag for each register we might know. Note that we can't use an enum
// here as there are 33 values to represent.
static const uint64_t CONTEXT_VALID_NONE = 0;
static const uint64_t CONTEXT_VALID_X0 = 1ULL << 0;
static const uint64_t CONTEXT_VALID_X1 = 1ULL << 1;
static const uint64_t CONTEXT_VALID_X2 = 1ULL << 2;
static const uint64_t CONTEXT_VALID_X3 = 1ULL << 3;
static const uint64_t CONTEXT_VALID_X4 = 1ULL << 4;
static const uint64_t CONTEXT_VALID_X5 = 1ULL << 5;
static const uint64_t CONTEXT_VALID_X6 = 1ULL << 6;
static const uint64_t CONTEXT_VALID_X7 = 1ULL << 7;
static const uint64_t CONTEXT_VALID_X8 = 1ULL << 8;
static const uint64_t CONTEXT_VALID_X9 = 1ULL << 9;
static const uint64_t CONTEXT_VALID_X10 = 1ULL << 10;
static const uint64_t CONTEXT_VALID_X11 = 1ULL << 11;
static const uint64_t CONTEXT_VALID_X12 = 1ULL << 12;
static const uint64_t CONTEXT_VALID_X13 = 1ULL << 13;
static const uint64_t CONTEXT_VALID_X14 = 1ULL << 14;
static const uint64_t CONTEXT_VALID_X15 = 1ULL << 15;
static const uint64_t CONTEXT_VALID_X16 = 1ULL << 16;
static const uint64_t CONTEXT_VALID_X17 = 1ULL << 17;
static const uint64_t CONTEXT_VALID_X18 = 1ULL << 18;
static const uint64_t CONTEXT_VALID_X19 = 1ULL << 19;
static const uint64_t CONTEXT_VALID_X20 = 1ULL << 20;
static const uint64_t CONTEXT_VALID_X21 = 1ULL << 21;
static const uint64_t CONTEXT_VALID_X22 = 1ULL << 22;
static const uint64_t CONTEXT_VALID_X23 = 1ULL << 23;
static const uint64_t CONTEXT_VALID_X24 = 1ULL << 24;
static const uint64_t CONTEXT_VALID_X25 = 1ULL << 25;
static const uint64_t CONTEXT_VALID_X26 = 1ULL << 26;
static const uint64_t CONTEXT_VALID_X27 = 1ULL << 27;
static const uint64_t CONTEXT_VALID_X28 = 1ULL << 28;
static const uint64_t CONTEXT_VALID_X29 = 1ULL << 29;
static const uint64_t CONTEXT_VALID_X30 = 1ULL << 30;
static const uint64_t CONTEXT_VALID_X31 = 1ULL << 31;
static const uint64_t CONTEXT_VALID_X32 = 1ULL << 32;
static const uint64_t CONTEXT_VALID_ALL = ~CONTEXT_VALID_NONE;
// Aliases for registers with dedicated or conventional roles.
static const uint64_t CONTEXT_VALID_FP = CONTEXT_VALID_X29;
static const uint64_t CONTEXT_VALID_LR = CONTEXT_VALID_X30;
static const uint64_t CONTEXT_VALID_SP = CONTEXT_VALID_X31;
static const uint64_t CONTEXT_VALID_PC = CONTEXT_VALID_X32;
StackFrameARM64() : context(),
context_validity(CONTEXT_VALID_NONE) {}
// Return the validity flag for register xN.
static uint64_t RegisterValidFlag(int n) {
return 1ULL << n;
}
// Register state. This is only fully valid for the topmost frame in a
// stack. In other frames, the values of nonvolatile registers may be
// present, given sufficient debugging information. Refer to
// context_validity.
MDRawContextARM64 context;
// For each register in context whose value has been recovered, we set
// the corresponding CONTEXT_VALID_ bit in context_validity.
uint64_t context_validity;
};
struct StackFrameMIPS : public StackFrame {
// MIPS callee save registers for o32 ABI (32bit registers) are:
// 1. $s0-$s7,
// 2. $sp, $fp
// 3. $f20-$f31
//
// The register structure is available at
// http://en.wikipedia.org/wiki/MIPS_architecture#Compiler_register_usage
#define INDEX_MIPS_REG_S0 MD_CONTEXT_MIPS_REG_S0 // 16
#define INDEX_MIPS_REG_S7 MD_CONTEXT_MIPS_REG_S7 // 23
#define INDEX_MIPS_REG_GP MD_CONTEXT_MIPS_REG_GP // 28
#define INDEX_MIPS_REG_RA MD_CONTEXT_MIPS_REG_RA // 31
#define INDEX_MIPS_REG_PC 34
#define SHIFT_MIPS_REG_S0 0
#define SHIFT_MIPS_REG_GP 8
#define SHIFT_MIPS_REG_PC 12
enum ContextValidity {
CONTEXT_VALID_NONE = 0,
CONTEXT_VALID_S0 = 1 << 0, // $16
CONTEXT_VALID_S1 = 1 << 1, // $17
CONTEXT_VALID_S2 = 1 << 2, // $18
CONTEXT_VALID_S3 = 1 << 3, // $19
CONTEXT_VALID_S4 = 1 << 4, // $20
CONTEXT_VALID_S5 = 1 << 5, // $21
CONTEXT_VALID_S6 = 1 << 6, // $22
CONTEXT_VALID_S7 = 1 << 7, // $23
// GP is not calee-save for o32 abi.
CONTEXT_VALID_GP = 1 << 8, // $28
CONTEXT_VALID_SP = 1 << 9, // $29
CONTEXT_VALID_FP = 1 << 10, // $30
CONTEXT_VALID_RA = 1 << 11, // $31
CONTEXT_VALID_PC = 1 << 12, // $34
CONTEXT_VALID_ALL = ~CONTEXT_VALID_NONE
};
// Return the ContextValidity flag for register rN.
static ContextValidity RegisterValidFlag(int n) {
if (n >= INDEX_MIPS_REG_S0 && n <= INDEX_MIPS_REG_S7)
return ContextValidity(1 << (n - INDEX_MIPS_REG_S0 + SHIFT_MIPS_REG_S0));
else if (n >= INDEX_MIPS_REG_GP && n <= INDEX_MIPS_REG_RA)
return ContextValidity(1 << (n - INDEX_MIPS_REG_GP + SHIFT_MIPS_REG_GP));
else if (n == INDEX_MIPS_REG_PC)
return ContextValidity(1 << SHIFT_MIPS_REG_PC);
return CONTEXT_VALID_NONE;
}
StackFrameMIPS() : context(), context_validity(CONTEXT_VALID_NONE) {}
// Register state. This is only fully valid for the topmost frame in a
// stack. In other frames, which registers are present depends on what
// debugging information were available. Refer to 'context_validity' below.
MDRawContextMIPS context;
// For each register in context whose value has been recovered,
// the corresponding CONTEXT_VALID_ bit in 'context_validity' is set.
//
// context_validity's type should actually be ContextValidity, but
// type int is used instead because the bitwise inclusive or operator
// yields an int when applied to enum values, and C++ doesn't
// silently convert from ints to enums.
int context_validity;
};
struct StackFrameRISCV : public StackFrame {
enum ContextValidity {
CONTEXT_VALID_NONE = 0,
CONTEXT_VALID_PC = 1 << 0,
CONTEXT_VALID_RA = 1 << 1,
CONTEXT_VALID_SP = 1 << 2,
CONTEXT_VALID_GP = 1 << 3,
CONTEXT_VALID_TP = 1 << 4,
CONTEXT_VALID_T0 = 1 << 5,
CONTEXT_VALID_T1 = 1 << 6,
CONTEXT_VALID_T2 = 1 << 7,
CONTEXT_VALID_S0 = 1 << 8,
CONTEXT_VALID_S1 = 1 << 9,
CONTEXT_VALID_A0 = 1 << 10,
CONTEXT_VALID_A1 = 1 << 11,
CONTEXT_VALID_A2 = 1 << 12,
CONTEXT_VALID_A3 = 1 << 13,
CONTEXT_VALID_A4 = 1 << 14,
CONTEXT_VALID_A5 = 1 << 15,
CONTEXT_VALID_A6 = 1 << 16,
CONTEXT_VALID_A7 = 1 << 17,
CONTEXT_VALID_S2 = 1 << 18,
CONTEXT_VALID_S3 = 1 << 19,
CONTEXT_VALID_S4 = 1 << 20,
CONTEXT_VALID_S5 = 1 << 21,
CONTEXT_VALID_S6 = 1 << 22,
CONTEXT_VALID_S7 = 1 << 23,
CONTEXT_VALID_S8 = 1 << 24,
CONTEXT_VALID_S9 = 1 << 25,
CONTEXT_VALID_S10 = 1 << 26,
CONTEXT_VALID_S11 = 1 << 27,
CONTEXT_VALID_T3 = 1 << 28,
CONTEXT_VALID_T4 = 1 << 29,
CONTEXT_VALID_T5 = 1 << 30,
CONTEXT_VALID_T6 = 1 << 31,
CONTEXT_VALID_ALL = ~CONTEXT_VALID_NONE
};
StackFrameRISCV() : context(), context_validity(CONTEXT_VALID_NONE) {}
// Register state. This is only fully valid for the topmost frame in a
// stack. In other frames, which registers are present depends on what
// debugging information were available. Refer to 'context_validity' below.
MDRawContextRISCV context;
// For each register in context whose value has been recovered,
// the corresponding CONTEXT_VALID_ bit in 'context_validity' is set.
//
// context_validity's type should actually be ContextValidity, but
// type int is used instead because the bitwise inclusive or operator
// yields an int when applied to enum values, and C++ doesn't
// silently convert from ints to enums.
int context_validity;
};
struct StackFrameRISCV64 : public StackFrame {
enum ContextValidity {
CONTEXT_VALID_NONE = 0,
CONTEXT_VALID_PC = 1 << 0,
CONTEXT_VALID_RA = 1 << 1,
CONTEXT_VALID_SP = 1 << 2,
CONTEXT_VALID_GP = 1 << 3,
CONTEXT_VALID_TP = 1 << 4,
CONTEXT_VALID_T0 = 1 << 5,
CONTEXT_VALID_T1 = 1 << 6,
CONTEXT_VALID_T2 = 1 << 7,
CONTEXT_VALID_S0 = 1 << 8,
CONTEXT_VALID_S1 = 1 << 9,
CONTEXT_VALID_A0 = 1 << 10,
CONTEXT_VALID_A1 = 1 << 11,
CONTEXT_VALID_A2 = 1 << 12,
CONTEXT_VALID_A3 = 1 << 13,
CONTEXT_VALID_A4 = 1 << 14,
CONTEXT_VALID_A5 = 1 << 15,
CONTEXT_VALID_A6 = 1 << 16,
CONTEXT_VALID_A7 = 1 << 17,
CONTEXT_VALID_S2 = 1 << 18,
CONTEXT_VALID_S3 = 1 << 19,
CONTEXT_VALID_S4 = 1 << 20,
CONTEXT_VALID_S5 = 1 << 21,
CONTEXT_VALID_S6 = 1 << 22,
CONTEXT_VALID_S7 = 1 << 23,
CONTEXT_VALID_S8 = 1 << 24,
CONTEXT_VALID_S9 = 1 << 25,
CONTEXT_VALID_S10 = 1 << 26,
CONTEXT_VALID_S11 = 1 << 27,
CONTEXT_VALID_T3 = 1 << 28,
CONTEXT_VALID_T4 = 1 << 29,
CONTEXT_VALID_T5 = 1 << 30,
CONTEXT_VALID_T6 = 1 << 31,
CONTEXT_VALID_ALL = ~CONTEXT_VALID_NONE
};
StackFrameRISCV64() : context(), context_validity(CONTEXT_VALID_NONE) {}
// Register state. This is only fully valid for the topmost frame in a
// stack. In other frames, which registers are present depends on what
// debugging information were available. Refer to 'context_validity' below.
MDRawContextRISCV64 context;
// For each register in context whose value has been recovered,
// the corresponding CONTEXT_VALID_ bit in 'context_validity' is set.
//
// context_validity's type should actually be ContextValidity, but
// type int is used instead because the bitwise inclusive or operator
// yields an int when applied to enum values, and C++ doesn't
// silently convert from ints to enums.
int context_validity;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_CPU_H__

View file

@ -0,0 +1,113 @@
// -*- mode: C++ -*-
// Copyright 2012 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Helper class that encapsulates the logic of how symbol supplier interacts
// with source line resolver to fill stack frame information.
#ifndef GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_SYMBOLIZER_H__
#define GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_SYMBOLIZER_H__
#include <deque>
#include <memory>
#include <set>
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/code_module.h"
namespace google_breakpad {
class CFIFrameInfo;
class CodeModules;
class SymbolSupplier;
class SourceLineResolverInterface;
struct StackFrame;
struct SystemInfo;
struct WindowsFrameInfo;
class StackFrameSymbolizer {
public:
enum SymbolizerResult {
// Symbol data was found and successfully loaded in resolver.
// This does NOT guarantee source line info is found within symbol file.
kNoError,
// This indicates non-critical error, such as, no code module found for
// frame's instruction, no symbol file, or resolver failed to load symbol.
kError,
// This indicates error for which stack walk should be interrupted
// and retried in future.
kInterrupt,
// Symbol data was found and loaded in resolver however some corruptions
// were detected.
kWarningCorruptSymbols,
};
StackFrameSymbolizer(SymbolSupplier* supplier,
SourceLineResolverInterface* resolver);
virtual ~StackFrameSymbolizer() { }
// Encapsulate the step of resolving source line info for a stack frame.
// "frame" must not be NULL.
virtual SymbolizerResult FillSourceLineInfo(
const CodeModules* modules,
const CodeModules* unloaded_modules,
const SystemInfo* system_info,
StackFrame* stack_frame,
std::deque<std::unique_ptr<StackFrame>>* inlined_frames);
virtual WindowsFrameInfo* FindWindowsFrameInfo(const StackFrame* frame);
virtual CFIFrameInfo* FindCFIFrameInfo(const StackFrame* frame);
// Reset internal (locally owned) data as if the helper is re-instantiated.
// A typical case is to call Reset() after processing an individual report
// before start to process next one, in order to reset internal information
// about missing symbols found so far.
virtual void Reset() { no_symbol_modules_.clear(); }
// Returns true if there is valid implementation for stack symbolization.
virtual bool HasImplementation() { return resolver_ && supplier_; }
SourceLineResolverInterface* resolver() { return resolver_; }
SymbolSupplier* supplier() { return supplier_; }
protected:
SymbolSupplier* supplier_;
SourceLineResolverInterface* resolver_;
// A list of modules known to have symbols missing. This helps avoid
// repeated lookups for the missing symbols within one minidump.
std::set<string> no_symbol_modules_;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_SYMBOLIZER_H__

View file

@ -0,0 +1,260 @@
// Copyright 2010 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// stackwalker.h: Generic stackwalker.
//
// The Stackwalker class is an abstract base class providing common generic
// methods that apply to stacks from all systems. Specific implementations
// will extend this class by providing GetContextFrame and GetCallerFrame
// methods to fill in system-specific data in a StackFrame structure.
// Stackwalker assembles these StackFrame strucutres into a CallStack.
//
// Author: Mark Mentovai
#ifndef GOOGLE_BREAKPAD_PROCESSOR_STACKWALKER_H__
#define GOOGLE_BREAKPAD_PROCESSOR_STACKWALKER_H__
#include <set>
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/code_modules.h"
#include "google_breakpad/processor/memory_region.h"
#include "google_breakpad/processor/stack_frame_symbolizer.h"
namespace google_breakpad {
class CallStack;
class DumpContext;
class StackFrameSymbolizer;
using std::set;
using std::vector;
class Stackwalker {
public:
virtual ~Stackwalker() {}
// Populates the given CallStack by calling GetContextFrame and
// GetCallerFrame. The frames are further processed to fill all available
// data. Returns true if the stackwalk completed, or false if it was
// interrupted by SymbolSupplier::GetSymbolFile().
// Upon return, |modules_without_symbols| will be populated with pointers to
// the code modules (CodeModule*) that DON'T have symbols.
// |modules_with_corrupt_symbols| will be populated with pointers to the
// modules which have corrupt symbols. |modules_without_symbols| and
// |modules_with_corrupt_symbols| DO NOT take ownership of the code modules.
// The lifetime of these code modules is the same as the lifetime of the
// CodeModules passed to the StackWalker constructor (which currently
// happens to be the lifetime of the Breakpad's ProcessingState object).
// There is a check for duplicate modules so no duplicates are expected.
bool Walk(CallStack* stack,
vector<const CodeModule*>* modules_without_symbols,
vector<const CodeModule*>* modules_with_corrupt_symbols);
// Returns a new concrete subclass suitable for the CPU that a stack was
// generated on, according to the CPU type indicated by the context
// argument. If no suitable concrete subclass exists, returns NULL.
static Stackwalker* StackwalkerForCPU(
const SystemInfo* system_info,
DumpContext* context,
MemoryRegion* memory,
const CodeModules* modules,
const CodeModules* unloaded_modules,
StackFrameSymbolizer* resolver_helper);
static void set_max_frames(uint32_t max_frames) {
max_frames_ = max_frames;
max_frames_set_ = true;
}
static uint32_t max_frames() { return max_frames_; }
static void set_max_frames_scanned(uint32_t max_frames_scanned) {
max_frames_scanned_ = max_frames_scanned;
}
protected:
// system_info identifies the operating system, NULL or empty if unknown.
// memory identifies a MemoryRegion that provides the stack memory
// for the stack to walk. modules, if non-NULL, is a CodeModules
// object that is used to look up which code module each stack frame is
// associated with. frame_symbolizer is a StackFrameSymbolizer object that
// encapsulates the logic of how source line resolver interacts with symbol
// supplier to symbolize stack frame and look up caller frame information
// (see stack_frame_symbolizer.h).
// frame_symbolizer MUST NOT be NULL (asserted).
Stackwalker(const SystemInfo* system_info,
MemoryRegion* memory,
const CodeModules* modules,
StackFrameSymbolizer* frame_symbolizer);
// This can be used to filter out potential return addresses when
// the stack walker resorts to stack scanning.
// Returns true if any of:
// * This address is within a loaded module, but we don't have symbols
// for that module.
// * This address is within a loaded module for which we have symbols,
// and falls inside a function in that module.
// Returns false otherwise.
bool InstructionAddressSeemsValid(uint64_t address) const;
// Checks whether we should stop the stack trace.
// (either we reached the end-of-stack or we detected a
// broken callstack invariant)
bool TerminateWalk(uint64_t caller_ip,
uint64_t caller_sp,
uint64_t callee_sp,
bool first_unwind) const;
// The default number of words to search through on the stack
// for a return address.
static const int kRASearchWords;
template<typename InstructionType>
bool ScanForReturnAddress(InstructionType location_start,
InstructionType* location_found,
InstructionType* ip_found,
bool is_context_frame) {
// When searching for the caller of the context frame,
// allow the scanner to look farther down the stack.
const int search_words = is_context_frame ?
kRASearchWords * 4 :
kRASearchWords;
return ScanForReturnAddress(location_start, location_found, ip_found,
search_words);
}
// Scan the stack starting at location_start, looking for an address
// that looks like a valid instruction pointer. Addresses must
// 1) be contained in the current stack memory
// 2) pass the checks in InstructionAddressSeemsValid
//
// Returns true if a valid-looking instruction pointer was found.
// When returning true, sets location_found to the address at which
// the value was found, and ip_found to the value contained at that
// location in memory.
template<typename InstructionType>
bool ScanForReturnAddress(InstructionType location_start,
InstructionType* location_found,
InstructionType* ip_found,
int searchwords) {
for (InstructionType location = location_start;
location <= location_start + searchwords * sizeof(InstructionType);
location += sizeof(InstructionType)) {
InstructionType ip;
if (!memory_->GetMemoryAtAddress(location, &ip))
break;
// The return address points to the instruction after a call. If the
// caller was a no return function, this might point past the end of the
// function. Subtract one from the instruction pointer so it points into
// the call instruction instead.
if (modules_ && modules_->GetModuleForAddress(ip - 1) &&
InstructionAddressSeemsValid(ip - 1)) {
*ip_found = ip;
*location_found = location;
return true;
}
}
// nothing found
return false;
}
// Information about the system that produced the minidump. Subclasses
// and the SymbolSupplier may find this information useful.
const SystemInfo* system_info_;
// The stack memory to walk. Subclasses will require this region to
// get information from the stack.
MemoryRegion* memory_;
// A list of modules, for populating each StackFrame's module information.
// This field is optional and may be NULL.
const CodeModules* modules_;
// A list of unloaded modules, for populating frames which aren't matched
// to any loaded modules.
// This field is optional and may be NULL.
const CodeModules* unloaded_modules_;
protected:
// The StackFrameSymbolizer implementation.
StackFrameSymbolizer* frame_symbolizer_;
private:
// Obtains the context frame, the innermost called procedure in a stack
// trace. Returns NULL on failure. GetContextFrame allocates a new
// StackFrame (or StackFrame subclass), ownership of which is taken by
// the caller.
virtual StackFrame* GetContextFrame() = 0;
// Obtains a caller frame. Each call to GetCallerFrame should return the
// frame that called the last frame returned by GetContextFrame or
// GetCallerFrame. To aid this purpose, stack contains the CallStack
// made of frames that have already been walked. GetCallerFrame should
// return NULL on failure or when there are no more caller frames (when
// the end of the stack has been reached). GetCallerFrame allocates a new
// StackFrame (or StackFrame subclass), ownership of which is taken by
// the caller. |stack_scan_allowed| controls whether stack scanning is
// an allowable frame-recovery method, since it is desirable to be able to
// disable stack scanning in performance-critical use cases.
//
// CONSIDER: a way to differentiate between:
// - full stack traces
// - explicitly truncated traces (max_frames_)
// - stopping after max scanned frames
// - failed stack walk (breaking one of the stack walk invariants)
//
virtual StackFrame* GetCallerFrame(const CallStack* stack,
bool stack_scan_allowed) = 0;
// The maximum number of frames Stackwalker will walk through.
// This defaults to 1024 to prevent infinite loops.
static uint32_t max_frames_;
// Keep track of whether max_frames_ has been set by the user, since
// it affects whether or not an error message is printed in the case
// where an unwind got stopped by the limit.
static bool max_frames_set_;
// The maximum number of stack-scanned and otherwise untrustworthy
// frames allowed. Stack-scanning can be expensive, so the option to
// disable or limit it is helpful in cases where unwind performance is
// important. This defaults to 1024, the same as max_frames_.
static uint32_t max_frames_scanned_;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_STACKWALKER_H__

View file

@ -0,0 +1,98 @@
// Copyright 2006 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// The caller may implement the SymbolSupplier abstract base class
// to provide symbols for a given module.
#ifndef GOOGLE_BREAKPAD_PROCESSOR_SYMBOL_SUPPLIER_H__
#define GOOGLE_BREAKPAD_PROCESSOR_SYMBOL_SUPPLIER_H__
#include <string>
#include "common/using_std_string.h"
namespace google_breakpad {
class CodeModule;
struct SystemInfo;
class SymbolSupplier {
public:
// Result type for GetSymbolFile
enum SymbolResult {
// no symbols were found, but continue processing
NOT_FOUND,
// symbols were found, and the path has been placed in symbol_file
FOUND,
// stops processing the minidump immediately
INTERRUPT
};
virtual ~SymbolSupplier() {}
// Retrieves the symbol file for the given CodeModule, placing the
// path in symbol_file if successful. system_info contains strings
// identifying the operating system and CPU; SymbolSupplier may use
// to help locate the symbol file. system_info may be NULL or its
// fields may be empty if these values are unknown. symbol_file
// must be a pointer to a valid string
virtual SymbolResult GetSymbolFile(const CodeModule* module,
const SystemInfo* system_info,
string* symbol_file) = 0;
// Same as above, except also places symbol data into symbol_data.
// If symbol_data is NULL, the data is not returned.
// TODO(nealsid) Once we have symbol data caching behavior implemented
// investigate making all symbol suppliers implement all methods,
// and make this pure virtual
virtual SymbolResult GetSymbolFile(const CodeModule* module,
const SystemInfo* system_info,
string* symbol_file,
string* symbol_data) = 0;
// Same as above, except allocates data buffer on heap and then places the
// symbol data into the buffer as C-string.
// SymbolSupplier is responsible for deleting the data buffer. After the call
// to GetCStringSymbolData(), the caller should call FreeSymbolData(const
// Module* module) once the data buffer is no longer needed.
// If symbol_data is not NULL, symbol supplier won't return FOUND unless it
// returns a valid buffer in symbol_data, e.g., returns INTERRUPT on memory
// allocation failure.
virtual SymbolResult GetCStringSymbolData(const CodeModule* module,
const SystemInfo* system_info,
string* symbol_file,
char** symbol_data,
size_t* symbol_data_size) = 0;
// Frees the data buffer allocated for the module in GetCStringSymbolData.
virtual void FreeSymbolData(const CodeModule* module) = 0;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_SYMBOL_SUPPLIER_H__

View file

@ -0,0 +1,105 @@
// Copyright 2006 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// system_info.h: Information about the system that was running a program
// when a crash report was produced.
//
// Author: Mark Mentovai
#ifndef GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__
#define GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__
#include <string>
#include "common/using_std_string.h"
namespace google_breakpad {
struct SystemInfo {
public:
SystemInfo() : os(), os_short(), os_version(), cpu(), cpu_info(),
cpu_count(0), gl_version(), gl_vendor(), gl_renderer() {}
// Resets the SystemInfo object to its default values.
void Clear() {
os.clear();
os_short.clear();
os_version.clear();
cpu.clear();
cpu_info.clear();
cpu_count = 0;
gl_version.clear();
gl_vendor.clear();
gl_renderer.clear();
}
// A string identifying the operating system, such as "Windows NT",
// "Mac OS X", or "Linux". If the information is present in the dump but
// its value is unknown, this field will contain a numeric value. If
// the information is not present in the dump, this field will be empty.
string os;
// A short form of the os string, using lowercase letters and no spaces,
// suitable for use in a filesystem. Possible values include "windows",
// "mac", "linux" and "nacl". Empty if the information is not present
// in the dump or if the OS given by the dump is unknown. The values
// stored in this field should match those used by
// MinidumpSystemInfo::GetOS.
string os_short;
// A string identifying the version of the operating system, such as
// "5.1.2600 Service Pack 2" or "10.4.8 8L2127". If the dump does not
// contain this information, this field will be empty.
string os_version;
// A string identifying the basic CPU family, such as "x86" or "ppc".
// If this information is present in the dump but its value is unknown,
// this field will contain a numeric value. If the information is not
// present in the dump, this field will be empty. The values stored in
// this field should match those used by MinidumpSystemInfo::GetCPU.
string cpu;
// A string further identifying the specific CPU, such as
// "GenuineIntel level 6 model 13 stepping 8". If the information is not
// present in the dump, or additional identifying information is not
// defined for the CPU family, this field will be empty.
string cpu_info;
// The number of processors in the system. Will be greater than one for
// multi-core systems.
int cpu_count;
// The GPU information. Currently only populated in microdumps.
string gl_version;
string gl_vendor;
string gl_renderer;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__