Planeshift

minidump_exception_mac.h

Go to the documentation of this file.
00001 /* Copyright (c) 2006, Google Inc.
00002  * All rights reserved.
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions are
00006  * met:
00007  *
00008  *     * Redistributions of source code must retain the above copyright
00009  * notice, this list of conditions and the following disclaimer.
00010  *     * Redistributions in binary form must reproduce the above
00011  * copyright notice, this list of conditions and the following disclaimer
00012  * in the documentation and/or other materials provided with the
00013  * distribution.
00014  *     * Neither the name of Google Inc. nor the names of its
00015  * contributors may be used to endorse or promote products derived from
00016  * this software without specific prior written permission.
00017  *
00018  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00019  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00020  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00021  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00022  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00023  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00024  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00025  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00026  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00027  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00028  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
00029 
00030 /* minidump_exception_mac.h: A definition of exception codes for Mac
00031  * OS X
00032  *
00033  * (This is C99 source, please don't corrupt it with C++.)
00034  *
00035  * Author: Mark Mentovai
00036  * Split into its own file: Neal Sidhwaney */
00037  
00038 
00039 #ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_MAC_H__
00040 #define GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_MAC_H__
00041 
00042 #include <stddef.h>
00043 
00044 #include "google_breakpad/common/breakpad_types.h"
00045 
00046 /* For (MDException).exception_code.  Breakpad minidump extension for Mac OS X
00047  * support.  Based on Darwin/Mac OS X' mach/exception_types.h.  This is
00048  * what Mac OS X calls an "exception", not a "code". */
00049 typedef enum {
00050   /* Exception code.  The high 16 bits of exception_code contains one of
00051    * these values. */
00052   MD_EXCEPTION_MAC_BAD_ACCESS      = 1,  /* code can be a kern_return_t */
00053       /* EXC_BAD_ACCESS */
00054   MD_EXCEPTION_MAC_BAD_INSTRUCTION = 2,  /* code is CPU-specific */
00055       /* EXC_BAD_INSTRUCTION */
00056   MD_EXCEPTION_MAC_ARITHMETIC      = 3,  /* code is CPU-specific */
00057       /* EXC_ARITHMETIC */
00058   MD_EXCEPTION_MAC_EMULATION       = 4,  /* code is CPU-specific */
00059       /* EXC_EMULATION */
00060   MD_EXCEPTION_MAC_SOFTWARE        = 5,
00061       /* EXC_SOFTWARE */
00062   MD_EXCEPTION_MAC_BREAKPOINT      = 6,  /* code is CPU-specific */
00063       /* EXC_BREAKPOINT */
00064   MD_EXCEPTION_MAC_SYSCALL         = 7,
00065       /* EXC_SYSCALL */
00066   MD_EXCEPTION_MAC_MACH_SYSCALL    = 8,
00067       /* EXC_MACH_SYSCALL */
00068   MD_EXCEPTION_MAC_RPC_ALERT       = 9
00069       /* EXC_RPC_ALERT */
00070 } MDExceptionMac;
00071 
00072 /* For (MDException).exception_flags.  Breakpad minidump extension for Mac OS X
00073  * support.  Based on Darwin/Mac OS X' mach/ppc/exception.h and
00074  * mach/i386/exception.h.  This is what Mac OS X calls a "code". */
00075 typedef enum {
00076   /* With MD_EXCEPTION_BAD_ACCESS.  These are relevant kern_return_t values
00077    * from mach/kern_return.h. */
00078   MD_EXCEPTION_CODE_MAC_INVALID_ADDRESS    =  1,
00079       /* KERN_INVALID_ADDRESS */
00080   MD_EXCEPTION_CODE_MAC_PROTECTION_FAILURE =  2,
00081       /* KERN_PROTECTION_FAILURE */
00082   MD_EXCEPTION_CODE_MAC_NO_ACCESS          =  8,
00083       /* KERN_NO_ACCESS */
00084   MD_EXCEPTION_CODE_MAC_MEMORY_FAILURE     =  9,
00085       /* KERN_MEMORY_FAILURE */
00086   MD_EXCEPTION_CODE_MAC_MEMORY_ERROR       = 10,
00087       /* KERN_MEMORY_ERROR */
00088 
00089   /* With MD_EXCEPTION_SOFTWARE */
00090   MD_EXCEPTION_CODE_MAC_BAD_SYSCALL  = 0x00010000,  /* Mach SIGSYS */
00091   MD_EXCEPTION_CODE_MAC_BAD_PIPE     = 0x00010001,  /* Mach SIGPIPE */
00092   MD_EXCEPTION_CODE_MAC_ABORT        = 0x00010002,  /* Mach SIGABRT */
00093   /* Custom values */
00094   MD_EXCEPTION_CODE_MAC_NS_EXCEPTION = 0xDEADC0DE,  /* uncaught NSException */
00095 
00096   /* With MD_EXCEPTION_MAC_BAD_ACCESS on arm */
00097   MD_EXCEPTION_CODE_MAC_ARM_DA_ALIGN = 0x0101,  /* EXC_ARM_DA_ALIGN */
00098   MD_EXCEPTION_CODE_MAC_ARM_DA_DEBUG = 0x0102,  /* EXC_ARM_DA_DEBUG */
00099 
00100   /* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on arm */
00101   MD_EXCEPTION_CODE_MAC_ARM_UNDEFINED = 1,  /* EXC_ARM_UNDEFINED */
00102 
00103   /* With MD_EXCEPTION_MAC_BREAKPOINT on arm */
00104   MD_EXCEPTION_CODE_MAC_ARM_BREAKPOINT = 1, /* EXC_ARM_BREAKPOINT */
00105 
00106   /* With MD_EXCEPTION_MAC_BAD_ACCESS on ppc */
00107   MD_EXCEPTION_CODE_MAC_PPC_VM_PROT_READ = 0x0101,
00108       /* EXC_PPC_VM_PROT_READ */
00109   MD_EXCEPTION_CODE_MAC_PPC_BADSPACE     = 0x0102,
00110       /* EXC_PPC_BADSPACE */
00111   MD_EXCEPTION_CODE_MAC_PPC_UNALIGNED    = 0x0103,
00112       /* EXC_PPC_UNALIGNED */
00113 
00114   /* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on ppc */
00115   MD_EXCEPTION_CODE_MAC_PPC_INVALID_SYSCALL           = 1,
00116       /* EXC_PPC_INVALID_SYSCALL */
00117   MD_EXCEPTION_CODE_MAC_PPC_UNIMPLEMENTED_INSTRUCTION = 2,
00118       /* EXC_PPC_UNIPL_INST */
00119   MD_EXCEPTION_CODE_MAC_PPC_PRIVILEGED_INSTRUCTION    = 3,
00120       /* EXC_PPC_PRIVINST */
00121   MD_EXCEPTION_CODE_MAC_PPC_PRIVILEGED_REGISTER       = 4,
00122       /* EXC_PPC_PRIVREG */
00123   MD_EXCEPTION_CODE_MAC_PPC_TRACE                     = 5,
00124       /* EXC_PPC_TRACE */
00125   MD_EXCEPTION_CODE_MAC_PPC_PERFORMANCE_MONITOR       = 6,
00126       /* EXC_PPC_PERFMON */
00127 
00128   /* With MD_EXCEPTION_MAC_ARITHMETIC on ppc */
00129   MD_EXCEPTION_CODE_MAC_PPC_OVERFLOW           = 1,
00130       /* EXC_PPC_OVERFLOW */
00131   MD_EXCEPTION_CODE_MAC_PPC_ZERO_DIVIDE        = 2,
00132       /* EXC_PPC_ZERO_DIVIDE */
00133   MD_EXCEPTION_CODE_MAC_PPC_FLOAT_INEXACT      = 3,
00134       /* EXC_FLT_INEXACT */
00135   MD_EXCEPTION_CODE_MAC_PPC_FLOAT_ZERO_DIVIDE  = 4,
00136       /* EXC_PPC_FLT_ZERO_DIVIDE */
00137   MD_EXCEPTION_CODE_MAC_PPC_FLOAT_UNDERFLOW    = 5,
00138       /* EXC_PPC_FLT_UNDERFLOW */
00139   MD_EXCEPTION_CODE_MAC_PPC_FLOAT_OVERFLOW     = 6,
00140       /* EXC_PPC_FLT_OVERFLOW */
00141   MD_EXCEPTION_CODE_MAC_PPC_FLOAT_NOT_A_NUMBER = 7,
00142       /* EXC_PPC_FLT_NOT_A_NUMBER */
00143 
00144   /* With MD_EXCEPTION_MAC_EMULATION on ppc */
00145   MD_EXCEPTION_CODE_MAC_PPC_NO_EMULATION   = 8,
00146       /* EXC_PPC_NOEMULATION */
00147   MD_EXCEPTION_CODE_MAC_PPC_ALTIVEC_ASSIST = 9,
00148       /* EXC_PPC_ALTIVECASSIST */
00149 
00150   /* With MD_EXCEPTION_MAC_SOFTWARE on ppc */
00151   MD_EXCEPTION_CODE_MAC_PPC_TRAP    = 0x00000001,  /* EXC_PPC_TRAP */
00152   MD_EXCEPTION_CODE_MAC_PPC_MIGRATE = 0x00010100,  /* EXC_PPC_MIGRATE */
00153 
00154   /* With MD_EXCEPTION_MAC_BREAKPOINT on ppc */
00155   MD_EXCEPTION_CODE_MAC_PPC_BREAKPOINT = 1,  /* EXC_PPC_BREAKPOINT */
00156 
00157   /* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on x86, see also x86 interrupt
00158    * values below. */
00159   MD_EXCEPTION_CODE_MAC_X86_INVALID_OPERATION = 1,  /* EXC_I386_INVOP */
00160 
00161   /* With MD_EXCEPTION_MAC_ARITHMETIC on x86 */
00162   MD_EXCEPTION_CODE_MAC_X86_DIV       = 1,  /* EXC_I386_DIV */
00163   MD_EXCEPTION_CODE_MAC_X86_INTO      = 2,  /* EXC_I386_INTO */
00164   MD_EXCEPTION_CODE_MAC_X86_NOEXT     = 3,  /* EXC_I386_NOEXT */
00165   MD_EXCEPTION_CODE_MAC_X86_EXTOVR    = 4,  /* EXC_I386_EXTOVR */
00166   MD_EXCEPTION_CODE_MAC_X86_EXTERR    = 5,  /* EXC_I386_EXTERR */
00167   MD_EXCEPTION_CODE_MAC_X86_EMERR     = 6,  /* EXC_I386_EMERR */
00168   MD_EXCEPTION_CODE_MAC_X86_BOUND     = 7,  /* EXC_I386_BOUND */
00169   MD_EXCEPTION_CODE_MAC_X86_SSEEXTERR = 8,  /* EXC_I386_SSEEXTERR */
00170 
00171   /* With MD_EXCEPTION_MAC_BREAKPOINT on x86 */
00172   MD_EXCEPTION_CODE_MAC_X86_SGL = 1,  /* EXC_I386_SGL */
00173   MD_EXCEPTION_CODE_MAC_X86_BPT = 2,  /* EXC_I386_BPT */
00174 
00175   /* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on x86.  These are the raw
00176    * x86 interrupt codes.  Most of these are mapped to other Mach
00177    * exceptions and codes, are handled, or should not occur in user space.
00178    * A few of these will do occur with MD_EXCEPTION_MAC_BAD_INSTRUCTION. */
00179   /* EXC_I386_DIVERR    =  0: mapped to EXC_ARITHMETIC/EXC_I386_DIV */
00180   /* EXC_I386_SGLSTP    =  1: mapped to EXC_BREAKPOINT/EXC_I386_SGL */
00181   /* EXC_I386_NMIFLT    =  2: should not occur in user space */
00182   /* EXC_I386_BPTFLT    =  3: mapped to EXC_BREAKPOINT/EXC_I386_BPT */
00183   /* EXC_I386_INTOFLT   =  4: mapped to EXC_ARITHMETIC/EXC_I386_INTO */
00184   /* EXC_I386_BOUNDFLT  =  5: mapped to EXC_ARITHMETIC/EXC_I386_BOUND */
00185   /* EXC_I386_INVOPFLT  =  6: mapped to EXC_BAD_INSTRUCTION/EXC_I386_INVOP */
00186   /* EXC_I386_NOEXTFLT  =  7: should be handled by the kernel */
00187   /* EXC_I386_DBLFLT    =  8: should be handled (if possible) by the kernel */
00188   /* EXC_I386_EXTOVRFLT =  9: mapped to EXC_BAD_ACCESS/(PROT_READ|PROT_EXEC) */
00189   MD_EXCEPTION_CODE_MAC_X86_INVALID_TASK_STATE_SEGMENT = 10,
00190       /* EXC_INVTSSFLT */
00191   MD_EXCEPTION_CODE_MAC_X86_SEGMENT_NOT_PRESENT        = 11,
00192       /* EXC_SEGNPFLT */
00193   MD_EXCEPTION_CODE_MAC_X86_STACK_FAULT                = 12,
00194       /* EXC_STKFLT */
00195   MD_EXCEPTION_CODE_MAC_X86_GENERAL_PROTECTION_FAULT   = 13,
00196       /* EXC_GPFLT */
00197   /* EXC_I386_PGFLT     = 14: should not occur in user space */
00198   /* EXC_I386_EXTERRFLT = 16: mapped to EXC_ARITHMETIC/EXC_I386_EXTERR */
00199   MD_EXCEPTION_CODE_MAC_X86_ALIGNMENT_FAULT            = 17
00200       /* EXC_ALIGNFLT (for vector operations) */
00201   /* EXC_I386_ENOEXTFLT = 32: should be handled by the kernel */
00202   /* EXC_I386_ENDPERR   = 33: should not occur */
00203 } MDExceptionCodeMac;
00204 
00205 #endif  /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_MAC_OSX_H__ */