public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v4 3/4] Rewrite "python" command exception handling
Date: Tue, 27 Feb 2024 18:04:13 +0200	[thread overview]
Message-ID: <86o7c1uc5e.fsf@gnu.org> (raw)
In-Reply-To: <20240227-py-simple-exc-v4-3-3341d342c126@adacore.com> (message from Tom Tromey on Tue, 27 Feb 2024 07:45:51 -0700)

> From: Tom Tromey <tromey@adacore.com>
> Date: Tue, 27 Feb 2024 07:45:51 -0700
> 
> The "python" command (and the Python implementation of the gdb
> "source" command) does not handle Python exceptions in the same way as
> other gdb-facing Python code.  In particular, exceptions are turned
> into a generic error rather than being routed through
> gdbpy_handle_exception, which takes care of converting to 'quit' as
> appropriate.
> 
> I think this was done this way because PyRun_SimpleFile and friends do
> not propagate the Python exception -- they simply indicate that one
> occurred.
> 
> This patch reimplements these functions to respect the general gdb
> convention here.  As a bonus, some Windows-specific code can be
> removed, as can the _execute_file function.
> 
> The bulk of this change is tweaking the test suite to match the new
> way that exceptions are displayed.  These changes are largely
> uninteresting.  However, it's worth pointing out the py-error.exp
> change.  Here, the failure changes because the test changes the host
> charset to something that isn't supported by Python.  This then
> results in a weird error in the new setup.
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31354
> ---
>  gdb/doc/python.texi                               |   6 +-
>  gdb/python/lib/gdb/__init__.py                    |  27 ------
>  gdb/python/python.c                               | 109 +++++++++-------------
>  gdb/testsuite/gdb.ada/tasks.exp                   |   8 +-
>  gdb/testsuite/gdb.python/py-arch.exp              |   2 +-
>  gdb/testsuite/gdb.python/py-block.exp             |   4 +-
>  gdb/testsuite/gdb.python/py-breakpoint.exp        |  18 ++--
>  gdb/testsuite/gdb.python/py-connection.exp        |   8 +-
>  gdb/testsuite/gdb.python/py-disasm.exp            |  32 +++----
>  gdb/testsuite/gdb.python/py-error.exp             |   9 +-
>  gdb/testsuite/gdb.python/py-finish-breakpoint.exp |   2 +-
>  gdb/testsuite/gdb.python/py-format-address.exp    |  28 +++---
>  gdb/testsuite/gdb.python/py-format-string.exp     |   8 +-
>  gdb/testsuite/gdb.python/py-frame.exp             |  18 ++--
>  gdb/testsuite/gdb.python/py-inferior.exp          |  24 ++---
>  gdb/testsuite/gdb.python/py-lazy-string.exp       |   6 +-
>  gdb/testsuite/gdb.python/py-mi-cmd.exp            |  40 ++++----
>  gdb/testsuite/gdb.python/py-missing-debug.exp     |  16 ++--
>  gdb/testsuite/gdb.python/py-objfile.exp           |   2 +-
>  gdb/testsuite/gdb.python/py-parameter.exp         |  14 +--
>  gdb/testsuite/gdb.python/py-pp-registration.exp   |   2 +-
>  gdb/testsuite/gdb.python/py-progspace-events.exp  |   2 +-
>  gdb/testsuite/gdb.python/py-progspace.exp         |   8 +-
>  gdb/testsuite/gdb.python/py-record-btrace.exp     |   4 +-
>  gdb/testsuite/gdb.python/py-record-full.exp       |   4 +-
>  gdb/testsuite/gdb.python/py-template.exp          |   2 +-
>  gdb/testsuite/gdb.python/py-thrhandle.exp         |   2 +-
>  gdb/testsuite/gdb.python/py-type.exp              |  20 ++--
>  gdb/testsuite/gdb.python/py-unwind.exp            |  24 ++---
>  gdb/testsuite/gdb.python/py-value.exp             |  36 +++----
>  gdb/testsuite/gdb.python/python.exp               |  10 +-
>  gdb/testsuite/gdb.python/tui-window-names.exp     |  16 ++--
>  gdb/testsuite/gdb.python/tui-window.exp           |   2 +-
>  gdb/testsuite/lib/gdb-python.exp                  |   2 +-
>  34 files changed, 237 insertions(+), 278 deletions(-)

Thanks, the documentation part is okay.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>

  parent reply	other threads:[~2024-02-27 16:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 14:45 [PATCH v4 0/4] Fix DAP pause bug Tom Tromey
2024-02-27 14:45 ` [PATCH v4 1/4] Introduce read_remainder_of_file Tom Tromey
2024-02-27 14:45 ` [PATCH v4 2/4] Fix formatting buglet in python.c Tom Tromey
2024-02-27 14:45 ` [PATCH v4 3/4] Rewrite "python" command exception handling Tom Tromey
2024-02-27 16:03   ` Tom de Vries
2024-02-27 16:04   ` Eli Zaretskii [this message]
2024-03-07 10:00   ` Lancelot SIX
2024-03-08 16:19     ` Tom Tromey
2024-03-08 19:24       ` Tom Tromey
2024-02-27 14:45 ` [PATCH v4 4/4] Use the .py file in gdb.dap/pause.exp Tom Tromey
2024-02-27 16:56 ` [PATCH v4 0/4] Fix DAP pause bug 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=86o7c1uc5e.fsf@gnu.org \
    --to=eliz@gnu.org \
    --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).