This is an archive of the discontinued LLVM Phabricator instance.

Refactor lldb-mi's prompt
ClosedPublic

Authored by ki.stfu on May 13 2015, 2:32 AM.

Details

Summary

This patch fixes/cleans code around of (gdb) prompt:

  1. Add CMICmnStreamStdout::WritePrompt
  2. Clean up CMICmnStreamStdout::TextToStdout (don't lock the m_mutex twice because it will be locked in CMICmnStreamStdout::WritePriv)
  3. Remove unused CMICmnStreamStdin::m_bShowPrompt field
  4. Refactor CMICmnLLDBDebuggerHandleEvents to use CMICmnStreamStdout::WritePrompt instead of TextToStdout("(gdb)")
  5. Refactor CMIDriver to use CMICmnStreamStdout::WritePrompt instead of ` if (bOk && m_rStdin.GetEnablePrompt()) bOk = m_rStdOut.WriteMIResponse(m_rStdin.GetPrompt()); `

Diff Detail

Event Timeline

ki.stfu updated this revision to Diff 25668.May 13 2015, 2:32 AM
ki.stfu retitled this revision from to Refactor lldb-mi's prompt.
ki.stfu updated this object.
ki.stfu edited the test plan for this revision. (Show Details)
ki.stfu added a reviewer: abidh.
ki.stfu added subscribers: abidh, Unknown Object (MLST).
abidh accepted this revision.May 13 2015, 5:12 AM
abidh edited edge metadata.

Looks good apart from one inline comment.

tools/lldb-mi/MICmnStreamStdout.cpp
221

Do we really need this function now? It can be merged in the function below.

This revision is now accepted and ready to land.May 13 2015, 5:12 AM
ki.stfu added inline comments.May 13 2015, 5:19 AM
tools/lldb-mi/MICmnStreamStdout.cpp
221

Yep. It is used in few places:

$ grep -rn "CMICmnStreamStdout::TextToStdout" tools/lldb-mi/
tools/lldb-mi//MICmdCmdBreak.cpp:572:        bOk = bOk && CMICmnStreamStdout::TextToStdout(miOutOfBandRecord.GetString());
tools/lldb-mi//MICmdCmdBreak.cpp:712:        bOk = bOk && CMICmnStreamStdout::TextToStdout(miOutOfBandRecord.GetString());
tools/lldb-mi//MICmdCmdMiscellanous.cpp:485:        CMICmnStreamStdout::TextToStdout(strMsg);
tools/lldb-mi//MICmnLLDBDebuggerHandleEvents.cpp:1741:    return CMICmnStreamStdout::TextToStdout(vrTxt);
tools/lldb-mi//MICmnStreamStdout.cpp:217:CMICmnStreamStdout::TextToStdout(const CMIUtilString &vrTxt)
tools/lldb-mi//MIDriver.cpp:1223:    bool bOk = CMICmnStreamStdout::TextToStdout(strCmd);
tools/lldb-mi//MIDriver.cpp:1291:        bOk = CMICmnStreamStdout::TextToStdout(strCommand);
ki.stfu closed this revision.May 13 2015, 5:21 AM