llvm-project/lldb/tools
Greg Clayton 63e512100a Fix race condition when launching and attaching.
This is a modified version of a previous patch that was reverted: https://reviews.llvm.org/D119797
This version only waits for the process to stop when using "launchCommands" or "attachCommands"...

...and doesn't play with the async mode when doing normal launch/attach.

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 "launchCommands" or "attachCommands" are run to ensure that we have a stopped process point that is ready for the debug session to proceed. We spin up the thread that listens for process events before we start the launch or attach, but we don't want stop events being delivered through the DAP protocol until the "configurationDone" packet is received. We now always ignore the stop event with a stop ID of 1, which is the first stop. All normal launch and attach scenarios use the synchronous mode, and "launchCommands and "attachCommands" run an array of LLDB commands in async mode.

This should make our launch with "launchCommands" and attach with "attachCommands" avoid a race condition when the process is being launched or attached.

Differential Revision: https://reviews.llvm.org/D120755
2022-03-03 16:20:27 -08:00
..
argdumper [lldb] Remove a few unused .exports files 2021-08-05 22:17:00 +02:00
compact-unwind Don't re-define constants that are now in compact_unwind_encoding.h. 2021-09-09 17:01:43 -07:00
darwin-debug [lldb][NFC] Use C++ versions of the deprecated C standard library headers 2021-05-26 12:46:12 +02:00
darwin-threads
debugserver add missing include 2022-02-17 09:02:29 -08:00
driver [lldb] Remove reproducer_handler from the driver 2022-03-03 13:22:39 -08:00
intel-features [LLDB] Silence warnings in cli-wrapper-mpxtable.cpp 2021-06-28 02:36:14 +00:00
lldb-instr [lldb] Revive lldb-instr 2022-01-20 18:06:14 -08:00
lldb-server [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
lldb-test [lldb] Make lldbVersion a full fledged library 2021-12-08 15:14:34 -08:00
lldb-vscode Fix race condition when launching and attaching. 2022-03-03 16:20:27 -08:00
CMakeLists.txt [lldb] Revive lldb-instr 2022-01-20 18:06:14 -08:00