1//===-- NetBSDSignals.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 "NetBSDSignals.h"
10
11#ifdef __NetBSD__
12#include <csignal>
13
14#define ADD_SIGCODE(signal_name, signal_value, code_name, code_value, ...) \
15 static_assert(signal_name == signal_value, \
16 "Value mismatch for signal number " #signal_name); \
17 static_assert(code_name == code_value, \
18 "Value mismatch for signal code " #code_name); \
19 AddSignalCode(signal_value, code_value, __VA_ARGS__)
20#else
21#define ADD_SIGCODE(signal_name, signal_value, code_name, code_value, ...) \
22 AddSignalCode(signal_value, code_value, __VA_ARGS__)
23#endif /* ifdef __NetBSD */
24
25using namespace lldb_private;
26
27NetBSDSignals::NetBSDSignals() : UnixSignals() { Reset(); }
28
29void NetBSDSignals::Reset() {
30 UnixSignals::Reset();
31
32 // clang-format off
33 // SIGILL
34 ADD_SIGCODE(SIGILL, 4, ILL_ILLOPC, 1, "illegal opcode");
35 ADD_SIGCODE(SIGILL, 4, ILL_ILLOPN, 2, "illegal operand");
36 ADD_SIGCODE(SIGILL, 4, ILL_ILLADR, 3, "illegal addressing mode");
37 ADD_SIGCODE(SIGILL, 4, ILL_ILLTRP, 4, "illegal trap");
38 ADD_SIGCODE(SIGILL, 4, ILL_PRVOPC, 5, "privileged opcode");
39 ADD_SIGCODE(SIGILL, 4, ILL_PRVREG, 6, "privileged register");
40 ADD_SIGCODE(SIGILL, 4, ILL_COPROC, 7, "coprocessor error");
41 ADD_SIGCODE(SIGILL, 4, ILL_BADSTK, 8, "internal stack error");
42
43 // SIGFPE
44 ADD_SIGCODE(SIGFPE, 8, FPE_INTDIV, 1, "integer divide by zero");
45 ADD_SIGCODE(SIGFPE, 8, FPE_INTOVF, 2, "integer overflow");
46 ADD_SIGCODE(SIGFPE, 8, FPE_FLTDIV, 3, "floating point divide by zero");
47 ADD_SIGCODE(SIGFPE, 8, FPE_FLTOVF, 4, "floating point overflow");
48 ADD_SIGCODE(SIGFPE, 8, FPE_FLTUND, 5, "floating point underflow");
49 ADD_SIGCODE(SIGFPE, 8, FPE_FLTRES, 6, "floating point inexact result");
50 ADD_SIGCODE(SIGFPE, 8, FPE_FLTINV, 7, "invalid floating point operation");
51 ADD_SIGCODE(SIGFPE, 8, FPE_FLTSUB, 8, "subscript out of range");
52
53 // SIGBUS
54 ADD_SIGCODE(SIGBUS, 10, BUS_ADRALN, 1, "invalid address alignment");
55 ADD_SIGCODE(SIGBUS, 10, BUS_ADRERR, 2, "non-existent physical address");
56 ADD_SIGCODE(SIGBUS, 10, BUS_OBJERR, 3, "object specific hardware error");
57
58 // SIGSEGV
59 ADD_SIGCODE(SIGSEGV, 11, SEGV_MAPERR, 1, "address not mapped to object",
60 SignalCodePrintOption::Address);
61 ADD_SIGCODE(SIGSEGV, 11, SEGV_ACCERR, 2, "invalid permissions for mapped object",
62 SignalCodePrintOption::Address);
63
64 // SIGNO NAME SUPPRESS STOP NOTIFY DESCRIPTION
65 // ===== ============== ======== ====== ====== ========================
66 AddSignal(signo: 32, name: "SIGPWR", default_suppress: false, default_stop: true, default_notify: true, description: "power fail/restart (not reset when caught)");
67 AddSignal(signo: 33, name: "SIGRTMIN", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 0");
68 AddSignal(signo: 34, name: "SIGRTMIN+1", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 1");
69 AddSignal(signo: 35, name: "SIGRTMIN+2", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 2");
70 AddSignal(signo: 36, name: "SIGRTMIN+3", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 3");
71 AddSignal(signo: 37, name: "SIGRTMIN+4", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 4");
72 AddSignal(signo: 38, name: "SIGRTMIN+5", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 5");
73 AddSignal(signo: 39, name: "SIGRTMIN+6", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 6");
74 AddSignal(signo: 40, name: "SIGRTMIN+7", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 7");
75 AddSignal(signo: 41, name: "SIGRTMIN+8", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 8");
76 AddSignal(signo: 42, name: "SIGRTMIN+9", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 9");
77 AddSignal(signo: 43, name: "SIGRTMIN+10", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 10");
78 AddSignal(signo: 44, name: "SIGRTMIN+11", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 11");
79 AddSignal(signo: 45, name: "SIGRTMIN+12", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 12");
80 AddSignal(signo: 46, name: "SIGRTMIN+13", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 13");
81 AddSignal(signo: 47, name: "SIGRTMIN+14", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 14");
82 AddSignal(signo: 48, name: "SIGRTMIN+15", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 15");
83 AddSignal(signo: 49, name: "SIGRTMIN-14", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 16");
84 AddSignal(signo: 50, name: "SIGRTMAX-13", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 17");
85 AddSignal(signo: 51, name: "SIGRTMAX-12", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 18");
86 AddSignal(signo: 52, name: "SIGRTMAX-11", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 19");
87 AddSignal(signo: 53, name: "SIGRTMAX-10", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 20");
88 AddSignal(signo: 54, name: "SIGRTMAX-9", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 21");
89 AddSignal(signo: 55, name: "SIGRTMAX-8", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 22");
90 AddSignal(signo: 56, name: "SIGRTMAX-7", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 23");
91 AddSignal(signo: 57, name: "SIGRTMAX-6", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 24");
92 AddSignal(signo: 58, name: "SIGRTMAX-5", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 25");
93 AddSignal(signo: 59, name: "SIGRTMAX-4", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 26");
94 AddSignal(signo: 60, name: "SIGRTMAX-3", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 27");
95 AddSignal(signo: 61, name: "SIGRTMAX-2", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 28");
96 AddSignal(signo: 62, name: "SIGRTMAX-1", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 29");
97 AddSignal(signo: 63, name: "SIGRTMAX", default_suppress: false, default_stop: false, default_notify: false, description: "real time signal 30");
98 // clang-format on
99}
100

source code of lldb/source/Plugins/Process/Utility/NetBSDSignals.cpp