Fixed the command line LLDB so that "CTRL+C" will interrupt a running process again.

llvm-svn: 202086
This commit is contained in:
Greg Clayton 2014-02-24 22:50:57 +00:00
parent 301bafed78
commit e68f5d6b69
5 changed files with 47 additions and 6 deletions

View File

@ -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;
@ -394,6 +404,9 @@ namespace lldb_private {
virtual void
Refresh ();
virtual void
Cancel ();
virtual void
Interrupt ();
@ -501,6 +514,9 @@ namespace lldb_private {
virtual void
Refresh ();
virtual void
Cancel ();
virtual void
Interrupt ();

View File

@ -846,7 +846,7 @@ Debugger::ClearIOHandlers ()
{
m_input_reader_stack.Pop();
reader_sp->SetIsDone(true);
reader_sp->Interrupt();
reader_sp->Cancel();
}
}
}

View File

@ -587,6 +587,13 @@ IOHandlerEditline::Refresh ()
}
}
void
IOHandlerEditline::Cancel ()
{
if (m_editline_ap)
m_editline_ap->Interrupt ();
}
void
IOHandlerEditline::Interrupt ()
{
@ -5279,6 +5286,10 @@ IOHandlerCursesGUI::Refresh ()
{
}
void
IOHandlerCursesGUI::Cancel ()
{
}
void
IOHandlerCursesGUI::Interrupt ()

View File

@ -782,6 +782,12 @@ public:
}
virtual void
Cancel ()
{
}
virtual void
Interrupt ()
{

View File

@ -4824,14 +4824,22 @@ 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);
}
}