[Lldb-commits] [PATCH] D119797: Fix race condition when launching and attaching.

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 14 17:12:36 PST 2022

clayborg created this revision.
clayborg added reviewers: labath, JDevlieghere, jingham, aadsm, wallace, ilya-nozhkin.
clayborg requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

We discovered that when using "launchCommands" or "attachCommands" that there was an issue where these commands were not being run synchronously. There were further problems in this case where we would get thread events for the process that was just launched or attached before the IDE was ready, which is after "configurationDone" was sent to lldb-vscode.

This fix introduces the ability to wait for the process to stop after the run or attach to ensure that we have a stopped process at the entry point that is ready for the debug session to proceed. This also allows us to run the normal launch or attach without needing to play with the async flag the debugger. We spin up the thread that listens for process events before we start the launch or attach, but we stop events from being delivered through the DAP protocol until the "configurationDone" packet is received. This function was manually delivering the first process stopped event in the code already, so this means we don't end up sending two stopped events at the start of a debug session.

Added a flag to the vscode.py protocol classes that detects and ensures that no "stopped" events are sent prior to "configurationDone" has been sent and will raise an error if it does happen.

This should make our launching and attaching more reliable and avoid some deadlocks that were being seen (https://reviews.llvm.org/D119548).

  rG LLVM Github Monorepo



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119797.408672.patch
Type: text/x-patch
Size: 8985 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220215/e6814e8a/attachment.bin>

More information about the lldb-commits mailing list