[Lldb-commits] [lldb] r202086 - Fixed the command line LLDB so that "CTRL+C" will interrupt a running process again.
Greg Clayton
gclayton at apple.com
Mon Feb 24 14:50:57 PST 2014
Author: gclayton
Date: Mon Feb 24 16:50:57 2014
New Revision: 202086
URL: http://llvm.org/viewvc/llvm-project?rev=202086&view=rev
Log:
Fixed the command line LLDB so that "CTRL+C" will interrupt a running process again.
Modified:
lldb/trunk/include/lldb/Core/IOHandler.h
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/IOHandler.cpp
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
lldb/trunk/source/Target/Process.cpp
Modified: lldb/trunk/include/lldb/Core/IOHandler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/IOHandler.h?rev=202086&r1=202085&r2=202086&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/IOHandler.h (original)
+++ lldb/trunk/include/lldb/Core/IOHandler.h Mon Feb 24 16:50:57 2014
@@ -63,6 +63,16 @@ namespace lldb_private {
virtual void
Refresh () = 0;
+ // Called when an input reader should relinquish its control so another
+ // can be pushed onto the IO handler stack, or so the current IO
+ // handler can pop itself off the stack
+
+ virtual void
+ Cancel () = 0;
+
+ // Called when CTRL+C is pressed which usually causes
+ // Debugger::DispatchInputInterrupt to be called.
+
virtual void
Interrupt () = 0;
@@ -395,6 +405,9 @@ namespace lldb_private {
Refresh ();
virtual void
+ Cancel ();
+
+ virtual void
Interrupt ();
virtual void
@@ -500,7 +513,10 @@ namespace lldb_private {
virtual void
Refresh ();
-
+
+ virtual void
+ Cancel ();
+
virtual void
Interrupt ();
Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=202086&r1=202085&r2=202086&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Mon Feb 24 16:50:57 2014
@@ -846,7 +846,7 @@ Debugger::ClearIOHandlers ()
{
m_input_reader_stack.Pop();
reader_sp->SetIsDone(true);
- reader_sp->Interrupt();
+ reader_sp->Cancel();
}
}
}
Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=202086&r1=202085&r2=202086&view=diff
==============================================================================
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Mon Feb 24 16:50:57 2014
@@ -588,6 +588,13 @@ IOHandlerEditline::Refresh ()
}
void
+IOHandlerEditline::Cancel ()
+{
+ if (m_editline_ap)
+ m_editline_ap->Interrupt ();
+}
+
+void
IOHandlerEditline::Interrupt ()
{
if (m_editline_ap)
@@ -5279,6 +5286,10 @@ IOHandlerCursesGUI::Refresh ()
{
}
+void
+IOHandlerCursesGUI::Cancel ()
+{
+}
void
IOHandlerCursesGUI::Interrupt ()
Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=202086&r1=202085&r2=202086&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Mon Feb 24 16:50:57 2014
@@ -781,7 +781,13 @@ public:
{
}
-
+
+ virtual void
+ Cancel ()
+ {
+
+ }
+
virtual void
Interrupt ()
{
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=202086&r1=202085&r2=202086&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Mon Feb 24 16:50:57 2014
@@ -4824,13 +4824,21 @@ public:
{
}
+
virtual void
- Interrupt ()
+ Cancel ()
{
size_t n = 1;
char ch = 'q';
m_pipe_write.Write (&ch, n);
}
+
+ virtual void
+ Interrupt ()
+ {
+ if (StateIsRunningState(m_process->GetState()))
+ m_process->Halt();
+ }
virtual void
GotEOF()
@@ -4859,7 +4867,7 @@ Process::CancelWatchForSTDIN (bool exite
{
if (exited)
m_process_input_reader->SetIsDone(true);
- m_process_input_reader->Interrupt();
+ m_process_input_reader->Cancel();
}
}
@@ -4903,7 +4911,7 @@ Process::PopProcessIOHandler ()
IOHandlerSP io_handler_sp (m_process_input_reader);
if (io_handler_sp)
{
- io_handler_sp->Interrupt();
+ io_handler_sp->Cancel();
m_target.GetDebugger().PopIOHandler (io_handler_sp);
}
}
More information about the lldb-commits
mailing list