21 bool default_stop,
bool default_notify,
22 const char *description,
const char *alias)
23 : m_name(name), m_alias(alias), m_description(),
24 m_suppress(default_suppress), m_stop(default_stop),
25 m_notify(default_notify),
26 m_default_suppress(default_suppress), m_default_stop(default_stop),
27 m_default_notify(default_notify) {
34 switch (triple.getOS()) {
35 case llvm::Triple::Linux: {
36 switch (triple.getArch()) {
37 case llvm::Triple::mips:
38 case llvm::Triple::mipsel:
39 case llvm::Triple::mips64:
40 case llvm::Triple::mips64el:
41 return std::make_shared<MipsLinuxSignals>();
43 return std::make_shared<LinuxSignals>();
46 case llvm::Triple::FreeBSD:
47 case llvm::Triple::OpenBSD:
48 return std::make_shared<FreeBSDSignals>();
49 case llvm::Triple::NetBSD:
50 return std::make_shared<NetBSDSignals>();
52 return std::make_shared<UnixSignals>();
57 static lldb::UnixSignalsSP s_unix_signals_sp =
58 Create(HostInfo::GetArchitecture());
59 return s_unix_signals_sp;
81 AddSignal(1,
"SIGHUP",
false,
true,
true,
"hangup");
82 AddSignal(2,
"SIGINT",
true,
true,
true,
"interrupt");
83 AddSignal(3,
"SIGQUIT",
false,
true,
true,
"quit");
84 AddSignal(4,
"SIGILL",
false,
true,
true,
"illegal instruction");
85 AddSignal(5,
"SIGTRAP",
true,
true,
true,
"trace trap (not reset when caught)");
86 AddSignal(6,
"SIGABRT",
false,
true,
true,
"abort()");
87 AddSignal(7,
"SIGEMT",
false,
true,
true,
"pollable event");
88 AddSignal(8,
"SIGFPE",
false,
true,
true,
"floating point exception");
89 AddSignal(9,
"SIGKILL",
false,
true,
true,
"kill");
90 AddSignal(10,
"SIGBUS",
false,
true,
true,
"bus error");
91 AddSignal(11,
"SIGSEGV",
false,
true,
true,
"segmentation violation");
92 AddSignal(12,
"SIGSYS",
false,
true,
true,
"bad argument to system call");
93 AddSignal(13,
"SIGPIPE",
false,
false,
false,
"write on a pipe with no one to read it");
94 AddSignal(14,
"SIGALRM",
false,
false,
false,
"alarm clock");
95 AddSignal(15,
"SIGTERM",
false,
true,
true,
"software termination signal from kill");
96 AddSignal(16,
"SIGURG",
false,
false,
false,
"urgent condition on IO channel");
97 AddSignal(17,
"SIGSTOP",
true,
true,
true,
"sendable stop signal not from tty");
98 AddSignal(18,
"SIGTSTP",
false,
true,
true,
"stop signal from tty");
99 AddSignal(19,
"SIGCONT",
false,
false,
true,
"continue a stopped process");
100 AddSignal(20,
"SIGCHLD",
false,
false,
false,
"to parent on child stop or exit");
101 AddSignal(21,
"SIGTTIN",
false,
true,
true,
"to readers process group upon background tty read");
102 AddSignal(22,
"SIGTTOU",
false,
true,
true,
"to readers process group upon background tty write");
103 AddSignal(23,
"SIGIO",
false,
false,
false,
"input/output possible signal");
104 AddSignal(24,
"SIGXCPU",
false,
true,
true,
"exceeded CPU time limit");
105 AddSignal(25,
"SIGXFSZ",
false,
true,
true,
"exceeded file size limit");
106 AddSignal(26,
"SIGVTALRM",
false,
false,
false,
"virtual time alarm");
107 AddSignal(27,
"SIGPROF",
false,
false,
false,
"profiling time alarm");
108 AddSignal(28,
"SIGWINCH",
false,
false,
false,
"window size changes");
109 AddSignal(29,
"SIGINFO",
false,
true,
true,
"information request");
110 AddSignal(30,
"SIGUSR1",
false,
true,
true,
"user defined signal 1");
111 AddSignal(31,
"SIGUSR2",
false,
true,
true,
"user defined signal 2");
116 bool default_stop,
bool default_notify,
117 const char *description,
const char *alias) {
118 Signal new_signal(name, default_suppress, default_stop, default_notify,
120 m_signals.insert(std::make_pair(signo, new_signal));
125 collection::iterator pos =
m_signals.find(signo);
132 collection::const_iterator pos =
m_signals.find(signo);
136 return pos->second.m_name.GetCString();
152 collection::const_iterator pos, end =
m_signals.end();
153 for (pos =
m_signals.begin(); pos != end; pos++) {
154 if ((const_name == pos->second.m_name) ||
155 (const_name == pos->second.m_alias) ||
162 if (llvm::to_integer(name, signo))
175 collection::const_iterator pos =
m_signals.find(current_signal);
176 collection::const_iterator end =
m_signals.end();
190 bool &should_notify)
const {
191 collection::const_iterator pos =
m_signals.find(signo);
195 const Signal &signal = pos->second;
197 should_stop = signal.
m_stop;
204 collection::const_iterator pos =
m_signals.find(signo);
206 return pos->second.m_suppress;
211 collection::iterator pos =
m_signals.find(signo);
213 pos->second.m_suppress = value;
228 collection::const_iterator pos =
m_signals.find(signo);
230 return pos->second.m_stop;
235 collection::iterator pos =
m_signals.find(signo);
237 pos->second.m_stop = value;
252 collection::const_iterator pos =
m_signals.find(signo);
254 return pos->second.m_notify;
259 collection::iterator pos =
m_signals.find(signo);
261 pos->second.m_notify = value;
278 if (index < 0 ||
m_signals.size() <=
static_cast<size_t>(index))
281 std::advance(it, index);
289 llvm::Optional<bool> should_stop,
290 llvm::Optional<bool> should_notify) {
291 std::vector<int32_t> result;
296 bool signal_suppress =
false;
297 bool signal_stop =
false;
298 bool signal_notify =
false;
299 GetSignalInfo(signo, signal_suppress, signal_stop, signal_notify);
303 if (should_suppress &&
304 signal_suppress != should_suppress.getValue())
307 if (should_stop && signal_stop != should_stop.getValue())
310 if (should_notify && signal_notify != should_notify.getValue())
313 result.push_back(signo);
320 collection::iterator pos =
m_signals.find(signo);
322 pos->second.m_hit_count += 1;
326 json::Array json_signals;
328 if (pair.second.m_hit_count > 0)
329 json_signals.emplace_back(json::Object{
330 { pair.second.m_name.GetCString(), pair.second.m_hit_count }
333 return std::move(json_signals);
337 bool reset_suppress) {
347 bool reset_notify,
bool reset_suppress) {
351 (*elem).second.Reset(reset_stop, reset_notify, reset_suppress);