[Lldb-commits] [PATCH] D20107: Fix a race in ProcessGDBRemote::MonitorDebugServerProcess

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue May 10 08:29:31 PDT 2016


labath created this revision.
labath added a reviewer: clayborg.
labath added subscribers: lldb-commits, tberghammer.

MonitorDebugServerProcess went to a lot of effort to make sure its asynchronous invocation does
not cause any mischief, but it was still not race-free. Specifically, in a quick stop-restart
sequence (like the one in TestAddressBreakpoints) the copying of the process shared pointer via
target_sp->GetProcessSP() was racing with the resetting of the pointer in DeleteCurrentProcess,
as they were both accessing the same shared_ptr object.

To avoid this, I simply pass in a weak_ptr to the process when the callback is created. Locking
this pointer is race-free as they are two separate object even though they point to the same
process instance. This also removes the need for the complicated tap-dance around retrieving the
process pointer.

http://reviews.llvm.org/D20107

Files:
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20107.56722.patch
Type: text/x-patch
Size: 8122 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160510/f614148a/attachment.bin>


More information about the lldb-commits mailing list