summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHafiz Abid Qadeer <hafiz_abid@mentor.com>2015-02-03 11:20:00 +0000
committerHafiz Abid Qadeer <hafiz_abid@mentor.com>2015-02-03 11:20:00 +0000
commit9a0d572750e17a6791b87f2e0c186dd743066a8e (patch)
treea677dd9aa17b65a7c36d6f44227d3a69320a2b3b
parent6b4499a393ac29334a0897338bb33bee9f78cd00 (diff)
downloadbcm5719-llvm-9a0d572750e17a6791b87f2e0c186dd743066a8e.tar.gz
bcm5719-llvm-9a0d572750e17a6791b87f2e0c186dd743066a8e.zip
Restore the signal handler for Windows as it is not presistent there.
On windows, signal handler is reset to default once a signal is received. This causes doing ctrl-c twice on console (or pressing suspend button twice in eclipse ide which uses SIGINT to stop the debuggee) to crash lldb-mi on windows. Although there is very tiny window (after signal handler is called and before we restore the handler) where default handler will be in place. But this is hardly a problem in practice as IDEs generally disable their suspend button once it has been presses. llvm-svn: 227964
-rw-r--r--lldb/tools/lldb-mi/MIDriverMain.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lldb/tools/lldb-mi/MIDriverMain.cpp b/lldb/tools/lldb-mi/MIDriverMain.cpp
index 526cb0c57e6..5557799d368 100644
--- a/lldb/tools/lldb-mi/MIDriverMain.cpp
+++ b/lldb/tools/lldb-mi/MIDriverMain.cpp
@@ -81,6 +81,9 @@
void
sigwinch_handler(int vSigno)
{
+#ifdef _WIN32 // Restore handler as it is not persistent on Windows
+ signal(SIGWINCH, sigwinch_handler);
+#endif
MIunused(vSigno);
struct winsize window_size;
@@ -111,6 +114,9 @@ sigwinch_handler(int vSigno)
void
sigint_handler(int vSigno)
{
+#ifdef _WIN32 // Restore handler as it is not persistent on Windows
+ signal(SIGINT, sigint_handler);
+#endif
static bool g_interrupt_sent = false;
CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
lldb::SBDebugger *pDebugger = rDriverMgr.DriverGetTheDebugger();
@@ -147,6 +153,9 @@ sigint_handler(int vSigno)
void
sigtstp_handler(int vSigno)
{
+#ifdef _WIN32 // Restore handler as it is not persistent on Windows
+ signal(SIGTSTP, sigtstp_handler);
+#endif
CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
lldb::SBDebugger *pDebugger = rDriverMgr.DriverGetTheDebugger();
if (pDebugger != nullptr)
@@ -175,6 +184,9 @@ sigtstp_handler(int vSigno)
void
sigcont_handler(int vSigno)
{
+#ifdef _WIN32 // Restore handler as it is not persistent on Windows
+ signal(SIGCONT, sigcont_handler);
+#endif
CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
lldb::SBDebugger *pDebugger = rDriverMgr.DriverGetTheDebugger();
if (pDebugger != nullptr)
OpenPOWER on IntegriCloud