Page MenuHomePhabricator

[debugserver] wait for STDIO thread to finish before flushing output
Needs ReviewPublic

Authored by ukalnins on Jun 15 2020, 4:55 AM.



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

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

Diff Detail

Event Timeline

ukalnins created this revision.Jun 15 2020, 4:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 15 2020, 4:55 AM
ukalnins updated this revision to Diff 270732.Jun 15 2020, 6:22 AM

Fixed merge conflict.