LLDB mainline
FreeBSDSignals.cpp
Go to the documentation of this file.
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
29using namespace lldb_private;
30
32
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",
67 ADD_SIGCODE(SIGSEGV, 11, SEGV_ACCERR, 2, "invalid permissions for mapped object",
69 ADD_SIGCODE(SIGSEGV, 11, SEGV_PKUERR, 100, "PKU violation",
71
72 // SIGNO NAME SUPPRESS STOP NOTIFY DESCRIPTION
73 // ===== ============== ======== ====== ====== ========================
74 AddSignal(32, "SIGTHR", false, false, false, "thread interrupt");
75 AddSignal(33, "SIGLIBRT", false, false, false, "reserved by real-time library");
76 AddSignal(65, "SIGRTMIN", false, false, false, "real time signal 0");
77 AddSignal(66, "SIGRTMIN+1", false, false, false, "real time signal 1");
78 AddSignal(67, "SIGRTMIN+2", false, false, false, "real time signal 2");
79 AddSignal(68, "SIGRTMIN+3", false, false, false, "real time signal 3");
80 AddSignal(69, "SIGRTMIN+4", false, false, false, "real time signal 4");
81 AddSignal(70, "SIGRTMIN+5", false, false, false, "real time signal 5");
82 AddSignal(71, "SIGRTMIN+6", false, false, false, "real time signal 6");
83 AddSignal(72, "SIGRTMIN+7", false, false, false, "real time signal 7");
84 AddSignal(73, "SIGRTMIN+8", false, false, false, "real time signal 8");
85 AddSignal(74, "SIGRTMIN+9", false, false, false, "real time signal 9");
86 AddSignal(75, "SIGRTMIN+10", false, false, false, "real time signal 10");
87 AddSignal(76, "SIGRTMIN+11", false, false, false, "real time signal 11");
88 AddSignal(77, "SIGRTMIN+12", false, false, false, "real time signal 12");
89 AddSignal(78, "SIGRTMIN+13", false, false, false, "real time signal 13");
90 AddSignal(79, "SIGRTMIN+14", false, false, false, "real time signal 14");
91 AddSignal(80, "SIGRTMIN+15", false, false, false, "real time signal 15");
92 AddSignal(81, "SIGRTMIN+16", false, false, false, "real time signal 16");
93 AddSignal(82, "SIGRTMIN+17", false, false, false, "real time signal 17");
94 AddSignal(83, "SIGRTMIN+18", false, false, false, "real time signal 18");
95 AddSignal(84, "SIGRTMIN+19", false, false, false, "real time signal 19");
96 AddSignal(85, "SIGRTMIN+20", false, false, false, "real time signal 20");
97 AddSignal(86, "SIGRTMIN+21", false, false, false, "real time signal 21");
98 AddSignal(87, "SIGRTMIN+22", false, false, false, "real time signal 22");
99 AddSignal(88, "SIGRTMIN+23", false, false, false, "real time signal 23");
100 AddSignal(89, "SIGRTMIN+24", false, false, false, "real time signal 24");
101 AddSignal(90, "SIGRTMIN+25", false, false, false, "real time signal 25");
102 AddSignal(91, "SIGRTMIN+26", false, false, false, "real time signal 26");
103 AddSignal(92, "SIGRTMIN+27", false, false, false, "real time signal 27");
104 AddSignal(93, "SIGRTMIN+28", false, false, false, "real time signal 28");
105 AddSignal(94, "SIGRTMIN+29", false, false, false, "real time signal 29");
106 AddSignal(95, "SIGRTMIN+30", false, false, false, "real time signal 30");
107 AddSignal(96, "SIGRTMAX-30", false, false, false, "real time signal 31");
108 AddSignal(97, "SIGRTMAX-29", false, false, false, "real time signal 32");
109 AddSignal(98, "SIGRTMAX-28", false, false, false, "real time signal 33");
110 AddSignal(99, "SIGRTMAX-27", false, false, false, "real time signal 34");
111 AddSignal(100, "SIGRTMAX-26", false, false, false, "real time signal 35");
112 AddSignal(101, "SIGRTMAX-25", false, false, false, "real time signal 36");
113 AddSignal(102, "SIGRTMAX-24", false, false, false, "real time signal 37");
114 AddSignal(103, "SIGRTMAX-23", false, false, false, "real time signal 38");
115 AddSignal(104, "SIGRTMAX-22", false, false, false, "real time signal 39");
116 AddSignal(105, "SIGRTMAX-21", false, false, false, "real time signal 40");
117 AddSignal(106, "SIGRTMAX-20", false, false, false, "real time signal 41");
118 AddSignal(107, "SIGRTMAX-19", false, false, false, "real time signal 42");
119 AddSignal(108, "SIGRTMAX-18", false, false, false, "real time signal 43");
120 AddSignal(109, "SIGRTMAX-17", false, false, false, "real time signal 44");
121 AddSignal(110, "SIGRTMAX-16", false, false, false, "real time signal 45");
122 AddSignal(111, "SIGRTMAX-15", false, false, false, "real time signal 46");
123 AddSignal(112, "SIGRTMAX-14", false, false, false, "real time signal 47");
124 AddSignal(113, "SIGRTMAX-13", false, false, false, "real time signal 48");
125 AddSignal(114, "SIGRTMAX-12", false, false, false, "real time signal 49");
126 AddSignal(115, "SIGRTMAX-11", false, false, false, "real time signal 50");
127 AddSignal(116, "SIGRTMAX-10", false, false, false, "real time signal 51");
128 AddSignal(117, "SIGRTMAX-9", false, false, false, "real time signal 52");
129 AddSignal(118, "SIGRTMAX-8", false, false, false, "real time signal 53");
130 AddSignal(119, "SIGRTMAX-7", false, false, false, "real time signal 54");
131 AddSignal(120, "SIGRTMAX-6", false, false, false, "real time signal 55");
132 AddSignal(121, "SIGRTMAX-5", false, false, false, "real time signal 56");
133 AddSignal(122, "SIGRTMAX-4", false, false, false, "real time signal 57");
134 AddSignal(123, "SIGRTMAX-3", false, false, false, "real time signal 58");
135 AddSignal(124, "SIGRTMAX-2", false, false, false, "real time signal 59");
136 AddSignal(125, "SIGRTMAX-1", false, false, false, "real time signal 60");
137 AddSignal(126, "SIGRTMAX", false, false, false, "real time signal 61");
138 // clang-format on
139}
#define ADD_SIGCODE(signal_name, signal_value, code_name, code_value,...)
void AddSignal(int signo, llvm::StringRef name, bool default_suppress, bool default_stop, bool default_notify, llvm::StringRef description, llvm::StringRef alias=llvm::StringRef())
A class that represents a running process on the host machine.