[Lldb-commits] [lldb] [lldb-dap] Fix a race during shutdown (PR #91591)

via lldb-commits lldb-commits at lists.llvm.org
Wed May 22 07:07:20 PDT 2024


kusmour wrote:

> > I can't remember: does terminate come before disconnecting? Or is it the other way around?
> 
> Disconnect docs say "The disconnect request asks the debug adapter to disconnect from the debuggee (thus ending the debug session) and then to shut down itself (the debug adapter).", so it has to be the last request. The terminate just terminates the debuggee and, if the client&server support it, the debuggee can be restarted after that.

This patch resulted in terminated event being sent twice for every session. One from `exited` event one from `disconnect` request. Before this patch the behavior was:
- Debuggee program exits
DAP msg: exited event --> terminated event --> disconnect request --> disconnect response
- User initiated stop debugging
DAP msg: disconnect request --> exited event --> terminated event --> disconnect response

Now
- Debuggee program exits
DAP msg: exited event --> terminated event --> disconnect request --> terminated event --> disconnect response
- User initiated stop debugging
DAP msg: disconnect request --> exited event --> terminated event --> disconnect response --> terminated event

(Also not sure why the terminated event comes after disconnect response in the second scenario)

https://github.com/llvm/llvm-project/pull/91591


More information about the lldb-commits mailing list