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