summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2014-02-24 22:50:57 +0000
committerGreg Clayton <gclayton@apple.com>2014-02-24 22:50:57 +0000
commite68f5d6b69f5328ec16178740abb39975d6b3224 (patch)
tree4082c39ae76f6264aa72730ff2210e3c91be8911
parent301bafed782050edb8b4b7096f7b923953c26212 (diff)
downloadbcm5719-llvm-e68f5d6b69f5328ec16178740abb39975d6b3224.tar.gz
bcm5719-llvm-e68f5d6b69f5328ec16178740abb39975d6b3224.zip
Fixed the command line LLDB so that "CTRL+C" will interrupt a running process again.
llvm-svn: 202086
-rw-r--r--lldb/include/lldb/Core/IOHandler.h18
-rw-r--r--lldb/source/Core/Debugger.cpp2
-rw-r--r--lldb/source/Core/IOHandler.cpp11
-rw-r--r--lldb/source/Interpreter/ScriptInterpreterPython.cpp8
-rw-r--r--lldb/source/Target/Process.cpp14
5 files changed, 47 insertions, 6 deletions
diff --git a/lldb/include/lldb/Core/IOHandler.h b/lldb/include/lldb/Core/IOHandler.h
index a7d4880da0d..78d1e7447db 100644
--- a/lldb/include/lldb/Core/IOHandler.h
+++ b/lldb/include/lldb/Core/IOHandler.h
@@ -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 ();
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 5b346ed636d..34e0e329f09 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -846,7 +846,7 @@ Debugger::ClearIOHandlers ()
{
m_input_reader_stack.Pop();
reader_sp->SetIsDone(true);
- reader_sp->Interrupt();
+ reader_sp->Cancel();
}
}
}
diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp
index bdec19ccb06..168a8f67a08 100644
--- a/lldb/source/Core/IOHandler.cpp
+++ b/lldb/source/Core/IOHandler.cpp
@@ -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 ()
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
index 389355d9bf9..c1d28e88afc 100644
--- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
@@ -781,7 +781,13 @@ public:
{
}
-
+
+ virtual void
+ Cancel ()
+ {
+
+ }
+
virtual void
Interrupt ()
{
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 40d3e4950c6..931a068243c 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -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 exited)
{
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);
}
}
OpenPOWER on IntegriCloud