Index: tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp =================================================================== --- tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp +++ tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp @@ -1022,7 +1022,7 @@ const CMICmnMIValueResult miValueResult7("stopped-threads", miValueConst7); bOk = bOk && miOutOfBandRecord.Add(miValueResult7); bOk = bOk && MiOutOfBandRecordToStdout(miOutOfBandRecord); - bOk = bOk && TextToStdout("(gdb)"); + bOk = bOk && CMICmnStreamStdout::WritePrompt(); } else if (nStopReason == m_SIGSEGV) { @@ -1090,7 +1090,7 @@ const CMICmnMIValueResult miValueResult4("stopped-threads", miValueConst4); bOk = bOk && miOutOfBandRecord.Add(miValueResult4); bOk = bOk && MiOutOfBandRecordToStdout(miOutOfBandRecord); - bOk = bOk && TextToStdout("(gdb)"); + bOk = bOk && CMICmnStreamStdout::WritePrompt(); } return bOk; } @@ -1128,7 +1128,7 @@ const CMICmnMIValueResult miValueResult4("stopped-threads", miValueConst4); bOk = bOk && miOutOfBandRecord.Add(miValueResult4); bOk = bOk && MiOutOfBandRecordToStdout(miOutOfBandRecord); - bOk = bOk && TextToStdout("(gdb)"); + bOk = bOk && CMICmnStreamStdout::WritePrompt(); return bOk; } @@ -1248,7 +1248,7 @@ const CMICmnMIValueResult miValueResult6("stopped-threads", miValueConst6); bOk = bOk && miOutOfBandRecord.Add(miValueResult6); bOk = bOk && MiOutOfBandRecordToStdout(miOutOfBandRecord); - bOk = bOk && TextToStdout("(gdb)"); + bOk = bOk && CMICmnStreamStdout::WritePrompt(); return bOk; } @@ -1290,7 +1290,7 @@ const CMICmnMIValueResult miValueResult9("stopped-threads", miValueConst9); bOk = miOutOfBandRecord.Add(miValueResult9); bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord); - bOk = bOk && TextToStdout("(gdb)"); + bOk = bOk && CMICmnStreamStdout::WritePrompt(); } return MIstatus::success; @@ -1321,7 +1321,7 @@ const CMICmnMIValueResult miValueResult2("stopped-threads", miValueConst2); bOk = miOutOfBandRecord.Add(miValueResult2); bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord); - bOk = bOk && TextToStdout("(gdb)"); + bOk = bOk && CMICmnStreamStdout::WritePrompt(); return bOk; } @@ -1355,7 +1355,7 @@ const CMICmnMIValueResult miValueResult9("stopped-threads", miValueConst9); bOk = miOutOfBandRecord.Add(miValueResult9); bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord); - bOk = bOk && TextToStdout("(gdb)"); + bOk = bOk && CMICmnStreamStdout::WritePrompt(); } return bOk; @@ -1447,7 +1447,7 @@ CMICmnMIValueResult miValueResult("thread-id", miValueConst); CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_Running, miValueResult); bool bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord); - bOk = bOk && TextToStdout("(gdb)"); + bOk = bOk && CMICmnStreamStdout::WritePrompt(); return bOk; } @@ -1491,7 +1491,7 @@ CMICmnMIOutOfBandRecord miOutOfBandRecord3(CMICmnMIOutOfBandRecord::eOutOfBand_Stopped, miValueResult4); bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord3); } - bOk = bOk && TextToStdout("(gdb)"); + bOk = bOk && CMICmnStreamStdout::WritePrompt(); return bOk; } @@ -1693,7 +1693,7 @@ ++it; } - return TextToStdout("(gdb)"); + return CMICmnStreamStdout::WritePrompt(); } //++ ------------------------------------------------------------------------------------ Index: tools/lldb-mi/MICmnStreamStdin.h =================================================================== --- tools/lldb-mi/MICmnStreamStdin.h +++ tools/lldb-mi/MICmnStreamStdin.h @@ -56,7 +56,6 @@ private: CMIUtilString m_strPromptCurrent; // Command line prompt as shown to the user bool m_bShowPrompt; // True = Yes prompt is shown/output to the user (stdout), false = no prompt - bool m_bRedrawPrompt; // True = Prompt needs to be redrawn static const int m_constBufferSize = 2048; MIchar *m_pCmdBuffer; }; Index: tools/lldb-mi/MICmnStreamStdin.cpp =================================================================== --- tools/lldb-mi/MICmnStreamStdin.cpp +++ tools/lldb-mi/MICmnStreamStdin.cpp @@ -31,7 +31,6 @@ CMICmnStreamStdin::CMICmnStreamStdin(void) : m_strPromptCurrent("(gdb)") , m_bShowPrompt(true) - , m_bRedrawPrompt(true) , m_pCmdBuffer(nullptr) { } Index: tools/lldb-mi/MICmnStreamStdout.h =================================================================== --- tools/lldb-mi/MICmnStreamStdout.h +++ tools/lldb-mi/MICmnStreamStdout.h @@ -31,6 +31,7 @@ // Statics: public: static bool TextToStdout(const CMIUtilString &vrTxt); + static bool WritePrompt(void); // Methods: public: Index: tools/lldb-mi/MICmnStreamStdout.cpp =================================================================== --- tools/lldb-mi/MICmnStreamStdout.cpp +++ tools/lldb-mi/MICmnStreamStdout.cpp @@ -216,9 +216,23 @@ bool CMICmnStreamStdout::TextToStdout(const CMIUtilString &vrTxt) { - const bool bLock = CMICmnStreamStdout::Instance().Lock(); - const bool bOk = bLock && CMICmnStreamStdout::Instance().WriteMIResponse(vrTxt); - bLock &&CMICmnStreamStdout::Instance().Unlock(); + const bool bSendToLog = true; + return CMICmnStreamStdout::Instance().WriteMIResponse(vrTxt, bSendToLog); +} - return bOk; +//++ ------------------------------------------------------------------------------------ +// Details: Write prompt to stdout if it's enabled. +// Type: Static method. +// Args: None. +// Return: MIstatus::success - Function succeeded. +// MIstatus::failure - Function failed. +// Throws: None. +//-- +bool +CMICmnStreamStdout::WritePrompt(void) +{ + const CMICmnStreamStdin &rStdinMan = CMICmnStreamStdin::Instance(); + if (rStdinMan.GetEnablePrompt()) + return TextToStdout(rStdinMan.GetPrompt()); + return MIstatus::success; } Index: tools/lldb-mi/MIDriver.cpp =================================================================== --- tools/lldb-mi/MIDriver.cpp +++ tools/lldb-mi/MIDriver.cpp @@ -576,8 +576,7 @@ } // Draw prompt if desired - if (bOk && m_rStdin.GetEnablePrompt()) - bOk = m_rStdOut.WriteMIResponse(m_rStdin.GetPrompt()); + bOk = bOk && CMICmnStreamStdout::WritePrompt(); // Wait while the handler thread handles incoming events CMICmnLLDBDebugger::Instance().WaitForHandleEvent(); @@ -1173,7 +1172,7 @@ bool CMIDriver::InitClientIDEEclipse(void) const { - return CMICmnStreamStdout::TextToStdout("(gdb)"); + return CMICmnStreamStdout::WritePrompt(); } //++ ------------------------------------------------------------------------------------ @@ -1223,8 +1222,7 @@ const CMIUtilString strCmd(CMIUtilString::Format("-file-exec-and-symbols \"%s\"", m_strCmdLineArgExecuteableFileNamePath.AddSlashes().c_str())); bool bOk = CMICmnStreamStdout::TextToStdout(strCmd); bOk = bOk && InterpretCommand(strCmd); - if (bOk && m_rStdin.GetEnablePrompt()) - bOk = m_rStdOut.WriteMIResponse(m_rStdin.GetPrompt()); + bOk = bOk && CMICmnStreamStdout::WritePrompt(); return bOk; } @@ -1304,8 +1302,7 @@ } // Draw the prompt after command will be executed (if enabled) - if (bOk && m_rStdin.GetEnablePrompt()) - bOk = m_rStdOut.WriteMIResponse(m_rStdin.GetPrompt()); + bOk = bOk && CMICmnStreamStdout::WritePrompt(); // Exit if there is an error if (!bOk)