[Lldb-commits] [PATCH] Fix multiple problems of lldb-mi blocking on input monitoring and needing a return.

Hafiz Abid Qadeer abidh.haq at gmail.com
Tue Feb 10 03:32:23 PST 2015


================
Comment at: test/tools/lldb-mi/TestMiExit.py:33-34
@@ -32,4 +31,2 @@
         self.expect("\^exit")
-        import pexpect
-        self.expect(pexpect.EOF)
 
----------------
ki.stfu wrote:
> It checks that lldb-mi really exited. If it doesn't work on Linux we can skip test or it should be commented out and we should mark it as "FIXME" for future fixes.
> I think "skip test" is preferable.
I will restore the checks. It was failing when I have not done the select fix. Now it passes on Linux.

================
Comment at: tools/lldb-mi/MICmnStreamStdinLinux.cpp:162-164
@@ +161,5 @@
+    // The reason for delay was behavior of select in multithreaded app.
+    // The man pages for select suggest that closing a fd which is monitored
+    // by select from another thread has no effect. It effectively caused the
+    // application to block in select forever and test cases timed out.
+    // To fix this issue, I have introduced the a timeout using 3rd arg of select. It
----------------
ki.stfu wrote:
> Have you tried to monitor errors using 3rd arg of select?
The documentation in man pages is quite explicit.
"On Linux (and some other systems), closing the file descriptor in another thread has no
       effect on select()."

================
Comment at: tools/lldb-mi/MICmnStreamStdinLinux.cpp:165
@@ +164,3 @@
+    // application to block in select forever and test cases timed out.
+    // To fix this issue, I have introduced the a timeout using 3rd arg of select. It
+    // gives us chance to see if other thread has asked us to stop waiting for
----------------
ki.stfu wrote:
> timeout is 4th argument
Thanks. I will fix this. It is actually 5th :-)

================
Comment at: tools/lldb-mi/MIDriver.cpp:524
@@ -524,1 +523,3 @@
+    // input and needs an extra return before exiting.
+    if ((vStdInBuffer == "quit") || (vStdInBuffer.find("-gdb-exit") != std::string::npos))
         vrwbYesExit = true;
----------------
ki.stfu wrote:
> I do not like this "if", but you have extended its functionality. Maybe it would be better to call CMICmnStreamStdinLinux::InterruptReadLine() from -gdb-exit command? or use CMIDriver::GetExitApplicationFlag() instead of m_waitForInput in CMICmnStreamStdinLinux::InputAvailable()?
Yes. I dont like it either. It was like a quick fix. I will look at the alternate options.

http://reviews.llvm.org/D7529

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






More information about the lldb-commits mailing list