Chaoren Lin | 28e5742 | 2015-02-03 01:51:25 +0000 | [diff] [blame^] | 1 | //===-- CrashReason.h -------------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef liblldb_CrashReason_H_ |
| 11 | #define liblldb_CrashReason_H_ |
| 12 | |
| 13 | #include "lldb/lldb-types.h" |
| 14 | |
| 15 | #include <signal.h> |
| 16 | |
| 17 | #include <string> |
| 18 | |
| 19 | enum class CrashReason |
| 20 | { |
| 21 | eInvalidCrashReason, |
| 22 | |
| 23 | // SIGSEGV crash reasons. |
| 24 | eInvalidAddress, |
| 25 | ePrivilegedAddress, |
| 26 | |
| 27 | // SIGILL crash reasons. |
| 28 | eIllegalOpcode, |
| 29 | eIllegalOperand, |
| 30 | eIllegalAddressingMode, |
| 31 | eIllegalTrap, |
| 32 | ePrivilegedOpcode, |
| 33 | ePrivilegedRegister, |
| 34 | eCoprocessorError, |
| 35 | eInternalStackError, |
| 36 | |
| 37 | // SIGBUS crash reasons, |
| 38 | eIllegalAlignment, |
| 39 | eIllegalAddress, |
| 40 | eHardwareError, |
| 41 | |
| 42 | // SIGFPE crash reasons, |
| 43 | eIntegerDivideByZero, |
| 44 | eIntegerOverflow, |
| 45 | eFloatDivideByZero, |
| 46 | eFloatOverflow, |
| 47 | eFloatUnderflow, |
| 48 | eFloatInexactResult, |
| 49 | eFloatInvalidOperation, |
| 50 | eFloatSubscriptRange |
| 51 | }; |
| 52 | |
| 53 | std::string |
| 54 | GetCrashReasonString (CrashReason reason, lldb::addr_t fault_addr); |
| 55 | |
| 56 | const char * |
| 57 | CrashReasonAsString (CrashReason reason); |
| 58 | |
| 59 | CrashReason |
| 60 | GetCrashReason(const siginfo_t& info); |
| 61 | |
| 62 | #endif // #ifndef liblldb_CrashReason_H_ |