minidump_common/errors/
linux.rs

1#![allow(non_camel_case_types)]
2#![allow(non_upper_case_globals)]
3
4use num_derive::FromPrimitive;
5
6/// Values for
7/// [`MINIDUMP_EXCEPTION::exception_code`](crate::format::MINIDUMP_EXCEPTION::exception_code)
8/// for crashes on Linux.
9///
10/// These are primarily signal numbers from bits/signum.h.
11#[repr(u32)]
12#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)]
13pub enum ExceptionCodeLinux {
14    /// Hangup (POSIX)
15    SIGHUP = 0x1u32,
16    /// Interrupt (ANSI)
17    SIGINT = 0x2,
18    /// Quit (POSIX)
19    SIGQUIT = 0x3,
20    /// Illegal instruction (ANSI)
21    SIGILL = 0x4,
22    /// Trace trap (POSIX)
23    SIGTRAP = 0x5,
24    /// Abort (ANSI)
25    SIGABRT = 0x6,
26    /// BUS error (4.2 BSD)
27    SIGBUS = 0x7,
28    /// Floating-point exception (ANSI)
29    SIGFPE = 0x8,
30    /// Kill, unblockable (POSIX)
31    SIGKILL = 0x9,
32    /// User-defined signal 1 (POSIX)
33    SIGUSR1 = 0xa,
34    /// Segmentation violation (ANSI)
35    SIGSEGV = 0xb,
36    /// User-defined signal 2 (POSIX)
37    SIGUSR2 = 0xc,
38    /// Broken pipe (POSIX)
39    SIGPIPE = 0xd,
40    /// Alarm clock (POSIX)
41    SIGALRM = 0xe,
42    /// Termination (ANSI)
43    SIGTERM = 0xf,
44    /// Stack fault
45    SIGSTKFLT = 0x10,
46    /// Child status has changed (POSIX)
47    SIGCHLD = 0x11,
48    /// Continue (POSIX)
49    SIGCONT = 0x12,
50    /// Stop, unblockable (POSIX)
51    SIGSTOP = 0x13,
52    /// Keyboard stop (POSIX)
53    SIGTSTP = 0x14,
54    /// Background read from tty (POSIX)
55    SIGTTIN = 0x15,
56    /// Background write to tty (POSIX)
57    SIGTTOU = 0x16,
58    /// Urgent condition on socket (4.2 BSD)
59    SIGURG = 0x17,
60    /// CPU limit exceeded (4.2 BSD)
61    SIGXCPU = 0x18,
62    /// File size limit exceeded (4.2 BSD)
63    SIGXFSZ = 0x19,
64    /// Virtual alarm clock (4.2 BSD)
65    SIGVTALRM = 0x1a,
66    /// Profiling alarm clock (4.2 BSD)
67    SIGPROF = 0x1b,
68    /// Window size change (4.3 BSD, Sun)
69    SIGWINCH = 0x1c,
70    /// I/O now possible (4.2 BSD)
71    SIGIO = 0x1d,
72    /// Power failure restart (System V)
73    SIGPWR = 0x1e,
74    /// Bad system call
75    SIGSYS = 0x1f,
76    /// No exception, dump requested
77    DUMP_REQUESTED = 0xffffffff,
78}
79
80// These values come from asm-generic/siginfo.h
81#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)]
82#[repr(i32)]
83pub enum ExceptionCodeLinuxSicode {
84    SI_USER = 0,
85    SI_KERNEL = 0x80,
86    SI_QUEUE = -1i32,
87    SI_TIMER = -2i32,
88    SI_MESGQ = -3i32,
89    SI_ASYNCIO = -4i32,
90    SI_SIGIO = -5i32,
91    SI_TKILL = -6i32,
92    SI_DETHREAD = -7i32,
93    SI_ASYNCNL = -60i32,
94}
95
96#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)]
97pub enum ExceptionCodeLinuxSigillKind {
98    ILL_ILLOPC = 1,
99    ILL_ILLOPN = 2,
100    ILL_ILLADR = 3,
101    ILL_ILLTRP = 4,
102    ILL_PRVOPC = 5,
103    ILL_PRVREG = 6,
104    ILL_COPROC = 7,
105    ILL_BADSTK = 8,
106    ILL_BADIADDR = 9,
107}
108
109#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)]
110pub enum ExceptionCodeLinuxSigtrapKind {
111    TRAP_BRKPT = 1,
112    TRAP_TRACE = 2,
113    TRAP_BRANCH = 3,
114    TRAP_HWBKPT = 4,
115    TRAP_UNK = 5,
116    TRAP_PERF = 6,
117}
118
119#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)]
120pub enum ExceptionCodeLinuxSigfpeKind {
121    FPE_INTDIV = 1,
122    FPE_INTOVF = 2,
123    FPE_FLTDIV = 3,
124    FPE_FLTOVF = 4,
125    FPE_FLTUND = 5,
126    FPE_FLTRES = 6,
127    FPE_FLTINV = 7,
128    FPE_FLTSUB = 8,
129}
130
131#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)]
132pub enum ExceptionCodeLinuxSigsegvKind {
133    SEGV_MAPERR = 1,
134    SEGV_ACCERR = 2,
135    SEGV_BNDERR = 3,
136    SEGV_PKUERR = 4,
137}
138
139#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)]
140pub enum ExceptionCodeLinuxSigbusKind {
141    BUS_ADRALN = 1,
142    BUS_ADRERR = 2,
143    BUS_OBJERR = 3,
144    BUS_MCEERR_AR = 4,
145    BUS_MCEERR_AO = 5,
146}
147
148#[derive(Copy, Clone, PartialEq, Eq, Debug, FromPrimitive)]
149pub enum ExceptionCodeLinuxSigsysKind {
150    SYS_SECCOMP = 1,
151    SYS_USER_DISPATCH = 2,
152}