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

Hafiz Abid Qadeer abidh.haq at gmail.com
Thu Feb 19 05:29:51 PST 2015


================
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;
+}
+
----------------
ki.stfu wrote:
> 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).
As I said in my comments above. Not only these functions but a lot of other code will be redundant after this and I will remove them gradually.

================
Comment at: tools/lldb-mi/MIDriver.cpp:631
@@ -630,3 +652,1 @@
-        // Poll stdin queue and dispatch
-        if (!ReadStdinLineQueue())
         {
----------------
ki.stfu wrote:
> We should remove ReadStdinLineQueue if it not used any more.
I will surly do in a separate revision. There will be a lot of code cleanup.

================
Comment at: tools/lldb-mi/MIDriver.h:184
@@ +183,2 @@
+
+bool ReadLine(CMIUtilString &cmd);
----------------
ki.stfu wrote:
> I think you should use existing code from MICmnStreamStdin.
A lot of those classes will be unnecessary after this revision and I plan to remove them. So only this Readline will be kept.

http://reviews.llvm.org/D7746

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






More information about the lldb-commits mailing list