From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 5/6] Return void from buildsym_compunit::push_context
Date: Fri, 17 Apr 2026 16:22:22 -0400 [thread overview]
Message-ID: <bbf9b2c8-ad9a-4fc7-9c54-db40dae55f3d@simark.ca> (raw)
In-Reply-To: <20260417-list-in-scope-v1-5-0deb050fc03d@adacore.com>
On 4/17/26 2:24 PM, Tom Tromey wrote:
> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
> index 4447923ae3e..2a330655c48 100644
> --- a/gdb/dwarf2/read.c
> +++ b/gdb/dwarf2/read.c
> @@ -7799,10 +7799,11 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
> }
> }
>
> - gdb_assert (cu->get_builder () != nullptr);
> - context_stack &ctx = cu->get_builder ()->push_context (lowpc);
> + buildsym_compunit *builder = cu->get_builder ();
> + gdb_assert (builder != nullptr);
> + builder->push_context (lowpc);
> symbol *func_sym = new_symbol (die, read_type_die (die, cu), cu, templ_func);
> - ctx.name = func_sym;
> + builder->set_current_context_function (func_sym);
It might be tricky depending on how new_symbol uses the current context
when reading a DW_TAG_subprogram, but I wonder if we could call
new_symbol first, then pass the resulting symbol to push_context. Then
we wouldn't need to have a setter. If that's possible, I think it would
be slightly better, because it would show that the symbol is initialized
when the context is pushed and can't change. Other callers of
push_context would pass a nullptr symbol.
Simon
next prev parent reply other threads:[~2026-04-17 20:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-17 18:24 [PATCH 0/6] Some buildsym cleanups Tom Tromey
2026-04-17 18:24 ` [PATCH 1/6] Use scoped_restore for dwarf2_cu::list_in_scope Tom Tromey
2026-04-17 18:24 ` [PATCH 2/6] Remove some dead code from buildsym.c Tom Tromey
2026-04-17 20:10 ` Simon Marchi
2026-04-17 18:24 ` [PATCH 3/6] Remove context_stack::depth Tom Tromey
2026-04-17 18:24 ` [PATCH 4/6] Change pop_context to return a block Tom Tromey
2026-04-17 20:11 ` Simon Marchi
2026-04-17 18:24 ` [PATCH 5/6] Return void from buildsym_compunit::push_context Tom Tromey
2026-04-17 20:22 ` Simon Marchi [this message]
2026-04-17 18:24 ` [PATCH 6/6] Rename context_stack and make it private Tom Tromey
2026-04-17 20:24 ` [PATCH 0/6] Some buildsym cleanups Simon Marchi
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=bbf9b2c8-ad9a-4fc7-9c54-db40dae55f3d@simark.ca \
--to=simark@simark.ca \
--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