[Lldb-commits] [PATCH] D81838: [debugserver] wait for STDIO thread to finish before flushing output

Uldis Kalnins via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 15 05:24:29 PDT 2020


ukalnins created this revision.
ukalnins added a reviewer: jasonmolenda.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

When process, that debugserver is attached to, exits, there is a race condition
if the process STDIO will be consumed and appened to internal stdio buffer before
debugserver flushes the stdio buffer for the last time and sends process exit status to lldb.

This patch adds the ability to signal the stdio thread to stop and wait for it to finish and
uses this to wait for the thread to finish before flushing output for the last time.

This is a potential patch for https://bugs.llvm.org/show_bug.cgi?id=45454

To reliably reproduce the problem I added usleep(1000) in MachProcess::STDIOThread before calls to AppendSTDOUT.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81838

Files:
  lldb/tools/debugserver/source/DNB.cpp
  lldb/tools/debugserver/source/DNB.h
  lldb/tools/debugserver/source/MacOSX/MachProcess.h
  lldb/tools/debugserver/source/MacOSX/MachProcess.mm
  lldb/tools/debugserver/source/debugserver.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81838.270719.patch
Type: text/x-patch
Size: 5280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200615/cd2e9bc6/attachment.bin>


More information about the lldb-commits mailing list