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 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 19 | enum class CrashReason { |
| 20 | eInvalidCrashReason, |
Chaoren Lin | 28e5742 | 2015-02-03 01:51:25 +0000 | [diff] [blame] | 21 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 22 | // SIGSEGV crash reasons. |
| 23 | eInvalidAddress, |
| 24 | ePrivilegedAddress, |
Valentina Giusti | 6f8c1f8 | 2016-10-06 18:05:12 +0000 | [diff] [blame^] | 25 | eBoundViolation, |
Chaoren Lin | 28e5742 | 2015-02-03 01:51:25 +0000 | [diff] [blame] | 26 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 27 | // SIGILL crash reasons. |
| 28 | eIllegalOpcode, |
| 29 | eIllegalOperand, |
| 30 | eIllegalAddressingMode, |
| 31 | eIllegalTrap, |
| 32 | ePrivilegedOpcode, |
| 33 | ePrivilegedRegister, |
| 34 | eCoprocessorError, |
| 35 | eInternalStackError, |
Chaoren Lin | 28e5742 | 2015-02-03 01:51:25 +0000 | [diff] [blame] | 36 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 37 | // SIGBUS crash reasons, |
| 38 | eIllegalAlignment, |
| 39 | eIllegalAddress, |
| 40 | eHardwareError, |
Chaoren Lin | 28e5742 | 2015-02-03 01:51:25 +0000 | [diff] [blame] | 41 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 42 | // SIGFPE crash reasons, |
| 43 | eIntegerDivideByZero, |
| 44 | eIntegerOverflow, |
| 45 | eFloatDivideByZero, |
| 46 | eFloatOverflow, |
| 47 | eFloatUnderflow, |
| 48 | eFloatInexactResult, |
| 49 | eFloatInvalidOperation, |
| 50 | eFloatSubscriptRange |
Chaoren Lin | 28e5742 | 2015-02-03 01:51:25 +0000 | [diff] [blame] | 51 | }; |
| 52 | |
Valentina Giusti | 6f8c1f8 | 2016-10-06 18:05:12 +0000 | [diff] [blame^] | 53 | std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info); |
Chaoren Lin | 28e5742 | 2015-02-03 01:51:25 +0000 | [diff] [blame] | 54 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 55 | const char *CrashReasonAsString(CrashReason reason); |
Chaoren Lin | 28e5742 | 2015-02-03 01:51:25 +0000 | [diff] [blame] | 56 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 57 | CrashReason GetCrashReason(const siginfo_t &info); |
Chaoren Lin | 28e5742 | 2015-02-03 01:51:25 +0000 | [diff] [blame] | 58 | |
| 59 | #endif // #ifndef liblldb_CrashReason_H_ |