From: Tom Tromey <tom@tromey.com>
To: Jielun Wu <firmiana402@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: Preserve the operand type in DW_OP_plus_uconst
Date: Fri, 23 Oct 2026 11:56:26 -0600 [thread overview]
Message-ID: <87tsmcqp11.fsf@tromey.com> (raw)
In-Reply-To: <20260811093420.3948263-1-firmiana402@gmail.com> (Jielun Wu's message of "Tue, 11 Aug 2026 17:34:20 +0800")
>>>>> Jielun Wu <firmiana402@gmail.com> writes:
> DWARF v5 requires DW_OP_plus_uconst to interpret its unsigned LEB128
> constant as the type of the popped stack entry and push a result of that
> same type. GDB instead reconstructs the result using address_type,
> discarding an explicit base type.
> Construct the result using the popped value's type.
Thank you for the patch.
> + DW_AT_location {
> + variable _constants
> + variable _cu_label
> +
> + _op .byte $_constants(DW_OP_const_type)
> + _op .uleb128 "$uint32_label - $_cu_label" \
> + "base type DIE offset"
> + _op .byte 4 "constant size"
> + _op .4byte 40 "constant data"
> + DW_OP_plus_uconst 1
> + _op .byte $_constants(DW_OP_const_type)
> + _op .uleb128 "$uint32_label - $_cu_label" \
> + "base type DIE offset"
> + _op .byte 4 "constant size"
> + _op .4byte 1 "constant data"
I think it would be better to implement direct support for
DW_OP_const_type in dwarf.exp and move this logic there.
The new proc could require a label, which I think is already done in
some cases, e.g., DW_OP_GNU_variable_value.
thanks,
Tom
prev parent reply other threads:[~2026-10-23 17:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 9:34 Jielun Wu
2026-10-23 17:56 ` Tom Tromey [this message]
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=87tsmcqp11.fsf@tromey.com \
--to=tom@tromey.com \
--cc=firmiana402@gmail.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