1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-28 16:20:01 +02:00

* Added breakpad support for Linux.

This commit is contained in:
Christian Muehlhaeuser
2011-09-15 07:27:31 +02:00
parent d8b07cee9c
commit d8d7347394
1163 changed files with 465521 additions and 4 deletions

View File

@@ -0,0 +1,83 @@
/* Copyright (c) 2006, Google Inc.
* All rights reserved.
*
* 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 Inc. 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 u_intN_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__
#ifndef _WIN32
#include <sys/types.h>
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif /* __STDC_FORMAT_MACROS */
#include <inttypes.h>
#if defined(__SUNPRO_CC) || (defined(__GNUC__) && defined(__sun__))
typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
#endif
#else /* !_WIN32 */
#include <WTypes.h>
typedef unsigned __int8 u_int8_t;
typedef unsigned __int16 u_int16_t;
typedef unsigned __int32 u_int32_t;
typedef unsigned __int64 u_int64_t;
#endif /* !_WIN32 */
typedef struct {
u_int64_t high;
u_int64_t low;
} u_int128_t;
typedef u_int64_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,235 @@
/* Copyright (c) 2006, Google Inc.
* All rights reserved.
*
* 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 Inc. 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 {
u_int16_t control_word;
u_int16_t status_word;
u_int8_t tag_word;
u_int8_t reserved1;
u_int16_t error_opcode;
u_int32_t error_offset;
u_int16_t error_selector;
u_int16_t reserved2;
u_int32_t data_offset;
u_int16_t data_selector;
u_int16_t reserved3;
u_int32_t mx_csr;
u_int32_t mx_csr_mask;
u_int128_t float_registers[8];
u_int128_t xmm_registers[16];
u_int8_t reserved4[96];
} MDXmmSaveArea32AMD64; /* XMM_SAVE_AREA32 */
#define MD_CONTEXT_AMD64_VR_COUNT 26
typedef struct {
/*
* Register parameter home addresses.
*/
u_int64_t p1_home;
u_int64_t p2_home;
u_int64_t p3_home;
u_int64_t p4_home;
u_int64_t p5_home;
u_int64_t p6_home;
/* The next field determines the layout of the structure, and which parts
* of it are populated */
u_int32_t context_flags;
u_int32_t mx_csr;
/* The next register is included with MD_CONTEXT_AMD64_CONTROL */
u_int16_t cs;
/* The next 4 registers are included with MD_CONTEXT_AMD64_SEGMENTS */
u_int16_t ds;
u_int16_t es;
u_int16_t fs;
u_int16_t gs;
/* The next 2 registers are included with MD_CONTEXT_AMD64_CONTROL */
u_int16_t ss;
u_int32_t eflags;
/* The next 6 registers are included with MD_CONTEXT_AMD64_DEBUG_REGISTERS */
u_int64_t dr0;
u_int64_t dr1;
u_int64_t dr2;
u_int64_t dr3;
u_int64_t dr6;
u_int64_t dr7;
/* The next 4 registers are included with MD_CONTEXT_AMD64_INTEGER */
u_int64_t rax;
u_int64_t rcx;
u_int64_t rdx;
u_int64_t rbx;
/* The next register is included with MD_CONTEXT_AMD64_CONTROL */
u_int64_t rsp;
/* The next 11 registers are included with MD_CONTEXT_AMD64_INTEGER */
u_int64_t rbp;
u_int64_t rsi;
u_int64_t rdi;
u_int64_t r8;
u_int64_t r9;
u_int64_t r10;
u_int64_t r11;
u_int64_t r12;
u_int64_t r13;
u_int64_t r14;
u_int64_t r15;
/* The next register is included with MD_CONTEXT_AMD64_CONTROL */
u_int64_t rip;
/* The next set of registers are included with
* MD_CONTEXT_AMD64_FLOATING_POINT
*/
union {
MDXmmSaveArea32AMD64 flt_save;
struct {
u_int128_t header[2];
u_int128_t legacy[8];
u_int128_t xmm0;
u_int128_t xmm1;
u_int128_t xmm2;
u_int128_t xmm3;
u_int128_t xmm4;
u_int128_t xmm5;
u_int128_t xmm6;
u_int128_t xmm7;
u_int128_t xmm8;
u_int128_t xmm9;
u_int128_t xmm10;
u_int128_t xmm11;
u_int128_t xmm12;
u_int128_t xmm13;
u_int128_t xmm14;
u_int128_t xmm15;
} sse_registers;
};
u_int128_t vector_register[MD_CONTEXT_AMD64_VR_COUNT];
u_int64_t vector_control;
/* The next 5 registers are included with MD_CONTEXT_AMD64_DEBUG_REGISTERS */
u_int64_t debug_control;
u_int64_t last_branch_to_rip;
u_int64_t last_branch_from_rip;
u_int64_t last_exception_to_rip;
u_int64_t last_exception_from_rip;
} MDRawContextAMD64; /* CONTEXT */
/* For (MDRawContextAMD64).context_flags. These values indicate the type of
* context stored in the structure. The high 24 bits identify the CPU, the
* low 8 bits identify the type of context saved. */
#define MD_CONTEXT_AMD64 0x00100000 /* CONTEXT_AMD64 */
#define MD_CONTEXT_AMD64_CONTROL (MD_CONTEXT_AMD64 | 0x00000001)
/* CONTEXT_CONTROL */
#define MD_CONTEXT_AMD64_INTEGER (MD_CONTEXT_AMD64 | 0x00000002)
/* CONTEXT_INTEGER */
#define MD_CONTEXT_AMD64_SEGMENTS (MD_CONTEXT_AMD64 | 0x00000004)
/* CONTEXT_SEGMENTS */
#define MD_CONTEXT_AMD64_FLOATING_POINT (MD_CONTEXT_AMD64 | 0x00000008)
/* CONTEXT_FLOATING_POINT */
#define MD_CONTEXT_AMD64_DEBUG_REGISTERS (MD_CONTEXT_AMD64 | 0x00000010)
/* CONTEXT_DEBUG_REGISTERS */
#define MD_CONTEXT_AMD64_XSTATE (MD_CONTEXT_AMD64 | 0x00000040)
/* CONTEXT_XSTATE */
/* WinNT.h refers to CONTEXT_MMX_REGISTERS but doesn't appear to define it
* I think it really means CONTEXT_FLOATING_POINT.
*/
#define MD_CONTEXT_AMD64_FULL (MD_CONTEXT_AMD64_CONTROL | \
MD_CONTEXT_AMD64_INTEGER | \
MD_CONTEXT_AMD64_FLOATING_POINT)
/* CONTEXT_FULL */
#define MD_CONTEXT_AMD64_ALL (MD_CONTEXT_AMD64_FULL | \
MD_CONTEXT_AMD64_SEGMENTS | \
MD_CONTEXT_X86_DEBUG_REGISTERS)
/* CONTEXT_ALL */
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_AMD64_H__ */

View File

@@ -0,0 +1,150 @@
/* Copyright (c) 2009, Google Inc.
* All rights reserved.
*
* 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 Inc. 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 {
u_int64_t fpscr; /* FPU status register */
/* 32 64-bit floating point registers, d0 .. d31. */
u_int64_t regs[MD_FLOATINGSAVEAREA_ARM_FPR_COUNT];
/* Miscellaneous control words */
u_int32_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
*/
u_int32_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
*/
u_int32_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 */
u_int32_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_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,163 @@
/* Copyright (c) 2006, Google Inc.
* All rights reserved.
*
* 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 Inc. 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 u_int64_t is used
* here for precise sizing. */
u_int64_t fpregs[MD_FLOATINGSAVEAREA_PPC_FPR_COUNT];
u_int32_t fpscr_pad;
u_int32_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. */
u_int128_t save_vr[MD_VECTORSAVEAREA_PPC_VR_COUNT];
u_int128_t save_vscr; /* Status/control */
u_int32_t save_pad5[4];
u_int32_t save_vrvalid; /* Identifies which vector registers are saved */
u_int32_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. */
u_int32_t context_flags;
u_int32_t srr0; /* Machine status save/restore: stores pc
* (instruction) */
u_int32_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. */
u_int32_t gpr[MD_CONTEXT_PPC_GPR_COUNT];
u_int32_t cr; /* Condition */
u_int32_t xer; /* Integer (fiXed-point) exception */
u_int32_t lr; /* Link */
u_int32_t ctr; /* Count */
u_int32_t mq; /* Multiply/Quotient (PPC 601, POWER only) */
u_int32_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 */
#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,129 @@
/* Copyright (c) 2008, Google Inc.
* All rights reserved.
*
* 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 Inc. 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. */
u_int64_t context_flags;
u_int64_t srr0; /* Machine status save/restore: stores pc
* (instruction) */
u_int64_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. */
u_int64_t gpr[MD_CONTEXT_PPC64_GPR_COUNT];
u_int64_t cr; /* Condition */
u_int64_t xer; /* Integer (fiXed-point) exception */
u_int64_t lr; /* Link */
u_int64_t ctr; /* Count */
u_int64_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 */
/* 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_PPC64_H__ */

View File

@@ -0,0 +1,158 @@
/* Copyright (c) 2006, Google Inc.
* All rights reserved.
*
* 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 Inc. 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 */
u_int64_t regs[MD_FLOATINGSAVEAREA_SPARC_FPR_COUNT];
u_int64_t filler;
u_int64_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
*/
u_int32_t context_flags;
u_int32_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)
*/
u_int64_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
*/
u_int64_t ccr;
u_int64_t pc; /* Program Counter register (PC) */
u_int64_t npc; /* Next Program Counter register (nPC) */
u_int64_t y; /* Y register (Y) */
/* Address Space Identifier register (ASI) for SPARC V9
* WIM for SPARC V7/V8
*/
u_int64_t asi;
/* Floating-Point Registers State register (FPRS) for SPARC V9
* TBR for for SPARC V7/V8
*/
u_int64_t fprs;
/* The next field is included with MD_CONTEXT_SPARC_FLOATING_POINT */
MDFloatingSaveAreaSPARC float_save;
} MDRawContextSPARC; /* CONTEXT_SPARC */
/* 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,174 @@
/* Copyright (c) 2006, Google Inc.
* All rights reserved.
*
* 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 Inc. 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 {
u_int32_t control_word;
u_int32_t status_word;
u_int32_t tag_word;
u_int32_t error_offset;
u_int32_t error_selector;
u_int32_t data_offset;
u_int32_t data_selector;
/* register_area contains eight 80-bit (x87 "long double") quantities for
* floating-point registers %st0 (%mm0) through %st7 (%mm7). */
u_int8_t register_area[MD_FLOATINGSAVEAREA_X86_REGISTERAREA_SIZE];
u_int32_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 */
u_int32_t context_flags;
/* The next 6 registers are included with MD_CONTEXT_X86_DEBUG_REGISTERS */
u_int32_t dr0;
u_int32_t dr1;
u_int32_t dr2;
u_int32_t dr3;
u_int32_t dr6;
u_int32_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 */
u_int32_t gs;
u_int32_t fs;
u_int32_t es;
u_int32_t ds;
/* The next 6 registers are included with MD_CONTEXT_X86_INTEGER */
u_int32_t edi;
u_int32_t esi;
u_int32_t ebx;
u_int32_t edx;
u_int32_t ecx;
u_int32_t eax;
/* The next 6 registers are included with MD_CONTEXT_X86_CONTROL */
u_int32_t ebp;
u_int32_t eip;
u_int32_t cs; /* WinNT.h says "must be sanitized" */
u_int32_t eflags; /* WinNT.h says "must be sanitized" */
u_int32_t esp;
u_int32_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." */
u_int8_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,85 @@
/* Copyright (c) 2006, Google Inc.
* All rights reserved.
*
* 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 Inc. 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 */
} MDExceptionCodeLinux;
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_LINUX_H__ */

View File

@@ -0,0 +1,193 @@
/* Copyright (c) 2006, Google Inc.
* All rights reserved.
*
* 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 Inc. 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_RPC_ALERT */
} 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 */
/* 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 */
/* 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,94 @@
/* Copyright (c) 2006, Google Inc.
* All rights reserved.
*
* 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 Inc. 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__ */

View File

@@ -0,0 +1,116 @@
/* Copyright (c) 2006, Google Inc.
* All rights reserved.
*
* 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 Inc. 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_win32.h: Definitions of exception codes for
* Win32 platform
*
* (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_WIN32_H__
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_WIN32_H__
#include <stddef.h>
#include "google_breakpad/common/breakpad_types.h"
/* For (MDException).exception_code. These values come from WinBase.h
* and WinNT.h (names beginning with EXCEPTION_ are in WinBase.h,
* they are STATUS_ in WinNT.h). */
typedef enum {
MD_EXCEPTION_CODE_WIN_CONTROL_C = 0x40010005,
/* DBG_CONTROL_C */
MD_EXCEPTION_CODE_WIN_GUARD_PAGE_VIOLATION = 0x80000001,
/* EXCEPTION_GUARD_PAGE */
MD_EXCEPTION_CODE_WIN_DATATYPE_MISALIGNMENT = 0x80000002,
/* EXCEPTION_DATATYPE_MISALIGNMENT */
MD_EXCEPTION_CODE_WIN_BREAKPOINT = 0x80000003,
/* EXCEPTION_BREAKPOINT */
MD_EXCEPTION_CODE_WIN_SINGLE_STEP = 0x80000004,
/* EXCEPTION_SINGLE_STEP */
MD_EXCEPTION_CODE_WIN_ACCESS_VIOLATION = 0xc0000005,
/* EXCEPTION_ACCESS_VIOLATION */
MD_EXCEPTION_CODE_WIN_IN_PAGE_ERROR = 0xc0000006,
/* EXCEPTION_IN_PAGE_ERROR */
MD_EXCEPTION_CODE_WIN_INVALID_HANDLE = 0xc0000008,
/* EXCEPTION_INVALID_HANDLE */
MD_EXCEPTION_CODE_WIN_ILLEGAL_INSTRUCTION = 0xc000001d,
/* EXCEPTION_ILLEGAL_INSTRUCTION */
MD_EXCEPTION_CODE_WIN_NONCONTINUABLE_EXCEPTION = 0xc0000025,
/* EXCEPTION_NONCONTINUABLE_EXCEPTION */
MD_EXCEPTION_CODE_WIN_INVALID_DISPOSITION = 0xc0000026,
/* EXCEPTION_INVALID_DISPOSITION */
MD_EXCEPTION_CODE_WIN_ARRAY_BOUNDS_EXCEEDED = 0xc000008c,
/* EXCEPTION_BOUNDS_EXCEEDED */
MD_EXCEPTION_CODE_WIN_FLOAT_DENORMAL_OPERAND = 0xc000008d,
/* EXCEPTION_FLT_DENORMAL_OPERAND */
MD_EXCEPTION_CODE_WIN_FLOAT_DIVIDE_BY_ZERO = 0xc000008e,
/* EXCEPTION_FLT_DIVIDE_BY_ZERO */
MD_EXCEPTION_CODE_WIN_FLOAT_INEXACT_RESULT = 0xc000008f,
/* EXCEPTION_FLT_INEXACT_RESULT */
MD_EXCEPTION_CODE_WIN_FLOAT_INVALID_OPERATION = 0xc0000090,
/* EXCEPTION_FLT_INVALID_OPERATION */
MD_EXCEPTION_CODE_WIN_FLOAT_OVERFLOW = 0xc0000091,
/* EXCEPTION_FLT_OVERFLOW */
MD_EXCEPTION_CODE_WIN_FLOAT_STACK_CHECK = 0xc0000092,
/* EXCEPTION_FLT_STACK_CHECK */
MD_EXCEPTION_CODE_WIN_FLOAT_UNDERFLOW = 0xc0000093,
/* EXCEPTION_FLT_UNDERFLOW */
MD_EXCEPTION_CODE_WIN_INTEGER_DIVIDE_BY_ZERO = 0xc0000094,
/* EXCEPTION_INT_DIVIDE_BY_ZERO */
MD_EXCEPTION_CODE_WIN_INTEGER_OVERFLOW = 0xc0000095,
/* EXCEPTION_INT_OVERFLOW */
MD_EXCEPTION_CODE_WIN_PRIVILEGED_INSTRUCTION = 0xc0000096,
/* EXCEPTION_PRIV_INSTRUCTION */
MD_EXCEPTION_CODE_WIN_STACK_OVERFLOW = 0xc00000fd,
/* EXCEPTION_STACK_OVERFLOW */
MD_EXCEPTION_CODE_WIN_POSSIBLE_DEADLOCK = 0xc0000194,
/* EXCEPTION_POSSIBLE_DEADLOCK */
MD_EXCEPTION_CODE_WIN_STACK_BUFFER_OVERRUN = 0xc0000409,
/* STATUS_STACK_BUFFER_OVERRUN */
MD_EXCEPTION_CODE_WIN_HEAP_CORRUPTION = 0xc0000374,
/* STATUS_HEAP_CORRUPTION */
MD_EXCEPTION_CODE_WIN_UNHANDLED_CPP_EXCEPTION = 0xe06d7363
/* Per http://support.microsoft.com/kb/185294,
generated by Visual C++ compiler */
} MDExceptionCodeWin;
// These constants are defined in the MSDN documentation of
// the EXCEPTION_RECORD structure.
typedef enum {
MD_ACCESS_VIOLATION_WIN_READ = 0,
MD_ACCESS_VIOLATION_WIN_WRITE = 1,
MD_ACCESS_VIOLATION_WIN_EXEC = 8
} MDAccessViolationTypeWin;
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_WIN32_H__ */

View File

@@ -0,0 +1,793 @@
/* Copyright (c) 2006, Google Inc.
* All rights reserved.
*
* 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 Inc. 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++.)
*
* 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_FORMAT_H__
#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_FORMAT_H__
#include <stddef.h>
#include "google_breakpad/common/breakpad_types.h"
#if defined(_MSC_VER)
/* Disable "zero-sized array in struct/union" warnings when compiling in
* MSVC. DbgHelp.h does this too. */
#pragma warning(push)
#pragma warning(disable:4200)
#endif /* _MSC_VER */
/*
* guiddef.h
*/
typedef struct {
u_int32_t data1;
u_int16_t data2;
u_int16_t data3;
u_int8_t data4[8];
} MDGUID; /* GUID */
/*
* WinNT.h
*/
/* Non-x86 CPU identifiers found in the high 24 bits of
* (MDRawContext*).context_flags. These aren't used by Breakpad, but are
* defined here for reference, to avoid assigning values that conflict
* (although some values already conflict). */
#define MD_CONTEXT_IA64 0x00080000 /* CONTEXT_IA64 */
/* Additional values from winnt.h in the Windows CE 5.0 SDK: */
#define MD_CONTEXT_SHX 0x000000c0 /* CONTEXT_SH4 (Super-H, includes SH3) */
#define MD_CONTEXT_MIPS 0x00010000 /* CONTEXT_R4000 (same value as x86?) */
#define MD_CONTEXT_ALPHA 0x00020000 /* CONTEXT_ALPHA */
/* As of Windows 7 SP1, the number of flag bits has increased to
* include 0x40 (CONTEXT_XSTATE):
* http://msdn.microsoft.com/en-us/library/hh134238%28v=vs.85%29.aspx */
#define MD_CONTEXT_CPU_MASK 0xffffff00
/* This is a base type for MDRawContextX86 and MDRawContextPPC. This
* structure should never be allocated directly. The actual structure type
* can be determined by examining the context_flags field. */
typedef struct {
u_int32_t context_flags;
} MDRawContextBase;
#include "minidump_cpu_amd64.h"
#include "minidump_cpu_arm.h"
#include "minidump_cpu_ppc.h"
#include "minidump_cpu_ppc64.h"
#include "minidump_cpu_sparc.h"
#include "minidump_cpu_x86.h"
/*
* WinVer.h
*/
typedef struct {
u_int32_t signature;
u_int32_t struct_version;
u_int32_t file_version_hi;
u_int32_t file_version_lo;
u_int32_t product_version_hi;
u_int32_t product_version_lo;
u_int32_t file_flags_mask; /* Identifies valid bits in fileFlags */
u_int32_t file_flags;
u_int32_t file_os;
u_int32_t file_type;
u_int32_t file_subtype;
u_int32_t file_date_hi;
u_int32_t file_date_lo;
} MDVSFixedFileInfo; /* VS_FIXEDFILEINFO */
/* For (MDVSFixedFileInfo).signature */
#define MD_VSFIXEDFILEINFO_SIGNATURE 0xfeef04bd
/* VS_FFI_SIGNATURE */
/* For (MDVSFixedFileInfo).version */
#define MD_VSFIXEDFILEINFO_VERSION 0x00010000
/* VS_FFI_STRUCVERSION */
/* For (MDVSFixedFileInfo).file_flags_mask and
* (MDVSFixedFileInfo).file_flags */
#define MD_VSFIXEDFILEINFO_FILE_FLAGS_DEBUG 0x00000001
/* VS_FF_DEBUG */
#define MD_VSFIXEDFILEINFO_FILE_FLAGS_PRERELEASE 0x00000002
/* VS_FF_PRERELEASE */
#define MD_VSFIXEDFILEINFO_FILE_FLAGS_PATCHED 0x00000004
/* VS_FF_PATCHED */
#define MD_VSFIXEDFILEINFO_FILE_FLAGS_PRIVATEBUILD 0x00000008
/* VS_FF_PRIVATEBUILD */
#define MD_VSFIXEDFILEINFO_FILE_FLAGS_INFOINFERRED 0x00000010
/* VS_FF_INFOINFERRED */
#define MD_VSFIXEDFILEINFO_FILE_FLAGS_SPECIALBUILD 0x00000020
/* VS_FF_SPECIALBUILD */
/* For (MDVSFixedFileInfo).file_os: high 16 bits */
#define MD_VSFIXEDFILEINFO_FILE_OS_UNKNOWN 0 /* VOS_UNKNOWN */
#define MD_VSFIXEDFILEINFO_FILE_OS_DOS (1 << 16) /* VOS_DOS */
#define MD_VSFIXEDFILEINFO_FILE_OS_OS216 (2 << 16) /* VOS_OS216 */
#define MD_VSFIXEDFILEINFO_FILE_OS_OS232 (3 << 16) /* VOS_OS232 */
#define MD_VSFIXEDFILEINFO_FILE_OS_NT (4 << 16) /* VOS_NT */
#define MD_VSFIXEDFILEINFO_FILE_OS_WINCE (5 << 16) /* VOS_WINCE */
/* Low 16 bits */
#define MD_VSFIXEDFILEINFO_FILE_OS__BASE 0 /* VOS__BASE */
#define MD_VSFIXEDFILEINFO_FILE_OS__WINDOWS16 1 /* VOS__WINDOWS16 */
#define MD_VSFIXEDFILEINFO_FILE_OS__PM16 2 /* VOS__PM16 */
#define MD_VSFIXEDFILEINFO_FILE_OS__PM32 3 /* VOS__PM32 */
#define MD_VSFIXEDFILEINFO_FILE_OS__WINDOWS32 4 /* VOS__WINDOWS32 */
/* For (MDVSFixedFileInfo).file_type */
#define MD_VSFIXEDFILEINFO_FILE_TYPE_UNKNOWN 0 /* VFT_UNKNOWN */
#define MD_VSFIXEDFILEINFO_FILE_TYPE_APP 1 /* VFT_APP */
#define MD_VSFIXEDFILEINFO_FILE_TYPE_DLL 2 /* VFT_DLL */
#define MD_VSFIXEDFILEINFO_FILE_TYPE_DRV 3 /* VFT_DLL */
#define MD_VSFIXEDFILEINFO_FILE_TYPE_FONT 4 /* VFT_FONT */
#define MD_VSFIXEDFILEINFO_FILE_TYPE_VXD 5 /* VFT_VXD */
#define MD_VSFIXEDFILEINFO_FILE_TYPE_STATIC_LIB 7 /* VFT_STATIC_LIB */
/* For (MDVSFixedFileInfo).file_subtype */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_UNKNOWN 0
/* VFT2_UNKNOWN */
/* with file_type = MD_VSFIXEDFILEINFO_FILETYPE_DRV */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_PRINTER 1
/* VFT2_DRV_PRINTER */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_KEYBOARD 2
/* VFT2_DRV_KEYBOARD */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_LANGUAGE 3
/* VFT2_DRV_LANGUAGE */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_DISPLAY 4
/* VFT2_DRV_DISPLAY */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_MOUSE 5
/* VFT2_DRV_MOUSE */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_NETWORK 6
/* VFT2_DRV_NETWORK */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_SYSTEM 7
/* VFT2_DRV_SYSTEM */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_INSTALLABLE 8
/* VFT2_DRV_INSTALLABLE */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_SOUND 9
/* VFT2_DRV_SOUND */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_COMM 10
/* VFT2_DRV_COMM */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_INPUTMETHOD 11
/* VFT2_DRV_INPUTMETHOD */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_DRV_VERSIONED_PRINTER 12
/* VFT2_DRV_VERSIONED_PRINTER */
/* with file_type = MD_VSFIXEDFILEINFO_FILETYPE_FONT */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_FONT_RASTER 1
/* VFT2_FONT_RASTER */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_FONT_VECTOR 2
/* VFT2_FONT_VECTOR */
#define MD_VSFIXEDFILEINFO_FILE_SUBTYPE_FONT_TRUETYPE 3
/* VFT2_FONT_TRUETYPE */
/*
* DbgHelp.h
*/
/* An MDRVA is an offset into the minidump file. The beginning of the
* MDRawHeader is at offset 0. */
typedef u_int32_t MDRVA; /* RVA */
typedef struct {
u_int32_t data_size;
MDRVA rva;
} MDLocationDescriptor; /* MINIDUMP_LOCATION_DESCRIPTOR */
typedef struct {
/* The base address of the memory range on the host that produced the
* minidump. */
u_int64_t start_of_memory_range;
MDLocationDescriptor memory;
} MDMemoryDescriptor; /* MINIDUMP_MEMORY_DESCRIPTOR */
typedef struct {
u_int32_t signature;
u_int32_t version;
u_int32_t stream_count;
MDRVA stream_directory_rva; /* A |stream_count|-sized array of
* MDRawDirectory structures. */
u_int32_t checksum; /* Can be 0. In fact, that's all that's
* been found in minidump files. */
u_int32_t time_date_stamp; /* time_t */
u_int64_t flags;
} MDRawHeader; /* MINIDUMP_HEADER */
/* For (MDRawHeader).signature and (MDRawHeader).version. Note that only the
* low 16 bits of (MDRawHeader).version are MD_HEADER_VERSION. Per the
* documentation, the high 16 bits are implementation-specific. */
#define MD_HEADER_SIGNATURE 0x504d444d /* 'PMDM' */
/* MINIDUMP_SIGNATURE */
#define MD_HEADER_VERSION 0x0000a793 /* 42899 */
/* MINIDUMP_VERSION */
/* For (MDRawHeader).flags: */
typedef enum {
/* MD_NORMAL is the standard type of minidump. It includes full
* streams for the thread list, module list, exception, system info,
* and miscellaneous info. A memory list stream is also present,
* pointing to the same stack memory contained in the thread list,
* as well as a 256-byte region around the instruction address that
* was executing when the exception occurred. Stack memory is from
* 4 bytes below a thread's stack pointer up to the top of the
* memory region encompassing the stack. */
MD_NORMAL = 0x00000000,
MD_WITH_DATA_SEGS = 0x00000001,
MD_WITH_FULL_MEMORY = 0x00000002,
MD_WITH_HANDLE_DATA = 0x00000004,
MD_FILTER_MEMORY = 0x00000008,
MD_SCAN_MEMORY = 0x00000010,
MD_WITH_UNLOADED_MODULES = 0x00000020,
MD_WITH_INDIRECTLY_REFERENCED_MEMORY = 0x00000040,
MD_FILTER_MODULE_PATHS = 0x00000080,
MD_WITH_PROCESS_THREAD_DATA = 0x00000100,
MD_WITH_PRIVATE_READ_WRITE_MEMORY = 0x00000200,
MD_WITHOUT_OPTIONAL_DATA = 0x00000400,
MD_WITH_FULL_MEMORY_INFO = 0x00000800,
MD_WITH_THREAD_INFO = 0x00001000,
MD_WITH_CODE_SEGS = 0x00002000,
MD_WITHOUT_AUXILLIARY_SEGS = 0x00004000,
MD_WITH_FULL_AUXILLIARY_STATE = 0x00008000,
MD_WITH_PRIVATE_WRITE_COPY_MEMORY = 0x00010000,
MD_IGNORE_INACCESSIBLE_MEMORY = 0x00020000,
MD_WITH_TOKEN_INFORMATION = 0x00040000
} MDType; /* MINIDUMP_TYPE */
typedef struct {
u_int32_t stream_type;
MDLocationDescriptor location;
} MDRawDirectory; /* MINIDUMP_DIRECTORY */
/* For (MDRawDirectory).stream_type */
typedef enum {
MD_UNUSED_STREAM = 0,
MD_RESERVED_STREAM_0 = 1,
MD_RESERVED_STREAM_1 = 2,
MD_THREAD_LIST_STREAM = 3, /* MDRawThreadList */
MD_MODULE_LIST_STREAM = 4, /* MDRawModuleList */
MD_MEMORY_LIST_STREAM = 5, /* MDRawMemoryList */
MD_EXCEPTION_STREAM = 6, /* MDRawExceptionStream */
MD_SYSTEM_INFO_STREAM = 7, /* MDRawSystemInfo */
MD_THREAD_EX_LIST_STREAM = 8,
MD_MEMORY_64_LIST_STREAM = 9,
MD_COMMENT_STREAM_A = 10,
MD_COMMENT_STREAM_W = 11,
MD_HANDLE_DATA_STREAM = 12,
MD_FUNCTION_TABLE_STREAM = 13,
MD_UNLOADED_MODULE_LIST_STREAM = 14,
MD_MISC_INFO_STREAM = 15, /* MDRawMiscInfo */
MD_MEMORY_INFO_LIST_STREAM = 16, /* MDRawMemoryInfoList */
MD_THREAD_INFO_LIST_STREAM = 17,
MD_HANDLE_OPERATION_LIST_STREAM = 18,
MD_LAST_RESERVED_STREAM = 0x0000ffff,
/* Breakpad extension types. 0x4767 = "Gg" */
MD_BREAKPAD_INFO_STREAM = 0x47670001, /* MDRawBreakpadInfo */
MD_ASSERTION_INFO_STREAM = 0x47670002 /* MDRawAssertionInfo */
} MDStreamType; /* MINIDUMP_STREAM_TYPE */
typedef struct {
u_int32_t length; /* Length of buffer in bytes (not characters),
* excluding 0-terminator */
u_int16_t buffer[1]; /* UTF-16-encoded, 0-terminated */
} MDString; /* MINIDUMP_STRING */
static const size_t MDString_minsize = offsetof(MDString, buffer[0]);
typedef struct {
u_int32_t thread_id;
u_int32_t suspend_count;
u_int32_t priority_class;
u_int32_t priority;
u_int64_t teb; /* Thread environment block */
MDMemoryDescriptor stack;
MDLocationDescriptor thread_context; /* MDRawContext[CPU] */
} MDRawThread; /* MINIDUMP_THREAD */
typedef struct {
u_int32_t number_of_threads;
MDRawThread threads[1];
} MDRawThreadList; /* MINIDUMP_THREAD_LIST */
static const size_t MDRawThreadList_minsize = offsetof(MDRawThreadList,
threads[0]);
typedef struct {
u_int64_t base_of_image;
u_int32_t size_of_image;
u_int32_t checksum; /* 0 if unknown */
u_int32_t time_date_stamp; /* time_t */
MDRVA module_name_rva; /* MDString, pathname or filename */
MDVSFixedFileInfo version_info;
/* The next field stores a CodeView record and is populated when a module's
* debug information resides in a PDB file. It identifies the PDB file. */
MDLocationDescriptor cv_record;
/* The next field is populated when a module's debug information resides
* in a DBG file. It identifies the DBG file. This field is effectively
* obsolete with modules built by recent toolchains. */
MDLocationDescriptor misc_record;
/* Alignment problem: reserved0 and reserved1 are defined by the platform
* SDK as 64-bit quantities. However, that results in a structure whose
* alignment is unpredictable on different CPUs and ABIs. If the ABI
* specifies full alignment of 64-bit quantities in structures (as ppc
* does), there will be padding between miscRecord and reserved0. If
* 64-bit quantities can be aligned on 32-bit boundaries (as on x86),
* this padding will not exist. (Note that the structure up to this point
* contains 1 64-bit member followed by 21 32-bit members.)
* As a workaround, reserved0 and reserved1 are instead defined here as
* four 32-bit quantities. This should be harmless, as there are
* currently no known uses for these fields. */
u_int32_t reserved0[2];
u_int32_t reserved1[2];
} MDRawModule; /* MINIDUMP_MODULE */
/* The inclusion of a 64-bit type in MINIDUMP_MODULE forces the struct to
* be tail-padded out to a multiple of 64 bits under some ABIs (such as PPC).
* This doesn't occur on systems that don't tail-pad in this manner. Define
* this macro to be the usable size of the MDRawModule struct, and use it in
* place of sizeof(MDRawModule). */
#define MD_MODULE_SIZE 108
/* (MDRawModule).cv_record can reference MDCVInfoPDB20 or MDCVInfoPDB70.
* Ref.: http://www.debuginfo.com/articles/debuginfomatch.html
* MDCVInfoPDB70 is the expected structure type with recent toolchains. */
typedef struct {
u_int32_t signature;
u_int32_t offset; /* Offset to debug data (expect 0 in minidump) */
} MDCVHeader;
typedef struct {
MDCVHeader cv_header;
u_int32_t signature; /* time_t debug information created */
u_int32_t age; /* revision of PDB file */
u_int8_t pdb_file_name[1]; /* Pathname or filename of PDB file */
} MDCVInfoPDB20;
static const size_t MDCVInfoPDB20_minsize = offsetof(MDCVInfoPDB20,
pdb_file_name[0]);
#define MD_CVINFOPDB20_SIGNATURE 0x3031424e /* cvHeader.signature = '01BN' */
typedef struct {
u_int32_t cv_signature;
MDGUID signature; /* GUID, identifies PDB file */
u_int32_t age; /* Identifies incremental changes to PDB file */
u_int8_t pdb_file_name[1]; /* Pathname or filename of PDB file,
* 0-terminated 8-bit character data (UTF-8?) */
} MDCVInfoPDB70;
static const size_t MDCVInfoPDB70_minsize = offsetof(MDCVInfoPDB70,
pdb_file_name[0]);
#define MD_CVINFOPDB70_SIGNATURE 0x53445352 /* cvSignature = 'SDSR' */
typedef struct {
u_int32_t data1[2];
u_int32_t data2;
u_int32_t data3;
u_int32_t data4;
u_int32_t data5[3];
u_int8_t extra[2];
} MDCVInfoELF;
/* In addition to the two CodeView record formats above, used for linking
* to external pdb files, it is possible for debugging data to be carried
* directly in the CodeView record itself. These signature values will
* be found in the first 4 bytes of the CodeView record. Additional values
* not commonly experienced in the wild are given by "Microsoft Symbol and
* Type Information", http://www.x86.org/ftp/manuals/tools/sym.pdf, section
* 7.2. An in-depth description of the CodeView 4.1 format is given by
* "Undocumented Windows 2000 Secrets", Windows 2000 Debugging Support/
* Microsoft Symbol File Internals/CodeView Subsections,
* http://www.rawol.com/features/undocumented/sbs-w2k-1-windows-2000-debugging-support.pdf
*/
#define MD_CVINFOCV41_SIGNATURE 0x3930424e /* '90BN', CodeView 4.10. */
#define MD_CVINFOCV50_SIGNATURE 0x3131424e /* '11BN', CodeView 5.0,
* MS C7-format (/Z7). */
#define MD_CVINFOUNKNOWN_SIGNATURE 0xffffffff /* An unlikely value. */
/* (MDRawModule).miscRecord can reference MDImageDebugMisc. The Windows
* structure is actually defined in WinNT.h. This structure is effectively
* obsolete with modules built by recent toolchains. */
typedef struct {
u_int32_t data_type; /* IMAGE_DEBUG_TYPE_*, not defined here because
* this debug record type is mostly obsolete. */
u_int32_t length; /* Length of entire MDImageDebugMisc structure */
u_int8_t unicode; /* True if data is multibyte */
u_int8_t reserved[3];
u_int8_t data[1];
} MDImageDebugMisc; /* IMAGE_DEBUG_MISC */
static const size_t MDImageDebugMisc_minsize = offsetof(MDImageDebugMisc,
data[0]);
typedef struct {
u_int32_t number_of_modules;
MDRawModule modules[1];
} MDRawModuleList; /* MINIDUMP_MODULE_LIST */
static const size_t MDRawModuleList_minsize = offsetof(MDRawModuleList,
modules[0]);
typedef struct {
u_int32_t number_of_memory_ranges;
MDMemoryDescriptor memory_ranges[1];
} MDRawMemoryList; /* MINIDUMP_MEMORY_LIST */
static const size_t MDRawMemoryList_minsize = offsetof(MDRawMemoryList,
memory_ranges[0]);
#define MD_EXCEPTION_MAXIMUM_PARAMETERS 15
typedef struct {
u_int32_t exception_code; /* Windows: MDExceptionCodeWin,
* Mac OS X: MDExceptionMac,
* Linux: MDExceptionCodeLinux. */
u_int32_t exception_flags; /* Windows: 1 if noncontinuable,
Mac OS X: MDExceptionCodeMac. */
u_int64_t exception_record; /* Address (in the minidump-producing host's
* memory) of another MDException, for
* nested exceptions. */
u_int64_t exception_address; /* The address that caused the exception.
* Mac OS X: exception subcode (which is
* typically the address). */
u_int32_t number_parameters; /* Number of valid elements in
* exception_information. */
u_int32_t __align;
u_int64_t exception_information[MD_EXCEPTION_MAXIMUM_PARAMETERS];
} MDException; /* MINIDUMP_EXCEPTION */
#include "minidump_exception_win32.h"
#include "minidump_exception_mac.h"
#include "minidump_exception_linux.h"
#include "minidump_exception_solaris.h"
typedef struct {
u_int32_t thread_id; /* Thread in which the exception
* occurred. Corresponds to
* (MDRawThread).thread_id. */
u_int32_t __align;
MDException exception_record;
MDLocationDescriptor thread_context; /* MDRawContext[CPU] */
} MDRawExceptionStream; /* MINIDUMP_EXCEPTION_STREAM */
typedef union {
struct {
u_int32_t vendor_id[3]; /* cpuid 0: ebx, edx, ecx */
u_int32_t version_information; /* cpuid 1: eax */
u_int32_t feature_information; /* cpuid 1: edx */
u_int32_t amd_extended_cpu_features; /* cpuid 0x80000001, ebx */
} x86_cpu_info;
struct {
u_int64_t processor_features[2];
} other_cpu_info;
} MDCPUInformation; /* CPU_INFORMATION */
typedef struct {
/* The next 3 fields and numberOfProcessors are from the SYSTEM_INFO
* structure as returned by GetSystemInfo */
u_int16_t processor_architecture;
u_int16_t processor_level; /* x86: 5 = 586, 6 = 686, ... */
u_int16_t processor_revision; /* x86: 0xMMSS, where MM=model,
* SS=stepping */
u_int8_t number_of_processors;
u_int8_t product_type; /* Windows: VER_NT_* from WinNT.h */
/* The next 5 fields are from the OSVERSIONINFO structure as returned
* by GetVersionEx */
u_int32_t major_version;
u_int32_t minor_version;
u_int32_t build_number;
u_int32_t platform_id;
MDRVA csd_version_rva; /* MDString further identifying the
* host OS.
* Windows: name of the installed OS
* service pack.
* Mac OS X: the Apple OS build number
* (sw_vers -buildVersion).
* Linux: uname -srvmo */
u_int16_t suite_mask; /* Windows: VER_SUITE_* from WinNT.h */
u_int16_t reserved2;
MDCPUInformation cpu;
} MDRawSystemInfo; /* MINIDUMP_SYSTEM_INFO */
/* For (MDRawSystemInfo).processor_architecture: */
typedef enum {
MD_CPU_ARCHITECTURE_X86 = 0, /* PROCESSOR_ARCHITECTURE_INTEL */
MD_CPU_ARCHITECTURE_MIPS = 1, /* PROCESSOR_ARCHITECTURE_MIPS */
MD_CPU_ARCHITECTURE_ALPHA = 2, /* PROCESSOR_ARCHITECTURE_ALPHA */
MD_CPU_ARCHITECTURE_PPC = 3, /* PROCESSOR_ARCHITECTURE_PPC */
MD_CPU_ARCHITECTURE_SHX = 4, /* PROCESSOR_ARCHITECTURE_SHX
* (Super-H) */
MD_CPU_ARCHITECTURE_ARM = 5, /* PROCESSOR_ARCHITECTURE_ARM */
MD_CPU_ARCHITECTURE_IA64 = 6, /* PROCESSOR_ARCHITECTURE_IA64 */
MD_CPU_ARCHITECTURE_ALPHA64 = 7, /* PROCESSOR_ARCHITECTURE_ALPHA64 */
MD_CPU_ARCHITECTURE_MSIL = 8, /* PROCESSOR_ARCHITECTURE_MSIL
* (Microsoft Intermediate Language) */
MD_CPU_ARCHITECTURE_AMD64 = 9, /* PROCESSOR_ARCHITECTURE_AMD64 */
MD_CPU_ARCHITECTURE_X86_WIN64 = 10,
/* PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 (WoW64) */
MD_CPU_ARCHITECTURE_SPARC = 0x8001, /* Breakpad-defined value for SPARC */
MD_CPU_ARCHITECTURE_UNKNOWN = 0xffff /* PROCESSOR_ARCHITECTURE_UNKNOWN */
} MDCPUArchitecture;
/* For (MDRawSystemInfo).platform_id: */
typedef enum {
MD_OS_WIN32S = 0, /* VER_PLATFORM_WIN32s (Windows 3.1) */
MD_OS_WIN32_WINDOWS = 1, /* VER_PLATFORM_WIN32_WINDOWS (Windows 95-98-Me) */
MD_OS_WIN32_NT = 2, /* VER_PLATFORM_WIN32_NT (Windows NT, 2000+) */
MD_OS_WIN32_CE = 3, /* VER_PLATFORM_WIN32_CE, VER_PLATFORM_WIN32_HH
* (Windows CE, Windows Mobile, "Handheld") */
/* The following values are Breakpad-defined. */
MD_OS_UNIX = 0x8000, /* Generic Unix-ish */
MD_OS_MAC_OS_X = 0x8101, /* Mac OS X/Darwin */
MD_OS_LINUX = 0x8201, /* Linux */
MD_OS_SOLARIS = 0x8202 /* Solaris */
} MDOSPlatform;
typedef struct {
u_int32_t size_of_info; /* Length of entire MDRawMiscInfo structure. */
u_int32_t flags1;
/* The next field is only valid if flags1 contains
* MD_MISCINFO_FLAGS1_PROCESS_ID. */
u_int32_t process_id;
/* The next 3 fields are only valid if flags1 contains
* MD_MISCINFO_FLAGS1_PROCESS_TIMES. */
u_int32_t process_create_time; /* time_t process started */
u_int32_t process_user_time; /* seconds of user CPU time */
u_int32_t process_kernel_time; /* seconds of kernel CPU time */
/* The following fields are not present in MINIDUMP_MISC_INFO but are
* in MINIDUMP_MISC_INFO_2. When this struct is populated, these values
* may not be set. Use flags1 or sizeOfInfo to determine whether these
* values are present. These are only valid when flags1 contains
* MD_MISCINFO_FLAGS1_PROCESSOR_POWER_INFO. */
u_int32_t processor_max_mhz;
u_int32_t processor_current_mhz;
u_int32_t processor_mhz_limit;
u_int32_t processor_max_idle_state;
u_int32_t processor_current_idle_state;
} MDRawMiscInfo; /* MINIDUMP_MISC_INFO, MINIDUMP_MISC_INFO2 */
#define MD_MISCINFO_SIZE 24
#define MD_MISCINFO2_SIZE 44
/* For (MDRawMiscInfo).flags1. These values indicate which fields in the
* MDRawMiscInfoStructure are valid. */
typedef enum {
MD_MISCINFO_FLAGS1_PROCESS_ID = 0x00000001,
/* MINIDUMP_MISC1_PROCESS_ID */
MD_MISCINFO_FLAGS1_PROCESS_TIMES = 0x00000002,
/* MINIDUMP_MISC1_PROCESS_TIMES */
MD_MISCINFO_FLAGS1_PROCESSOR_POWER_INFO = 0x00000004
/* MINIDUMP_MISC1_PROCESSOR_POWER_INFO */
} MDMiscInfoFlags1;
/*
* Around DbgHelp version 6.0, the style of new LIST structures changed
* from including an array of length 1 at the end of the struct to
* represent the variable-length data to including explicit
* "size of header", "size of entry" and "number of entries" fields
* in the header, presumably to allow backwards-compatibly-extending
* the structures in the future. The actual list entries follow the
* header data directly in this case.
*/
typedef struct {
u_int32_t size_of_header; /* sizeof(MDRawMemoryInfoList) */
u_int32_t size_of_entry; /* sizeof(MDRawMemoryInfo) */
u_int64_t number_of_entries;
} MDRawMemoryInfoList; /* MINIDUMP_MEMORY_INFO_LIST */
typedef struct {
u_int64_t base_address; /* Base address of a region of pages */
u_int64_t allocation_base; /* Base address of a range of pages
* within this region. */
u_int32_t allocation_protection; /* Memory protection when this region
* was originally allocated:
* MDMemoryProtection */
u_int32_t __alignment1;
u_int64_t region_size;
u_int32_t state; /* MDMemoryState */
u_int32_t protection; /* MDMemoryProtection */
u_int32_t type; /* MDMemoryType */
u_int32_t __alignment2;
} MDRawMemoryInfo; /* MINIDUMP_MEMORY_INFO */
/* For (MDRawMemoryInfo).state */
typedef enum {
MD_MEMORY_STATE_COMMIT = 0x1000, /* physical storage has been allocated */
MD_MEMORY_STATE_RESERVE = 0x2000, /* reserved, but no physical storage */
MD_MEMORY_STATE_FREE = 0x10000 /* available to be allocated */
} MDMemoryState;
/* For (MDRawMemoryInfo).allocation_protection and .protection */
typedef enum {
MD_MEMORY_PROTECT_NOACCESS = 0x01, /* PAGE_NOACCESS */
MD_MEMORY_PROTECT_READONLY = 0x02, /* PAGE_READONLY */
MD_MEMORY_PROTECT_READWRITE = 0x04, /* PAGE_READWRITE */
MD_MEMORY_PROTECT_WRITECOPY = 0x08, /* PAGE_WRITECOPY */
MD_MEMORY_PROTECT_EXECUTE = 0x10, /* PAGE_EXECUTE */
MD_MEMORY_PROTECT_EXECUTE_READ = 0x20, /* PAGE_EXECUTE_READ */
MD_MEMORY_PROTECT_EXECUTE_READWRITE = 0x40, /* PAGE_EXECUTE_READWRITE */
MD_MEMORY_PROTECT_EXECUTE_WRITECOPY = 0x80, /* PAGE_EXECUTE_WRITECOPY */
/* These options can be combined with the previous flags. */
MD_MEMORY_PROTECT_GUARD = 0x100, /* PAGE_GUARD */
MD_MEMORY_PROTECT_NOCACHE = 0x200, /* PAGE_NOCACHE */
MD_MEMORY_PROTECT_WRITECOMBINE = 0x400, /* PAGE_WRITECOMBINE */
} MDMemoryProtection;
/* Used to mask the mutually exclusive options from the combinable flags. */
const u_int32_t MD_MEMORY_PROTECTION_ACCESS_MASK = 0xFF;
/* For (MDRawMemoryInfo).type */
typedef enum {
MD_MEMORY_TYPE_PRIVATE = 0x20000, /* not shared by other processes */
MD_MEMORY_TYPE_MAPPED = 0x40000, /* mapped into the view of a section */
MD_MEMORY_TYPE_IMAGE = 0x1000000 /* mapped into the view of an image */
} MDMemoryType;
/*
* Breakpad extension types
*/
typedef struct {
/* validity is a bitmask with values from MDBreakpadInfoValidity, indicating
* which of the other fields in the structure are valid. */
u_int32_t validity;
/* Thread ID of the handler thread. dump_thread_id should correspond to
* the thread_id of an MDRawThread in the minidump's MDRawThreadList if
* a dedicated thread in that list was used to produce the minidump. If
* the MDRawThreadList does not contain a dedicated thread used to produce
* the minidump, this field should be set to 0 and the validity field
* must not contain MD_BREAKPAD_INFO_VALID_DUMP_THREAD_ID. */
u_int32_t dump_thread_id;
/* Thread ID of the thread that requested the minidump be produced. As
* with dump_thread_id, requesting_thread_id should correspond to the
* thread_id of an MDRawThread in the minidump's MDRawThreadList. For
* minidumps produced as a result of an exception, requesting_thread_id
* will be the same as the MDRawExceptionStream's thread_id field. For
* minidumps produced "manually" at the program's request,
* requesting_thread_id will indicate which thread caused the dump to be
* written. If the minidump was produced at the request of something
* other than a thread in the MDRawThreadList, this field should be set
* to 0 and the validity field must not contain
* MD_BREAKPAD_INFO_VALID_REQUESTING_THREAD_ID. */
u_int32_t requesting_thread_id;
} MDRawBreakpadInfo;
/* For (MDRawBreakpadInfo).validity: */
typedef enum {
/* When set, the dump_thread_id field is valid. */
MD_BREAKPAD_INFO_VALID_DUMP_THREAD_ID = 1 << 0,
/* When set, the requesting_thread_id field is valid. */
MD_BREAKPAD_INFO_VALID_REQUESTING_THREAD_ID = 1 << 1
} MDBreakpadInfoValidity;
typedef struct {
/* expression, function, and file are 0-terminated UTF-16 strings. They
* may be truncated if necessary, but should always be 0-terminated when
* written to a file.
* Fixed-length strings are used because MiniDumpWriteDump doesn't offer
* a way for user streams to point to arbitrary RVAs for strings. */
u_int16_t expression[128]; /* Assertion that failed... */
u_int16_t function[128]; /* ...within this function... */
u_int16_t file[128]; /* ...in this file... */
u_int32_t line; /* ...at this line. */
u_int32_t type;
} MDRawAssertionInfo;
/* For (MDRawAssertionInfo).type: */
typedef enum {
MD_ASSERTION_INFO_TYPE_UNKNOWN = 0,
/* Used for assertions that would be raised by the MSVC CRT but are
* directed to an invalid parameter handler instead. */
MD_ASSERTION_INFO_TYPE_INVALID_PARAMETER,
/* Used for assertions that would be raised by the MSVC CRT but are
* directed to a pure virtual call handler instead. */
MD_ASSERTION_INFO_TYPE_PURE_VIRTUAL_CALL
} MDAssertionInfoData;
#if defined(_MSC_VER)
#pragma warning(pop)
#endif /* _MSC_VER */
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_FORMAT_H__ */

View File

@@ -0,0 +1,107 @@
// Copyright (c) 2007, Google Inc.
// All rights reserved.
//
// 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 Inc. 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<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,84 @@
// Copyright (c) 2010 Google Inc.
// All rights reserved.
//
// 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 Inc. 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 "google_breakpad/processor/source_line_resolver_base.h"
namespace google_breakpad {
using std::string;
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::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&);
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__

View File

@@ -0,0 +1,77 @@
// Copyright (c) 2006, Google Inc.
// All rights reserved.
//
// 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 Inc. 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 <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_; }
private:
// Stackwalker is responsible for building the frames_ vector.
friend class Stackwalker;
// Storage for pushed frames.
vector<StackFrame*> frames_;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCSSOR_CALL_STACK_H__

View File

@@ -0,0 +1,94 @@
// Copyright (c) 2006, Google Inc.
// All rights reserved.
//
// 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 Inc. 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 "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
using std::string;
class CodeModule {
public:
virtual ~CodeModule() {}
// The base address of this code module as it was loaded by the process.
// (u_int64_t)-1 on error.
virtual u_int64_t base_address() const = 0;
// The size of the code module. 0 on error.
virtual u_int64_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 const CodeModule* Copy() const = 0;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULE_H__

View File

@@ -0,0 +1,98 @@
// Copyright (c) 2006, Google Inc.
// All rights reserved.
//
// 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 Inc. 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 "google_breakpad/common/breakpad_types.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(u_int64_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;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULES_H__

View File

@@ -0,0 +1,73 @@
// Copyright (c) 2010 Google Inc.
// All rights reserved.
//
// 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 Inc. 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);
ExploitabilityRating CheckExploitability();
bool AddressIsAscii(u_int64_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,99 @@
// Copyright (c) 2010 Google Inc.
// All rights reserved.
//
// 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 Inc. 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::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 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,76 @@
// Copyright (c) 2010 Google Inc.
// All rights reserved.
//
// 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 Inc. 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 u_int64_t GetBase() const = 0;
// The size of this memory region.
virtual u_int32_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(u_int64_t address, u_int8_t* value) const =0;
virtual bool GetMemoryAtAddress(u_int64_t address, u_int16_t* value) const =0;
virtual bool GetMemoryAtAddress(u_int64_t address, u_int32_t* value) const =0;
virtual bool GetMemoryAtAddress(u_int64_t address, u_int64_t* value) const =0;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_MEMORY_REGION_H__

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,169 @@
// Copyright (c) 2006, Google Inc.
// All rights reserved.
//
// 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 Inc. 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 "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
using std::string;
class Minidump;
class ProcessState;
class SourceLineResolverInterface;
class SymbolSupplier;
class SystemInfo;
// Return type for Process()
enum ProcessResult {
PROCESS_OK, // The minidump 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
// had no thread list.
PROCESS_ERROR_GETTING_THREAD, // There was an error
// getting one
// thread's data from
// the minidump.
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_ERROR_NO_MEMORY_FOR_THREAD, // A thread had no
// memory region.
PROCESS_ERROR_NO_STACKWALKER_FOR_THREAD, // We couldn't
// determine the
// StackWalker to walk
// the minidump's
// threads.
PROCESS_SYMBOL_SUPPLIER_INTERRUPTED // The minidump
// processing was
// interrupted by the
// SymbolSupplier(not
// fatal)
};
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);
~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);
// 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.
static string GetCrashReason(Minidump *dump, u_int64_t *address);
// 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);
private:
SymbolSupplier *supplier_;
SourceLineResolverInterface *resolver_;
// 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_;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_PROCESSOR_H__

View File

@@ -0,0 +1,168 @@
// Copyright (c) 2006, Google Inc.
// All rights reserved.
//
// 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 Inc. 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 "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/system_info.h"
#include "google_breakpad/processor/minidump.h"
namespace google_breakpad {
using std::string;
using std::vector;
class CallStack;
class CodeModules;
enum ExploitabilityRating {
EXPLOITABILITY_HIGH, // The crash likely represents
// a exploitable memory corruption
// vulnerability.
EXPLOITABLITY_MEDIUM, // The crash appears to corrupt
// memory in a way which may be
// exploitable in some situations.
EXPLOITABILITY_LOW, // The crash either does not corrupt
// memory directly or control over
// the effected 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 furthur 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) { Clear(); }
~ProcessState();
// Resets the ProcessState to its default values
void Clear();
// Accessors. See the data declarations below.
u_int32_t time_date_stamp() const { return time_date_stamp_; }
bool crashed() const { return crashed_; }
string crash_reason() const { return crash_reason_; }
u_int64_t crash_address() const { return crash_address_; }
string assertion() const { return assertion_; }
int requesting_thread() const { return requesting_thread_; }
const vector<CallStack*>* threads() const { return &threads_; }
const vector<MinidumpMemoryRegion*>* thread_memory_regions() const {
return &thread_memory_regions_;
}
const SystemInfo* system_info() const { return &system_info_; }
const CodeModules* modules() const { return modules_; }
ExploitabilityRating exploitability() const { return exploitability_; }
private:
// MinidumpProcessor is responsible for building ProcessState objects.
friend class MinidumpProcessor;
// The time-date stamp of the minidump (time_t format)
u_int32_t time_date_stamp_;
// 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.
u_int64_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_;
// Stacks for each thread (except possibly the exception handler
// thread) at the time of the crash.
vector<CallStack*> threads_;
vector<MinidumpMemoryRegion*> thread_memory_regions_;
// OS and CPU information.
SystemInfo system_info_;
// The modules that were loaded into the process represented by the
// ProcessState.
const CodeModules *modules_;
// The exploitability rating as determined by the exploitability
// engine. When the exploitability engine is not enabled this
// defaults to EXPLOITABILITY_NONE.
ExploitabilityRating exploitability_;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_PROCESS_STATE_H__

View File

@@ -0,0 +1,118 @@
// Copyright (c) 2010 Google Inc.
// All rights reserved.
//
// 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 Inc. 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 <map>
#include <string>
#include "google_breakpad/processor/source_line_resolver_interface.h"
namespace google_breakpad {
using std::map;
// 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(char **symbol_data, const string &file_name);
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);
virtual bool ShouldDeleteMemoryBufferAfterLoadModule();
virtual void UnloadModule(const CodeModule *module);
virtual bool HasModule(const CodeModule *module);
virtual void FillSourceLineInfo(StackFrame *frame);
virtual WindowsFrameInfo *FindWindowsFrameInfo(const StackFrame *frame);
virtual CFIFrameInfo *FindCFIFrameInfo(const StackFrame *frame);
// Nested structs and classes.
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_;
// 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,111 @@
// -*- mode: C++ -*-
// Copyright (c) 2010 Google Inc.
// All rights reserved.
//
// 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 Inc. 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 <string>
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/code_module.h"
namespace google_breakpad {
using std::string;
struct StackFrame;
struct WindowsFrameInfo;
struct CFIFrameInfo;
class SourceLineResolverInterface {
public:
typedef u_int64_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 insteading 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.
virtual bool LoadModuleUsingMemoryBuffer(const CodeModule *module,
char *memory_buffer) = 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;
// 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.
virtual void FillSourceLineInfo(StackFrame *frame) = 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,121 @@
// Copyright (c) 2006, Google Inc.
// All rights reserved.
//
// 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 Inc. 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 "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
class CodeModule;
using std::string;
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, // Scanned the stack using call frame info, found this
FRAME_TRUST_FP, // Derived from frame pointer
FRAME_TRUST_CFI, // Derived from call frame info
FRAME_TRUST_CONTEXT // Given as instruction pointer in a context
};
StackFrame()
: instruction(),
module(NULL),
function_name(),
function_base(),
source_file_name(),
source_line(),
source_line_base(),
trust(FRAME_TRUST_NONE) {}
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_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";
default:
return "unknown";
}
};
// 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 will be within
// the instruction that caused execution to branch to a called function,
// but may not necessarily point to the exact beginning of that instruction.
u_int64_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.
u_int64_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.
u_int64_t source_line_base;
// Amount of trust the stack walker has in the instruction pointer
// of this frame.
FrameTrust trust;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__

View File

@@ -0,0 +1,243 @@
// -*- mode: c++ -*-
// Copyright (c) 2010 Google Inc.
// All rights reserved.
//
// 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 Inc. 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;
struct 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();
// 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 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) {}
// 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) {
return ContextValidity(1 << 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.
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;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_CPU_H__

View File

@@ -0,0 +1,194 @@
// Copyright (c) 2010 Google Inc.
// All rights reserved.
//
// 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 Inc. 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 "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/code_modules.h"
#include "google_breakpad/processor/memory_region.h"
namespace google_breakpad {
class CallStack;
class MinidumpContext;
class SourceLineResolverInterface;
struct StackFrame;
class SymbolSupplier;
class SystemInfo;
using std::set;
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().
bool Walk(CallStack *stack);
// 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,
MinidumpContext *context,
MemoryRegion *memory,
const CodeModules *modules,
SymbolSupplier *supplier,
SourceLineResolverInterface *resolver);
static void set_max_frames(u_int32_t max_frames) { max_frames_ = max_frames; }
static u_int32_t max_frames() { return max_frames_; }
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. supplier is an optional caller-supplied SymbolSupplier
// implementation. If supplier is NULL, source line info will not be
// resolved. resolver is an instance of SourceLineResolverInterface
// (see source_line_resolver_interface.h and basic_source_line_resolver.h).
// If resolver is NULL, source line info will not be resolved.
Stackwalker(const SystemInfo *system_info,
MemoryRegion *memory,
const CodeModules *modules,
SymbolSupplier *supplier,
SourceLineResolverInterface *resolver);
// 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(u_int64_t address);
// 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) {
const int kRASearchWords = 30;
for (InstructionType location = location_start;
location <= location_start + kRASearchWords * sizeof(InstructionType);
location += sizeof(InstructionType)) {
InstructionType ip;
if (!memory_->GetMemoryAtAddress(location, &ip))
break;
if (modules_ && modules_->GetModuleForAddress(ip) &&
InstructionAddressSeemsValid(ip)) {
*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_;
protected:
// The SourceLineResolver implementation.
SourceLineResolverInterface *resolver_;
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.
virtual StackFrame* GetCallerFrame(const CallStack *stack) = 0;
// The optional SymbolSupplier for resolving source line info.
SymbolSupplier *supplier_;
// A list of modules that we haven't found symbols for. We track
// this in order to avoid repeatedly looking them up again within
// one minidump.
set<std::string> no_symbol_modules_;
// The maximum number of frames Stackwalker will walk through.
// This defaults to 1024 to prevent infinite loops.
static u_int32_t max_frames_;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_STACKWALKER_H__

View File

@@ -0,0 +1,98 @@
// Copyright (c) 2006, Google Inc.
// All rights reserved.
//
// 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 Inc. 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>
namespace google_breakpad {
using std::string;
class CodeModule;
class 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) = 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,97 @@
// Copyright (c) 2006, Google Inc.
// All rights reserved.
//
// 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 Inc. 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>
namespace google_breakpad {
using std::string;
struct SystemInfo {
public:
SystemInfo() : os(), os_short(), os_version(), cpu(), cpu_info(),
cpu_count(0) {}
// 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;
}
// 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 are "windows",
// "mac", and "linux". 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;
};
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__