]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/Process/POSIX/CrashReason.h
Import DTS files from Linux 5.0
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / Process / POSIX / CrashReason.h
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   eInvalidCrashReason,
21
22   // SIGSEGV crash reasons.
23   eInvalidAddress,
24   ePrivilegedAddress,
25   eBoundViolation,
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 GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr);
54 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info);
55
56 const char *CrashReasonAsString(CrashReason reason);
57
58 CrashReason GetCrashReason(const siginfo_t &info);
59
60 #endif // #ifndef liblldb_CrashReason_H_