Bug 30681 - gdb does not send "terminated" event
Summary: gdb does not send "terminated" event
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: dap (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 14.1
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-25 12:47 UTC by Tom Tromey
Modified: 2023-08-01 18:58 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
patch (1.09 KB, patch)
2023-07-25 14:42 UTC, Tom Tromey
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Tromey 2023-07-25 12:47:39 UTC
This comes from https://sourceware.org/bugzilla/show_bug.cgi?id=30678#c1.
gdb does not send the DAP "terminated" event.
Apparently VSCode needs this to know that debugging is done.

The DAP spec seems a little unclear on this point, as it seems
to me that the exited event should have been enough...
Comment 1 Tom Tromey 2023-07-25 14:42:12 UTC
Created attachment 15011 [details]
patch

It isn't super clear to me exactly when this ought to be sent.
This should work for ordinary cases at least.
Comment 2 Vladimir Makaev 2023-07-25 21:59:39 UTC
I've tested this patch. Seems to work correctly! Thanks!
Comment 3 Tom Tromey 2023-07-26 15:38:03 UTC
Thank you for this and your other testing.
It's very helpful.

https://sourceware.org/pipermail/gdb-patches/2023-July/201133.html
Comment 4 Sourceware Commits 2023-08-01 18:58:18 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=21db866dc69c481cd79b4d739c2170a7ef9b98fd

commit 21db866dc69c481cd79b4d739c2170a7ef9b98fd
Author: Tom Tromey <tromey@adacore.com>
Date:   Tue Jul 25 09:16:35 2023 -0600

    Implement DAP 'terminated' event
    
    This implements the DAP 'terminated' event.  Vladimir Makaev noticed
    that VSCode will not report the debug session as over unless this is
    sent.
    
    It's not completely clear when exactly this event ought to be sent.
    Here I've done it when the inferior exits.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30681
Comment 5 Tom Tromey 2023-08-01 18:58:47 UTC
Fixed.