[Lldb-commits] [lldb] r157790 - /lldb/trunk/tools/driver/Driver.cpp

Jim Ingham jingham at apple.com
Thu May 31 18:07:03 PDT 2012


Author: jingham
Date: Thu May 31 20:07:02 2012
New Revision: 157790

URL: http://llvm.org/viewvc/llvm-project?rev=157790&view=rev
Log:
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.

Modified:
    lldb/trunk/tools/driver/Driver.cpp

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=157790&r1=157789&r2=157790&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Thu May 31 20:07:02 2012
@@ -1080,10 +1080,19 @@
     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;
         





More information about the lldb-commits mailing list