From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PING][PATCH] [gdb/python] Document quit_force uses
Date: Thu, 27 Aug 2026 09:50:27 +0200 [thread overview]
Message-ID: <2754e219-f2e6-47a4-8af9-b0ab24b092c1@suse.de> (raw)
In-Reply-To: <20260811080018.1151006-1-tdevries@suse.de>
On 8/11/26 10:00 AM, Tom de Vries wrote:
> The Python extension has two functions that convert exceptions from the GDB
> domain to the Python domain and vice versa: gdbpy_convert_exception and
> gdbpy_handle_exception.
>
> Each function has an exception though, where it calls quit_force:
> - for gdbpy_convert_exception, when handling gdb_exception_forced_quit, and
> - for gdbpy_handle_exception, when handling SystemExit.
>
> I think it's a good idea to document these exceptions in more detail, and
> since AFAICT the reasoning is the same, I've added the same comment in both
> places.
Ping.
Thanks,
- Tom
> ---
> gdb/python/py-utils.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c
> index a831b96eb38..1c68b206601 100644
> --- a/gdb/python/py-utils.c
> +++ b/gdb/python/py-utils.c
> @@ -221,7 +221,14 @@ gdbpy_convert_exception (const struct gdb_exception &exception)
> if (exception.reason == RETURN_QUIT)
> exc_class = PyExc_KeyboardInterrupt;
> else if (exception.reason == RETURN_FORCED_QUIT)
> - quit_force (NULL, 0);
> + {
> + /* Ideally we'd like to propagate the exception to top-level, where
> + we'll call quit_force. Propagating the exception would ensure that
> + appropriate cleanups are run.
> + OTOH, there is the risk that the exception will be swallowed.
> + For now, don't take this risk and immediately call quit_force. */
> + quit_force (NULL, 0);
> + }
> else if (exception.error == MEMORY_ERROR)
> exc_class = gdbpy_gdb_memory_error;
> else
> @@ -485,6 +492,11 @@ gdbpy_handle_exception ()
> exit_arg = 1;
> }
>
> + /* Ideally we'd like to propagate the exception to top-level, where
> + we'll call quit_force. Propagating the exception would ensure that
> + appropriate cleanups are run.
> + OTOH, there is the risk that the exception will be swallowed.
> + For now, don't take this risk and immediately call quit_force. */
> quit_force (&exit_arg, 0);
> }
> else if (! fetched_error.type_matches (gdbpy_gdberror_exc)
>
> base-commit: 8e6c4f526a68b796b7bd71d53e4dc459ac56c3ef
next prev parent reply other threads:[~2026-08-27 7:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 8:00 [PATCH] " Tom de Vries
2026-08-27 7:50 ` Tom de Vries [this message]
2026-08-27 15:56 ` 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=2754e219-f2e6-47a4-8af9-b0ab24b092c1@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/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