[Lldb-commits] [PATCH] Fix ProcessIO test failures

Pavel Labath labath at google.com
Wed Mar 11 04:13:01 PDT 2015


Hi clayborg, jingham,

There was a race condition regarding the output of the inferior process. The reading of the
output is performed on a separate thread, and there was no guarantee that the output will get
eventually consumed. Because of that, it was happening that calling Process::GetSTDOUT was not
returning anything even though the process was terminated and would definitely not produce any
further output. This was usually happening only under very heavy system load, but it can be
reproduced by placing an usleep in the stdio thread (Process::STDIOReadThreadBytesReceived).

This patch addresses this by adding synchronization capabilities to the Communication thread.
After calling Communication::SynchronizeWithReadThread one can be sure that all pending input has
been processed by the read thread. This function is then called after every public event which
stops the process to obtain the entire process output.

http://reviews.llvm.org/D8246

Files:
  include/lldb/Core/Communication.h
  include/lldb/Core/Connection.h
  include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
  include/lldb/Host/windows/ConnectionGenericFileWindows.h
  source/Core/Communication.cpp
  source/Target/Process.cpp
  test/python_api/process/io/TestProcessIO.py

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8246.21685.patch
Type: text/x-patch
Size: 11170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150311/f837762d/attachment.bin>


More information about the lldb-commits mailing list