From: "Kévin Le Gouguec" <legouguec@adacore.com>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2 5/6] Catch KeyboardInterrupt in send_gdb_with_response
Date: Mon, 11 Dec 2023 18:53:39 +0100 [thread overview]
Message-ID: <87r0jsfwws.fsf@adacore.com> (raw)
In-Reply-To: <20231211-dap-cancel-v2-5-db7b52cf0329@adacore.com> (Tom Tromey's message of "Mon, 11 Dec 2023 09:02:22 -0700")
Tom Tromey <tromey@adacore.com> writes:
> Cancellation will generally be seen by the DAP code as a
> KeyboardInterrupt. However, this derives from BaseException and not
> Exception, so a small change is needed to send_gdb_with_response, to
> forward the exception to the DAP server thread.
> ---
> gdb/python/lib/gdb/dap/startup.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/python/lib/gdb/dap/startup.py b/gdb/python/lib/gdb/dap/startup.py
> index a16b51f7cf5..1d3b94762a6 100644
> --- a/gdb/python/lib/gdb/dap/startup.py
> +++ b/gdb/python/lib/gdb/dap/startup.py
> @@ -172,11 +172,11 @@ def send_gdb_with_response(fn):
> try:
> val = fn()
> result_q.put(val)
> - except Exception as e:
> + except (Exception, KeyboardInterrupt) as e:
> result_q.put(e)
>
> send_gdb(message)
> val = result_q.get()
> - if isinstance(val, Exception):
> + if isinstance(val, (Exception, KeyboardInterrupt)):
> raise val
> return val
ACK!
Reviewed-By: Kévin Le Gouguec <legouguec@adacore.com>
next prev parent reply other threads:[~2023-12-11 17:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-11 16:02 [PATCH v2 0/6] Implement DAP cancellation Tom Tromey
2023-12-11 16:02 ` [PATCH v2 1/6] Clean up handling of DAP not-stopped response Tom Tromey
2023-12-11 16:02 ` [PATCH v2 2/6] Move DAP JSON reader to its own thread Tom Tromey
2023-12-11 16:02 ` [PATCH v2 3/6] Introduce gdb.interrupt Tom Tromey
2023-12-11 16:30 ` Eli Zaretskii
2023-12-11 16:02 ` [PATCH v2 4/6] Rename a couple of DAP procs in the testsuite Tom Tromey
2023-12-11 16:02 ` [PATCH v2 5/6] Catch KeyboardInterrupt in send_gdb_with_response Tom Tromey
2023-12-11 17:53 ` Kévin Le Gouguec [this message]
2023-12-11 16:02 ` [PATCH v2 6/6] Implement DAP cancellation Tom Tromey
2023-12-11 18:53 ` [PATCH v2 0/6] " Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r0jsfwws.fsf@adacore.com \
--to=legouguec@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@adacore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).