From 6b9efd5c1a6ead15845ef5d40b0a4bdc2cb33480 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 20 Nov 2024 13:04:27 -0700 Subject: Defer DAP launch command until after configurationDone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR dap/32090 points out that gdb's DAP "launch" sequencing is incorrect. The current approach (which is itself a 2nd implementation...) was based on a misreading of the spec. The spec has since been clarified here: https://github.com/microsoft/debug-adapter-protocol/issues/497 The clarification here is that a client is free to send the "launch" (or "attach") request at any point after the "initialized" event has been sent by gdb. However, the "launch" does not cause any action to be taken -- and does not send a response -- until after "configurationDone" has been seen. This patch implements this by arranging for the launch and attach commands to return a DeferredRequest object. All the tests needed updates. I've also added a new test that checks that the deferred "launch" request can be cancelled. (Note that the cancellation is lazy -- it also waits until configurationDone is seen. This could be fixed, but I was not sure whether it is important to do so.) Finally, the "launch" command has a somewhat funny sequencing now. Simply sending the command and waiting for a response yielded strange results if the inferior did not stop -- in this case, the repsonse was never sent. So now, the command is split into two parts, with some setup being done synchronously (for better error propagation) and the actual "run" being done async. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32090 Reviewed-by: Kévin Le Gouguec --- gdb/NEWS | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gdb/NEWS') diff --git a/gdb/NEWS b/gdb/NEWS index 361d772..047f8ad 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -98,6 +98,12 @@ the return value from the latest "stepOut" command, when appropriate. + ** The "launch" and "attach" requests were rewritten in accordance + with some clarifications to the spec. Now they can be sent at + any time after the "initialized" event, but will not take effect + (or send a response) until after the "configurationDone" request + has been sent. + * New commands show jit-reader-directory -- cgit v1.1