Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Craig Blackmore <craig.blackmore@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC PATCH] gdb: Add python support for demangling register unwind values
Date: Thu, 10 Apr 2025 15:31:53 +0300	[thread overview]
Message-ID: <865xjcqjt2.fsf@gnu.org> (raw)
In-Reply-To: <20250410110426.3488955-1-craig.blackmore@embecosm.com> (message from Craig Blackmore on Thu, 10 Apr 2025 12:04:26 +0100)

> From: Craig Blackmore <craig.blackmore@embecosm.com>
> Cc: Craig Blackmore <craig.blackmore@embecosm.com>
> Date: Thu, 10 Apr 2025 12:04:26 +0100
> 
> This patch addresses the scenario where a register value is saved in
> some mangled form on the target and gdb does not have sufficient
> information to demangle it.
> 
> After getting a register value from an unwinder, call out to extension
> languages to allow the value to be demangled.  This avoids having to
> write a new unwinder and allows the standard unwinders to be used.
> 
> This approach is purely for demangling values that have been read, there
> is no similar support provided for mangling values being written back to
> the target as this was not something that I needed to be able to do.
> 
> Only one demangler can be registered at any one time.  In future, the
> implementation could be extended to support multiple demanglers executed
> in order of priority.
> 
> The demangler is registered globally.  In future, the implementation
> could be extended to register per program space and object file too.
> 
> gdbpy_get_register_descriptor is now externally visible as it is used
> to create a gdb.RegisterDescriptor object to pass to the demangler.
> 
> This patch adds gdb.Value.is_lval_{register,memory} variables so that
> the demangler can choose to skip modifying values that did not come
> directly from the target and may not need demangling, for example,
> values taken directly from DWARF.
> ---
>  gdb/NEWS                                      | 11 +++
>  gdb/doc/python.texi                           | 48 +++++++++++
>  gdb/extension-priv.h                          |  8 ++
>  gdb/extension.c                               | 35 ++++++++
>  gdb/extension.h                               |  6 ++
>  gdb/frame.c                                   |  3 +
>  gdb/guile/guile.c                             |  2 +
>  gdb/python/lib/gdb/__init__.py                | 17 ++++
>  gdb/python/lib/gdb/unwinder.py                | 34 ++++++++
>  gdb/python/py-registers.c                     |  2 +-
>  gdb/python/py-unwind.c                        | 80 +++++++++++++++++
>  gdb/python/py-value.c                         | 25 ++++++
>  gdb/python/python-internal.h                  |  4 +
>  gdb/python/python.c                           |  4 +-
>  .../gdb.python/py-unwind-demangler.c          | 80 +++++++++++++++++
>  .../gdb.python/py-unwind-demangler.exp        | 86 +++++++++++++++++++
>  .../gdb.python/py-unwind-demangler.py         | 44 ++++++++++
>  gdb/testsuite/gdb.python/py-value.exp         |  8 ++
>  18 files changed, 495 insertions(+), 2 deletions(-)
>  create mode 100644 gdb/testsuite/gdb.python/py-unwind-demangler.c
>  create mode 100644 gdb/testsuite/gdb.python/py-unwind-demangler.exp
>  create mode 100644 gdb/testsuite/gdb.python/py-unwind-demangler.py

Thanks.  The documentation parts are okay, with one comment:

> +@subheading Unwinder Register Value Demangler Skeleton Code

Making a construct state out of more than 2-3 nouns produces very
confusing phrases in English.  I suggest to use this instead:

  @subheading Skeleton Code for a Register Value Demangler

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

  reply	other threads:[~2025-04-10 12:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-10 11:04 Craig Blackmore
2025-04-10 12:31 ` Eli Zaretskii [this message]
2025-05-08 10:17 ` [RFC PATCH v2] " Craig Blackmore
2025-05-08 11:40   ` Eli Zaretskii
2025-05-12 13:15   ` Andrew Burgess
2026-04-30 15:19     ` Craig Blackmore
2026-04-30 15:31     ` [PATCH v3] " Craig Blackmore
2026-04-30 16:05       ` Eli Zaretskii
2026-05-20 13:16       ` [PATCH v4 0/1] " Craig Blackmore
2026-05-20 13:16         ` [PATCH v4 1/1] " Craig Blackmore
2026-05-20 15:44           ` Eli Zaretskii
2026-05-21  9:47           ` Andrew Burgess
2026-05-27 10:49             ` Craig Blackmore
2026-06-08 12:04         ` [PATCH v5 0/1] " Craig Blackmore
2026-06-08 12:04           ` [PATCH v5 1/1] gdb: Add python support for transforming " Craig Blackmore
2026-06-08 12:13             ` Eli Zaretskii
2026-07-15  9:56           ` [PING][PATCH v5 0/1] gdb: Add python support for demangling " Craig Blackmore
2026-07-29 15:01           ` [PATCH " Craig Blackmore

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=865xjcqjt2.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=craig.blackmore@embecosm.com \
    --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