[all-commits] [llvm/llvm-project] 3cd13c: Fix a race between lldb's packet timeout and the p...
jimingham via All-commits
all-commits at lists.llvm.org
Tue Feb 25 11:17:34 PST 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 3cd13c4624b5900c884b691b72d0ca053433f6fe
https://github.com/llvm/llvm-project/commit/3cd13c4624b5900c884b691b72d0ca053433f6fe
Author: Jim Ingham <jingham at apple.com>
Date: 2020-02-25 (Tue, 25 Feb 2020)
Changed paths:
A lldb/test/API/macosx/profile_vrs_detach/Makefile
A lldb/test/API/macosx/profile_vrs_detach/TestDetachVrsProfile.py
A lldb/test/API/macosx/profile_vrs_detach/main.c
M lldb/tools/debugserver/source/MacOSX/MachProcess.h
M lldb/tools/debugserver/source/MacOSX/MachProcess.mm
Log Message:
-----------
Fix a race between lldb's packet timeout and the profile thread's usleep.
The debugserver profile thread used to suspend itself between samples with
a usleep. When you detach or kill, MachProcess::Clear would delay replying
to the incoming packet until pthread_join of the profile thread returned.
If you are unlucky or the suspend delay is long, it could take longer than
the packet timeout for pthread_join to return. Then you would get an error
about detach not succeeding from lldb - even though in fact the detach was
successful...
I replaced the usleep with PThreadEvents entity. Then we just call a timed
WaitForEventBits, and when debugserver wants to stop the profile thread, it
can set the event bit, and the sleep will exit immediately.
Differential Revision: https://reviews.llvm.org/D75004
More information about the All-commits
mailing list