[Lldb-commits] [lldb] r232715 - Fix double (gdb) prompt when command doesn't exist

Ilia K ki.stfu at gmail.com
Thu Mar 19 02:17:06 PDT 2015


Author: ki.stfu
Date: Thu Mar 19 04:17:06 2015
New Revision: 232715

URL: http://llvm.org/viewvc/llvm-project?rev=232715&view=rev
Log:
Fix double (gdb) prompt when command doesn't exist


Modified:
    lldb/trunk/tools/lldb-mi/MIDriver.cpp

Modified: lldb/trunk/tools/lldb-mi/MIDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriver.cpp?rev=232715&r1=232714&r2=232715&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriver.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIDriver.cpp Thu Mar 19 04:17:06 2015
@@ -529,13 +529,14 @@ CMIDriver::DoMainLoop(void)
     if (!StartWorkerThreads())
         return MIstatus::failure;
 
+    bool bOk = MIstatus::success;
+
     if (HaveExecutableFileNamePathOnCmdLine())
     {
         if (!LocalDebugSessionStartupExecuteCommands())
         {
-            StopWorkerThreads();
             SetErrorDescription(MIRSRC(IDS_MI_INIT_ERR_LOCAL_DEBUG_SESSION));
-            return MIstatus::failure;
+            bOk = MIstatus::failure;
         }
     }
 
@@ -543,7 +544,7 @@ CMIDriver::DoMainLoop(void)
     m_bExitApp = false;
 
     // While the app is active
-    while (!m_bExitApp)
+    while (bOk && !m_bExitApp)
     {
         CMIUtilString errorText;
         const MIchar *pCmd = m_rStdin.ReadLine (errorText);
@@ -559,7 +560,6 @@ CMIDriver::DoMainLoop(void)
                     break;
                 }
 
-                bool bOk = false;
                 {
                     // Lock Mutex before processing commands so that we don't disturb an event
                     // being processed
@@ -568,7 +568,7 @@ CMIDriver::DoMainLoop(void)
                 }
                 // Draw prompt if desired
                 if (bOk && m_rStdin.GetEnablePrompt())
-                    m_rStdOut.WriteMIResponse(m_rStdin.GetPrompt());
+                    bOk = m_rStdOut.WriteMIResponse(m_rStdin.GetPrompt());
             }
         }
     }
@@ -877,9 +877,7 @@ CMIDriver::InterpretCommandThisDriver(co
     const CMICmnMIValueConst vconst = CMICmnMIValueConst(msg);
     const CMICmnMIValueResult valueResult("msg", vconst);
     const CMICmnMIResultRecord miResultRecord(cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, valueResult);
-    bool bOk = m_rStdOut.WriteMIResponse(miResultRecord.GetString());
-    if (bOk && m_rStdin.GetEnablePrompt())
-        bOk = m_rStdOut.WriteMIResponse(m_rStdin.GetPrompt());
+    const bool bOk = m_rStdOut.WriteMIResponse(miResultRecord.GetString());
 
     // Proceed to wait for or execute next command
     return bOk;





More information about the lldb-commits mailing list