From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org, Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH] gdb/dwarf2: pass around DWARF expressions as gdb::array_view
Date: Sat, 2 May 2026 00:14:59 -0400 [thread overview]
Message-ID: <716ea4a0-aef2-4a26-8b7d-7bc46eeda76d@polymtl.ca> (raw)
In-Reply-To: <87y0i3gkay.fsf@tromey.com>
On 2026-05-01 12:35, Tom Tromey wrote:
>>>>>> "Simon" == simon marchi <simon.marchi@polymtl.ca> writes:
>
> Simon> This patch converts a bunch of functions to take or return DWARF
> Simon> expressions as `gdb::array_view<const gdb_byte>`, instead of raw pointer
> Simon> and size. It doesn't do any non-trivial change to function
> Simon> implementations, but the idea is that we could change them (for example
> Simon> dwarf_expr_context::execute_stack_op) to operate on the array view
> Simon> directly, giving us bounds checking when building in debug mode. But
> Simon> that is not as trivial.
>
> I skimmed this and it seems fine to me.
> Approved-By: Tom Tromey <tom@tromey.com>
Thanks, pushed.
> Simon> This patch also doesn't change structure fields to array_views (for
> Simon> instance, dwarf2_loclist_baton), because that would make them
> Simon> non-trivially constructible, and we'd (technically) need to change how
> Simon> they are allocated.
>
> I thought this sounded backward but I suppose it refers to the fact that
> these are stored in a union inside dwarf2_property_baton.
>
> A fix for that might be to use a class hierarchy rather than a union.
Yes, I meant that we would start to have to call "new" on them. They
are currently allocated with XOBNEW, which is disallows on
non-trivially-constructible types. I guess that's what
allocate_on_obstack is for? Anyway, I had to stop somewhere with this
patch otherwise the scope creeps too far.
Simon
prev parent reply other threads:[~2026-05-02 4:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-29 0:55 simon.marchi
2026-05-01 16:35 ` Tom Tromey
2026-05-02 4:14 ` Simon Marchi [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=716ea4a0-aef2-4a26-8b7d-7bc46eeda76d@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@efficios.com \
--cc=tom@tromey.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