Planeshift
minidump_exception_mac.h
Go to the documentation of this file.
1 /* Copyright (c) 2006, Google Inc.
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer
12  * in the documentation and/or other materials provided with the
13  * distribution.
14  * * Neither the name of Google Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 
30 /* minidump_exception_mac.h: A definition of exception codes for Mac
31  * OS X
32  *
33  * (This is C99 source, please don't corrupt it with C++.)
34  *
35  * Author: Mark Mentovai
36  * Split into its own file: Neal Sidhwaney */
37 
38 
39 #ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_MAC_H__
40 #define GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_MAC_H__
41 
42 #include <stddef.h>
43 
45 
46 /* For (MDException).exception_code. Breakpad minidump extension for Mac OS X
47  * support. Based on Darwin/Mac OS X' mach/exception_types.h. This is
48  * what Mac OS X calls an "exception", not a "code". */
49 typedef enum {
50  /* Exception code. The high 16 bits of exception_code contains one of
51  * these values. */
52  MD_EXCEPTION_MAC_BAD_ACCESS = 1, /* code can be a kern_return_t */
53  /* EXC_BAD_ACCESS */
54  MD_EXCEPTION_MAC_BAD_INSTRUCTION = 2, /* code is CPU-specific */
55  /* EXC_BAD_INSTRUCTION */
56  MD_EXCEPTION_MAC_ARITHMETIC = 3, /* code is CPU-specific */
57  /* EXC_ARITHMETIC */
58  MD_EXCEPTION_MAC_EMULATION = 4, /* code is CPU-specific */
59  /* EXC_EMULATION */
61  /* EXC_SOFTWARE */
62  MD_EXCEPTION_MAC_BREAKPOINT = 6, /* code is CPU-specific */
63  /* EXC_BREAKPOINT */
65  /* EXC_SYSCALL */
67  /* EXC_MACH_SYSCALL */
69  /* EXC_RPC_ALERT */
71 
72 /* For (MDException).exception_flags. Breakpad minidump extension for Mac OS X
73  * support. Based on Darwin/Mac OS X' mach/ppc/exception.h and
74  * mach/i386/exception.h. This is what Mac OS X calls a "code". */
75 typedef enum {
76  /* With MD_EXCEPTION_BAD_ACCESS. These are relevant kern_return_t values
77  * from mach/kern_return.h. */
79  /* KERN_INVALID_ADDRESS */
81  /* KERN_PROTECTION_FAILURE */
83  /* KERN_NO_ACCESS */
85  /* KERN_MEMORY_FAILURE */
87  /* KERN_MEMORY_ERROR */
88 
89  /* With MD_EXCEPTION_SOFTWARE */
90  MD_EXCEPTION_CODE_MAC_BAD_SYSCALL = 0x00010000, /* Mach SIGSYS */
91  MD_EXCEPTION_CODE_MAC_BAD_PIPE = 0x00010001, /* Mach SIGPIPE */
92  MD_EXCEPTION_CODE_MAC_ABORT = 0x00010002, /* Mach SIGABRT */
93  /* Custom values */
94  MD_EXCEPTION_CODE_MAC_NS_EXCEPTION = 0xDEADC0DE, /* uncaught NSException */
95 
96  /* With MD_EXCEPTION_MAC_BAD_ACCESS on arm */
97  MD_EXCEPTION_CODE_MAC_ARM_DA_ALIGN = 0x0101, /* EXC_ARM_DA_ALIGN */
98  MD_EXCEPTION_CODE_MAC_ARM_DA_DEBUG = 0x0102, /* EXC_ARM_DA_DEBUG */
99 
100  /* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on arm */
101  MD_EXCEPTION_CODE_MAC_ARM_UNDEFINED = 1, /* EXC_ARM_UNDEFINED */
102 
103  /* With MD_EXCEPTION_MAC_BREAKPOINT on arm */
104  MD_EXCEPTION_CODE_MAC_ARM_BREAKPOINT = 1, /* EXC_ARM_BREAKPOINT */
105 
106  /* With MD_EXCEPTION_MAC_BAD_ACCESS on ppc */
108  /* EXC_PPC_VM_PROT_READ */
110  /* EXC_PPC_BADSPACE */
112  /* EXC_PPC_UNALIGNED */
113 
114  /* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on ppc */
116  /* EXC_PPC_INVALID_SYSCALL */
118  /* EXC_PPC_UNIPL_INST */
120  /* EXC_PPC_PRIVINST */
122  /* EXC_PPC_PRIVREG */
124  /* EXC_PPC_TRACE */
126  /* EXC_PPC_PERFMON */
127 
128  /* With MD_EXCEPTION_MAC_ARITHMETIC on ppc */
130  /* EXC_PPC_OVERFLOW */
132  /* EXC_PPC_ZERO_DIVIDE */
134  /* EXC_FLT_INEXACT */
136  /* EXC_PPC_FLT_ZERO_DIVIDE */
138  /* EXC_PPC_FLT_UNDERFLOW */
140  /* EXC_PPC_FLT_OVERFLOW */
142  /* EXC_PPC_FLT_NOT_A_NUMBER */
143 
144  /* With MD_EXCEPTION_MAC_EMULATION on ppc */
146  /* EXC_PPC_NOEMULATION */
148  /* EXC_PPC_ALTIVECASSIST */
149 
150  /* With MD_EXCEPTION_MAC_SOFTWARE on ppc */
151  MD_EXCEPTION_CODE_MAC_PPC_TRAP = 0x00000001, /* EXC_PPC_TRAP */
152  MD_EXCEPTION_CODE_MAC_PPC_MIGRATE = 0x00010100, /* EXC_PPC_MIGRATE */
153 
154  /* With MD_EXCEPTION_MAC_BREAKPOINT on ppc */
155  MD_EXCEPTION_CODE_MAC_PPC_BREAKPOINT = 1, /* EXC_PPC_BREAKPOINT */
156 
157  /* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on x86, see also x86 interrupt
158  * values below. */
160 
161  /* With MD_EXCEPTION_MAC_ARITHMETIC on x86 */
162  MD_EXCEPTION_CODE_MAC_X86_DIV = 1, /* EXC_I386_DIV */
163  MD_EXCEPTION_CODE_MAC_X86_INTO = 2, /* EXC_I386_INTO */
164  MD_EXCEPTION_CODE_MAC_X86_NOEXT = 3, /* EXC_I386_NOEXT */
165  MD_EXCEPTION_CODE_MAC_X86_EXTOVR = 4, /* EXC_I386_EXTOVR */
166  MD_EXCEPTION_CODE_MAC_X86_EXTERR = 5, /* EXC_I386_EXTERR */
167  MD_EXCEPTION_CODE_MAC_X86_EMERR = 6, /* EXC_I386_EMERR */
168  MD_EXCEPTION_CODE_MAC_X86_BOUND = 7, /* EXC_I386_BOUND */
169  MD_EXCEPTION_CODE_MAC_X86_SSEEXTERR = 8, /* EXC_I386_SSEEXTERR */
170 
171  /* With MD_EXCEPTION_MAC_BREAKPOINT on x86 */
172  MD_EXCEPTION_CODE_MAC_X86_SGL = 1, /* EXC_I386_SGL */
173  MD_EXCEPTION_CODE_MAC_X86_BPT = 2, /* EXC_I386_BPT */
174 
175  /* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on x86. These are the raw
176  * x86 interrupt codes. Most of these are mapped to other Mach
177  * exceptions and codes, are handled, or should not occur in user space.
178  * A few of these will do occur with MD_EXCEPTION_MAC_BAD_INSTRUCTION. */
179  /* EXC_I386_DIVERR = 0: mapped to EXC_ARITHMETIC/EXC_I386_DIV */
180  /* EXC_I386_SGLSTP = 1: mapped to EXC_BREAKPOINT/EXC_I386_SGL */
181  /* EXC_I386_NMIFLT = 2: should not occur in user space */
182  /* EXC_I386_BPTFLT = 3: mapped to EXC_BREAKPOINT/EXC_I386_BPT */
183  /* EXC_I386_INTOFLT = 4: mapped to EXC_ARITHMETIC/EXC_I386_INTO */
184  /* EXC_I386_BOUNDFLT = 5: mapped to EXC_ARITHMETIC/EXC_I386_BOUND */
185  /* EXC_I386_INVOPFLT = 6: mapped to EXC_BAD_INSTRUCTION/EXC_I386_INVOP */
186  /* EXC_I386_NOEXTFLT = 7: should be handled by the kernel */
187  /* EXC_I386_DBLFLT = 8: should be handled (if possible) by the kernel */
188  /* EXC_I386_EXTOVRFLT = 9: mapped to EXC_BAD_ACCESS/(PROT_READ|PROT_EXEC) */
190  /* EXC_INVTSSFLT */
192  /* EXC_SEGNPFLT */
194  /* EXC_STKFLT */
196  /* EXC_GPFLT */
197  /* EXC_I386_PGFLT = 14: should not occur in user space */
198  /* EXC_I386_EXTERRFLT = 16: mapped to EXC_ARITHMETIC/EXC_I386_EXTERR */
200  /* EXC_ALIGNFLT (for vector operations) */
201  /* EXC_I386_ENOEXTFLT = 32: should be handled by the kernel */
202  /* EXC_I386_ENDPERR = 33: should not occur */
204 
205 #endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_MAC_OSX_H__ */
MDExceptionCodeMac