1 //===-- CrashReason.h -------------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef liblldb_CrashReason_H_ 10 #define liblldb_CrashReason_H_ 11 12 #include "lldb/lldb-types.h" 13 14 #include <csignal> 15 16 #include <string> 17 18 enum class CrashReason { 19 eInvalidCrashReason, 20 21 // SIGSEGV crash reasons. 22 eInvalidAddress, 23 ePrivilegedAddress, 24 eBoundViolation, 25 eAsyncTagCheckFault, 26 eSyncTagCheckFault, 27 28 // SIGILL crash reasons. 29 eIllegalOpcode, 30 eIllegalOperand, 31 eIllegalAddressingMode, 32 eIllegalTrap, 33 ePrivilegedOpcode, 34 ePrivilegedRegister, 35 eCoprocessorError, 36 eInternalStackError, 37 38 // SIGBUS crash reasons, 39 eIllegalAlignment, 40 eIllegalAddress, 41 eHardwareError, 42 43 // SIGFPE crash reasons, 44 eIntegerDivideByZero, 45 eIntegerOverflow, 46 eFloatDivideByZero, 47 eFloatOverflow, 48 eFloatUnderflow, 49 eFloatInexactResult, 50 eFloatInvalidOperation, 51 eFloatSubscriptRange 52 }; 53 54 std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr); 55 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info); 56 57 const char *CrashReasonAsString(CrashReason reason); 58 59 CrashReason GetCrashReason(const siginfo_t &info); 60 61 #endif // #ifndef liblldb_CrashReason_H_ 62