summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Linux/LinuxSignals.cpp
diff options
context:
space:
mode:
authorStephen Wilson <wilsons@start.ca>2011-03-30 15:55:52 +0000
committerStephen Wilson <wilsons@start.ca>2011-03-30 15:55:52 +0000
commit84ffe7033c41fd3501eab22632cab93d7df7b1a9 (patch)
tree24cc9529cf897be63fa3db393e0441e53d6914b9 /lldb/source/Plugins/Process/Linux/LinuxSignals.cpp
parent8564e0de96d18eba9d8501611591c7c3ef9d8be3 (diff)
downloadbcm5719-llvm-84ffe7033c41fd3501eab22632cab93d7df7b1a9.tar.gz
bcm5719-llvm-84ffe7033c41fd3501eab22632cab93d7df7b1a9.zip
linux: initial support for 'real' signal handling
This patch upgrades the Linux process plugin to handle a larger range of signal events. For example, we can detect when the inferior has "crashed" and why, interrupt a running process, deliver an arbitrary signal, and so on. llvm-svn: 128547
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/LinuxSignals.cpp')
-rw-r--r--lldb/source/Plugins/Process/Linux/LinuxSignals.cpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/Linux/LinuxSignals.cpp b/lldb/source/Plugins/Process/Linux/LinuxSignals.cpp
new file mode 100644
index 00000000000..0a6c34cfbc6
--- /dev/null
+++ b/lldb/source/Plugins/Process/Linux/LinuxSignals.cpp
@@ -0,0 +1,67 @@
+//===-- LinuxSignals.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// C Includes
+#include <signal.h>
+
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "LinuxSignals.h"
+
+LinuxSignals::LinuxSignals()
+ : UnixSignals()
+{
+ Reset();
+}
+
+void
+LinuxSignals::Reset()
+{
+ m_signals.clear();
+
+#define ADDSIGNAL(S, SUPPRESS, STOP, NOTIFY, DESCRIPTION) \
+ AddSignal(SIG ## S, "SIG" #S, #S, SUPPRESS, STOP, NOTIFY, DESCRIPTION)
+
+ ADDSIGNAL(HUP, false, true, true, "hangup");
+ ADDSIGNAL(INT, true, true, true, "interrupt");
+ ADDSIGNAL(QUIT, false, true, true, "quit");
+ ADDSIGNAL(ILL, false, true, true, "illegal instruction");
+ ADDSIGNAL(TRAP, true, true, true, "trace trap (not reset when caught)");
+ ADDSIGNAL(ABRT, false, true, true, "abort");
+ ADDSIGNAL(IOT, false, true, true, "abort");
+ ADDSIGNAL(BUS, false, true, true, "bus error");
+ ADDSIGNAL(FPE, false, true, true, "floating point exception");
+ ADDSIGNAL(KILL, false, true, true, "kill");
+ ADDSIGNAL(USR1, false, true, true, "user defined signal 1");
+ ADDSIGNAL(SEGV, false, true, true, "segmentation violation");
+ ADDSIGNAL(USR2, false, true, true, "user defined signal 2");
+ ADDSIGNAL(PIPE, false, true, true, "write to pipe with reading end closed");
+ ADDSIGNAL(ALRM, false, false, true, "alarm");
+ ADDSIGNAL(TERM, false, true, true, "termination requested");
+ ADDSIGNAL(STKFLT, false, true, true, "stack fault");
+ ADDSIGNAL(CHLD, false, false, true, "child process exit");
+ ADDSIGNAL(CONT, false, true, true, "process continue");
+ ADDSIGNAL(STOP, false, true, true, "process stop");
+ ADDSIGNAL(TSTP, false, true, true, "tty stop");
+ ADDSIGNAL(TTIN, false, true, true, "background tty read");
+ ADDSIGNAL(TTOU, false, true, true, "background tty write");
+ ADDSIGNAL(URG, false, true, true, "urgent data on socket");
+ ADDSIGNAL(XCPU, false, true, true, "CPU resource exceeded");
+ ADDSIGNAL(XFSZ, false, true, true, "file size limit exceeded");
+ ADDSIGNAL(VTALRM, false, true, true, "virtual alarm");
+ ADDSIGNAL(PROF, false, true, true, "profiling alarm");
+ ADDSIGNAL(WINCH, false, true, true, "window size change");
+ ADDSIGNAL(POLL, false, true, true, "pollable event");
+ ADDSIGNAL(IO, false, true, true, "input/output ready");
+ ADDSIGNAL(PWR, false, true, true, "power failure");
+ ADDSIGNAL(SYS, false, true, true, "invalid system call");
+
+#undef ADDSIGNAL
+}
OpenPOWER on IntegriCloud