From: Simon Marchi <simark@simark.ca>
To: Craig Blackmore <craig.blackmore@embecosm.com>,
gdb-patches@sourceware.org
Cc: aburgess@redhat.com, eliz@gnu.org
Subject: Re: [PATCH v5 1/1] gdb: Add python support for transforming register unwind values
Date: Wed, 12 Aug 2026 10:43:56 -0400 [thread overview]
Message-ID: <94197116-e5d5-4c96-9acc-76b72cf544c4@simark.ca> (raw)
In-Reply-To: <20260608120437.566738-2-craig.blackmore@embecosm.com>
On 6/8/26 8:04 AM, Craig Blackmore wrote:
> 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, gdb will call out to
> extension languages to allow the value to be transformed. This avoids
> having to write a new unwinder and allows the standard unwinders to be
> used.
>
> This patch adds the python class
> `gdb.unwinder.UnwindRegisterValueTransformer` which is the base class
> for transformers which provide a `read` method for transforming unwind
> register values that have been read. There is no similar support for
> transforming values being written back to the target as this was not
> something I needed to be able to do. Such support can be added to the
> python API in future by supporting a `write` method. Currently writing
> back to a transformed register will produce an "Attempt to assign to an
> unmodifiable value" error.
>
> Only one transformer can be registered globally at any one time.
> Attempting to register more than one transformer or to any other locus
> produces an error. The function for registering transformers takes a
> locus to allow other loci to be supported in future. Registered
> transformers are stored in a list so that registering multiple
> transformers may be supported in future.
>
> `gdbpy_get_register_descriptor` is now externally visible as it is used
> to create a gdb.RegisterDescriptor object to pass to the `read` method.
>
> This patch adds read-only attribute `gdb.Value.lval_type` which
> transformer methods can use to decide to skip modifying values that did
> not come directly from the target and may not need transforming, for
> example, values taken directly from DWARF.
I remember that when discussing DWARF locations on the stack things with
Pedro (upcoming DWARF 6 features), and how GDB would implement them, the
conclusion was that the lval_type enum was really conflating two things
that should be orthogonal. If I remember correctly, I think that it
should be two axis:
- the location part: where are the bits located (register, memory,
nowhere)
- the lval-ness: is this a value that can be assigned
The details are blurry because it's been a while, and unfortunately
Pedro is OOO at the moment. I'd like to have a chat with him about this
once he's back, before we expose this concept to Python. It might just
be a matter of choosing a future-proof name for the new property. From
what I understand, what you care about in the
UnwindRegisterValueTransformer implementation is the "location" aspect
of it, so perhaps the property name could convey just that, and not the
"lval" aspect.
Simon
next prev parent reply other threads:[~2026-08-12 14:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-10 11:04 [RFC PATCH] gdb: Add python support for demangling " Craig Blackmore
2025-04-10 12:31 ` Eli Zaretskii
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-08-12 14:43 ` Simon Marchi [this message]
2026-08-21 10:39 ` Craig Blackmore
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=94197116-e5d5-4c96-9acc-76b72cf544c4@simark.ca \
--to=simark@simark.ca \
--cc=aburgess@redhat.com \
--cc=craig.blackmore@embecosm.com \
--cc=eliz@gnu.org \
--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