[Lldb-commits] [PATCH] Reduce number of threads in lldb-mi.

Ilia K ki.stfu at gmail.com
Thu Feb 19 04:49:14 PST 2015


Extra cleaning is needed.


================
Comment at: tools/lldb-mi/MIDriver.cpp:556
@@ -555,3 @@
-    bOk &= m_rStdin.SetVisitor(*this);
-    if (bOk && !rThreadMgr.ThreadStart<CMICmnStreamStdin>(m_rStdin))
-    {
----------------
Why you don't remove CMICmnStreamStdin::ThreadRun() and CMICmnStreamStdin::MonitorStdin()?

================
Comment at: tools/lldb-mi/MIDriver.cpp:588-609
@@ +587,24 @@
+//--
+bool
+ReadLine(CMIUtilString &cmd)
+{
+    const int SIZE = 2048;
+    char buf[SIZE];
+    // Read user input
+    const MIchar *pText = ::fgets(&buf[0], SIZE, stdin);
+    if (pText == nullptr)
+        return false;
+
+    // Strip off new line characters
+    for (MIchar *pI = buf; *pI != '\0'; pI++)
+    {
+        if ((*pI == '\n') || (*pI == '\r'))
+        {
+            *pI = '\0';
+            break;
+        }
+    }
+    cmd = CMIUtilString(buf);
+    return true;
+}
+
----------------
I think you should use MICmnStreamStdin module. For example, m_rStdin.ReadLine() function.

Also you should check if we need IOSStdinHandler::InputAvailable and IOSStdinHandler::InterruptReadLine functions and use them (or remove).

================
Comment at: tools/lldb-mi/MIDriver.cpp:631
@@ -630,3 +652,1 @@
-        // Poll stdin queue and dispatch
-        if (!ReadStdinLineQueue())
         {
----------------
We should remove ReadStdinLineQueue if it not used any more.

================
Comment at: tools/lldb-mi/MIDriver.h:184
@@ +183,2 @@
+
+bool ReadLine(CMIUtilString &cmd);
----------------
I think you should use existing code from MICmnStreamStdin.

http://reviews.llvm.org/D7746

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list