If the Driver's input reader gets an Interrupt and the current command line is empty, then treat that interrupt as an instruction to Stop the process of the currently selected target.

llvm-svn: 157790
This commit is contained in:
Jim Ingham 2012-06-01 01:07:02 +00:00
parent 6d10c17a31
commit d242f1c037
1 changed files with 13 additions and 4 deletions

View File

@ -1080,10 +1080,19 @@ Driver::EditLineInputReaderCallback
case eInputReaderInterrupt:
if (driver->m_io_channel_ap.get() != NULL)
{
driver->m_io_channel_ap->OutWrite ("^C\n", 3, NO_ASYNC);
// I wish I could erase the entire input line, but there's no public API for that.
driver->m_io_channel_ap->EraseCharsBeforeCursor();
driver->m_io_channel_ap->RefreshPrompt();
SBProcess process = driver->GetDebugger().GetSelectedTarget().GetProcess();
if (!driver->m_io_channel_ap->EditLineHasCharacters()
&& process.IsValid() && process.GetState() == lldb::eStateRunning)
{
process.Stop();
}
else
{
driver->m_io_channel_ap->OutWrite ("^C\n", 3, NO_ASYNC);
// I wish I could erase the entire input line, but there's no public API for that.
driver->m_io_channel_ap->EraseCharsBeforeCursor();
driver->m_io_channel_ap->RefreshPrompt();
}
}
break;