[Lldb-commits] [lldb] r200476 - "script help (lldb.SBThread)" output stops before all output is displayed. Fixed now.

Greg Clayton gclayton at apple.com
Thu Jan 30 10:17:32 PST 2014


Author: gclayton
Date: Thu Jan 30 12:17:31 2014
New Revision: 200476

URL: http://llvm.org/viewvc/llvm-project?rev=200476&view=rev
Log:
"script help (lldb.SBThread)" output stops before all output is displayed. Fixed now.

<rdar://problem/15942977>

Modified:
    lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=200476&r1=200475&r2=200476&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Thu Jan 30 12:17:31 2014
@@ -571,7 +571,7 @@ ScriptInterpreterPython::ExecuteOneLine
                 int err = pipe(pipe_fds);
                 if (err == 0)
                 {
-                    std::unique_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor(pipe_fds[0], false));
+                    std::unique_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor(pipe_fds[0], true));
                     if (conn_ap->IsConnected())
                     {
                         output_comm.SetConnection(conn_ap.release());
@@ -654,13 +654,15 @@ ScriptInterpreterPython::ExecuteOneLine
         
         if (pipe_fds[0] != -1)
         {
-            // Close write end of pipe so our communication thread exits
+            // Close the write end of the pipe since we are done with our
+            // one line script. This should cause the read thread that
+            // output_comm is using to exit
+            output_file_sp->GetFile().Close();
+            // The close above should cause this thread to exit when it gets
+            // to the end of file, so let it get all its data
+            output_comm.JoinReadThread();
+            // Now we can close the read end of the pipe
             output_comm.Disconnect();
-            output_comm.StopReadThread();
-            // Close the read end of the pipe and don't close the write end
-            // since we called fdopen on it and gave the ownership to the
-            // connection in "output_comm"
-            ::close (pipe_fds[0]);
         }
         
         





More information about the lldb-commits mailing list