1 | //===-- FreeBSDSignals.cpp ------------------------------------------------===// |
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 | #include "FreeBSDSignals.h" |
10 | |
11 | #ifdef __FreeBSD__ |
12 | #include <csignal> |
13 | |
14 | #ifndef FPE_FLTIDO |
15 | #define FPE_FLTIDO 9 |
16 | #endif |
17 | |
18 | #define ADD_SIGCODE(signal_name, signal_value, code_name, code_value, ...) \ |
19 | static_assert(signal_name == signal_value, \ |
20 | "Value mismatch for signal number " #signal_name); \ |
21 | static_assert(code_name == code_value, \ |
22 | "Value mismatch for signal code " #code_name); \ |
23 | AddSignalCode(signal_value, code_value, __VA_ARGS__) |
24 | #else |
25 | #define ADD_SIGCODE(signal_name, signal_value, code_name, code_value, ...) \ |
26 | AddSignalCode(signal_value, code_value, __VA_ARGS__) |
27 | #endif /* ifdef __FreeBSD */ |
28 | |
29 | using namespace lldb_private; |
30 | |
31 | FreeBSDSignals::FreeBSDSignals() : UnixSignals() { Reset(); } |
32 | |
33 | void FreeBSDSignals::Reset() { |
34 | UnixSignals::Reset(); |
35 | |
36 | // clang-format off |
37 | // SIGILL |
38 | ADD_SIGCODE(SIGILL, 4, ILL_ILLOPC, 1, "illegal opcode" ); |
39 | ADD_SIGCODE(SIGILL, 4, ILL_ILLOPN, 2, "illegal operand" ); |
40 | ADD_SIGCODE(SIGILL, 4, ILL_ILLADR, 3, "illegal addressing mode" ); |
41 | ADD_SIGCODE(SIGILL, 4, ILL_ILLTRP, 4, "illegal trap" ); |
42 | ADD_SIGCODE(SIGILL, 4, ILL_PRVOPC, 5, "privileged opcode" ); |
43 | ADD_SIGCODE(SIGILL, 4, ILL_PRVREG, 6, "privileged register" ); |
44 | ADD_SIGCODE(SIGILL, 4, ILL_COPROC, 7, "coprocessor error" ); |
45 | ADD_SIGCODE(SIGILL, 4, ILL_BADSTK, 8, "internal stack error" ); |
46 | |
47 | // SIGFPE |
48 | ADD_SIGCODE(SIGFPE, 8, FPE_INTOVF, 1, "integer overflow" ); |
49 | ADD_SIGCODE(SIGFPE, 8, FPE_INTDIV, 2, "integer divide by zero" ); |
50 | ADD_SIGCODE(SIGFPE, 8, FPE_FLTDIV, 3, "floating point divide by zero" ); |
51 | ADD_SIGCODE(SIGFPE, 8, FPE_FLTOVF, 4, "floating point overflow" ); |
52 | ADD_SIGCODE(SIGFPE, 8, FPE_FLTUND, 5, "floating point underflow" ); |
53 | ADD_SIGCODE(SIGFPE, 8, FPE_FLTRES, 6, "floating point inexact result" ); |
54 | ADD_SIGCODE(SIGFPE, 8, FPE_FLTINV, 7, "invalid floating point operation" ); |
55 | ADD_SIGCODE(SIGFPE, 8, FPE_FLTSUB, 8, "subscript out of range" ); |
56 | ADD_SIGCODE(SIGFPE, 8, FPE_FLTIDO, 9, "input denormal operation" ); |
57 | |
58 | // SIGBUS |
59 | ADD_SIGCODE(SIGBUS, 10, BUS_ADRALN, 1, "invalid address alignment" ); |
60 | ADD_SIGCODE(SIGBUS, 10, BUS_ADRERR, 2, "nonexistent physical address" ); |
61 | ADD_SIGCODE(SIGBUS, 10, BUS_OBJERR, 3, "object-specific hardware error" ); |
62 | ADD_SIGCODE(SIGBUS, 10, BUS_OOMERR, 100, "no memory" ); |
63 | |
64 | // SIGSEGV |
65 | ADD_SIGCODE(SIGSEGV, 11, SEGV_MAPERR, 1, "address not mapped to object" , |
66 | SignalCodePrintOption::Address); |
67 | ADD_SIGCODE(SIGSEGV, 11, SEGV_ACCERR, 2, "invalid permissions for mapped object" , |
68 | SignalCodePrintOption::Address); |
69 | ADD_SIGCODE(SIGSEGV, 11, SEGV_PKUERR, 100, "PKU violation" , |
70 | SignalCodePrintOption::Address); |
71 | |
72 | // SIGNO NAME SUPPRESS STOP NOTIFY DESCRIPTION |
73 | // ===== ============== ======== ====== ====== ======================== |
74 | AddSignal(signo: 32, name: "SIGTHR" , default_suppress: false, default_stop: false, default_notify: false, description: "thread interrupt" ); |
75 | AddSignal(signo: 33, name: "SIGLIBRT" , default_suppress: false, default_stop: false, default_notify: false, description: "reserved by real-time library" ); |
76 | AddSignal(signo: 65, name: "SIGRTMIN" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 0" ); |
77 | AddSignal(signo: 66, name: "SIGRTMIN+1" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 1" ); |
78 | AddSignal(signo: 67, name: "SIGRTMIN+2" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 2" ); |
79 | AddSignal(signo: 68, name: "SIGRTMIN+3" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 3" ); |
80 | AddSignal(signo: 69, name: "SIGRTMIN+4" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 4" ); |
81 | AddSignal(signo: 70, name: "SIGRTMIN+5" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 5" ); |
82 | AddSignal(signo: 71, name: "SIGRTMIN+6" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 6" ); |
83 | AddSignal(signo: 72, name: "SIGRTMIN+7" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 7" ); |
84 | AddSignal(signo: 73, name: "SIGRTMIN+8" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 8" ); |
85 | AddSignal(signo: 74, name: "SIGRTMIN+9" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 9" ); |
86 | AddSignal(signo: 75, name: "SIGRTMIN+10" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 10" ); |
87 | AddSignal(signo: 76, name: "SIGRTMIN+11" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 11" ); |
88 | AddSignal(signo: 77, name: "SIGRTMIN+12" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 12" ); |
89 | AddSignal(signo: 78, name: "SIGRTMIN+13" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 13" ); |
90 | AddSignal(signo: 79, name: "SIGRTMIN+14" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 14" ); |
91 | AddSignal(signo: 80, name: "SIGRTMIN+15" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 15" ); |
92 | AddSignal(signo: 81, name: "SIGRTMIN+16" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 16" ); |
93 | AddSignal(signo: 82, name: "SIGRTMIN+17" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 17" ); |
94 | AddSignal(signo: 83, name: "SIGRTMIN+18" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 18" ); |
95 | AddSignal(signo: 84, name: "SIGRTMIN+19" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 19" ); |
96 | AddSignal(signo: 85, name: "SIGRTMIN+20" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 20" ); |
97 | AddSignal(signo: 86, name: "SIGRTMIN+21" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 21" ); |
98 | AddSignal(signo: 87, name: "SIGRTMIN+22" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 22" ); |
99 | AddSignal(signo: 88, name: "SIGRTMIN+23" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 23" ); |
100 | AddSignal(signo: 89, name: "SIGRTMIN+24" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 24" ); |
101 | AddSignal(signo: 90, name: "SIGRTMIN+25" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 25" ); |
102 | AddSignal(signo: 91, name: "SIGRTMIN+26" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 26" ); |
103 | AddSignal(signo: 92, name: "SIGRTMIN+27" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 27" ); |
104 | AddSignal(signo: 93, name: "SIGRTMIN+28" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 28" ); |
105 | AddSignal(signo: 94, name: "SIGRTMIN+29" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 29" ); |
106 | AddSignal(signo: 95, name: "SIGRTMIN+30" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 30" ); |
107 | AddSignal(signo: 96, name: "SIGRTMAX-30" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 31" ); |
108 | AddSignal(signo: 97, name: "SIGRTMAX-29" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 32" ); |
109 | AddSignal(signo: 98, name: "SIGRTMAX-28" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 33" ); |
110 | AddSignal(signo: 99, name: "SIGRTMAX-27" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 34" ); |
111 | AddSignal(signo: 100, name: "SIGRTMAX-26" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 35" ); |
112 | AddSignal(signo: 101, name: "SIGRTMAX-25" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 36" ); |
113 | AddSignal(signo: 102, name: "SIGRTMAX-24" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 37" ); |
114 | AddSignal(signo: 103, name: "SIGRTMAX-23" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 38" ); |
115 | AddSignal(signo: 104, name: "SIGRTMAX-22" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 39" ); |
116 | AddSignal(signo: 105, name: "SIGRTMAX-21" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 40" ); |
117 | AddSignal(signo: 106, name: "SIGRTMAX-20" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 41" ); |
118 | AddSignal(signo: 107, name: "SIGRTMAX-19" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 42" ); |
119 | AddSignal(signo: 108, name: "SIGRTMAX-18" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 43" ); |
120 | AddSignal(signo: 109, name: "SIGRTMAX-17" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 44" ); |
121 | AddSignal(signo: 110, name: "SIGRTMAX-16" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 45" ); |
122 | AddSignal(signo: 111, name: "SIGRTMAX-15" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 46" ); |
123 | AddSignal(signo: 112, name: "SIGRTMAX-14" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 47" ); |
124 | AddSignal(signo: 113, name: "SIGRTMAX-13" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 48" ); |
125 | AddSignal(signo: 114, name: "SIGRTMAX-12" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 49" ); |
126 | AddSignal(signo: 115, name: "SIGRTMAX-11" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 50" ); |
127 | AddSignal(signo: 116, name: "SIGRTMAX-10" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 51" ); |
128 | AddSignal(signo: 117, name: "SIGRTMAX-9" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 52" ); |
129 | AddSignal(signo: 118, name: "SIGRTMAX-8" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 53" ); |
130 | AddSignal(signo: 119, name: "SIGRTMAX-7" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 54" ); |
131 | AddSignal(signo: 120, name: "SIGRTMAX-6" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 55" ); |
132 | AddSignal(signo: 121, name: "SIGRTMAX-5" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 56" ); |
133 | AddSignal(signo: 122, name: "SIGRTMAX-4" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 57" ); |
134 | AddSignal(signo: 123, name: "SIGRTMAX-3" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 58" ); |
135 | AddSignal(signo: 124, name: "SIGRTMAX-2" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 59" ); |
136 | AddSignal(signo: 125, name: "SIGRTMAX-1" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 60" ); |
137 | AddSignal(signo: 126, name: "SIGRTMAX" , default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 61" ); |
138 | // clang-format on |
139 | } |
140 | |