[Lldb-commits] [lldb] r227964 - Restore the signal handler for Windows as it is not presistent there.
Hafiz Abid Qadeer
hafiz_abid at mentor.com
Tue Feb 3 03:20:01 PST 2015
Author: abidh
Date: Tue Feb 3 05:20:00 2015
New Revision: 227964
URL: http://llvm.org/viewvc/llvm-project?rev=227964&view=rev
Log:
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.
Modified:
lldb/trunk/tools/lldb-mi/MIDriverMain.cpp
Modified: lldb/trunk/tools/lldb-mi/MIDriverMain.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriverMain.cpp?rev=227964&r1=227963&r2=227964&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriverMain.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIDriverMain.cpp Tue Feb 3 05:20:00 2015
@@ -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)
More information about the lldb-commits
mailing list