Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Jan Vraný" <Jan.Vrany@labware.com>
To: "tom@tromey.com" <tom@tromey.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH 1/7] gdb: implement readnow_functions::find_pc_sect_compunit_symtab
Date: Fri, 20 Feb 2026 12:36:31 +0000	[thread overview]
Message-ID: <6bdb19fc83d8e9c75a32947f1420bfca30a375eb.camel@labware.com> (raw)
In-Reply-To: <87ms144i5r.fsf@tromey.com>

On Thu, 2026-02-19 at 13:01 -0700, Tom Tromey wrote:
> > > > > > "Jan" == Jan Vrany <jan.vrany@labware.com> writes:
> 
> Jan> +struct compunit_symtab *
> Jan> +readnow_functions::find_pc_sect_compunit_symtab
> Jan> +     (struct objfile *objfile,
> Jan> +      bound_minimal_symbol msymbol,
> Jan> +      CORE_ADDR pc,
> Jan> +      struct obj_section *section,
> Jan> +      int warn_if_readin)
> Jan> +{
> Jan> +  dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
> Jan> +  dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
> Jan> +
> Jan> +  /* This invariant is documented in read.h  */
> Jan> +  gdb_assert (per_bfd->index_table == nullptr);
> Jan> +
> Jan> +  /* Since we have no index, we simply walk all units until matching CU is
> Jan> +     found (of there are no more CUs).  */
> Jan> +  for (int i = 0; i < per_bfd->all_units.size (); i++)
> Jan> +    {
> Jan> +      dwarf2_per_cu *data = per_bfd->all_units[i].get ();
> Jan> +      compunit_symtab *result = find_pc_sect_compunit_symtab_includes (
> Jan> +	dw2_instantiate_symtab (data, per_objfile, false), pc);
> 
> There shouldn't be any need to instantiate a symtab here, since for
> readnow they are all already expanded.

Not always. dwarf2_base_index_functions::expand_all_symtabs skips 
"partial symtabs", so in some cases not all symtabs are instantiated.

An example of this is dwz-symtabs.exp. If I change the code as

--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2181,8 +2181,10 @@ readnow_functions::find_pc_sect_compunit_symtab
   for (int i = 0; i < per_bfd->all_units.size (); i++)
     {
       dwarf2_per_cu *data = per_bfd->all_units[i].get ();
-      compunit_symtab *result = find_pc_sect_compunit_symtab_includes (
-       dw2_instantiate_symtab (data, per_objfile, false), pc);
+
+      gdb_assert (per_objfile->symtab_set_p (data));
+      compunit_symtab *result = find_pc_sect_compunit_symtab_includes
+       (per_objfile->get_symtab (data), pc);
       if (result != nullptr)
        return result;
     }

I get an assertion failure. 

dw2_instantiate_symtab checks if the symtab has been instantiated and if 
yes, it's an no-op so calling it should not hurt much.

Jan

> 
> Tom


  reply	other threads:[~2026-02-20 12:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-19 18:56 [PATCH 0/7] Remove addrmap from blockvector Jan Vrany
2026-02-19 18:56 ` [PATCH 1/7] gdb: implement readnow_functions::find_pc_sect_compunit_symtab Jan Vrany
2026-02-19 20:01   ` Tom Tromey
2026-02-20 12:36     ` Jan Vraný [this message]
2026-02-20 14:25       ` Tom Tromey
2026-02-20 15:57         ` Jan Vraný
2026-02-19 18:56 ` [PATCH 2/7] gdb: update expanded_symbols_functions::find_pc_sect_compunit_symtab Jan Vrany
2026-02-19 20:02   ` Tom Tromey
2026-02-19 18:56 ` [PATCH 3/7] gdb: simplify find_compunit_symtab_for_pc_sect Jan Vrany
2026-02-19 20:02   ` Tom Tromey
2026-02-20 12:40     ` Jan Vraný
2026-02-20 14:25       ` Tom Tromey
2026-02-26 15:00     ` Jan Vraný
2026-02-19 18:56 ` [PATCH 4/7] gdb: do not set blockvector address map Jan Vrany
2026-02-19 20:03   ` Tom Tromey
2026-02-20 12:42     ` Jan Vraný
2026-02-19 18:56 ` [PATCH 5/7] gdb: update blockvector::lookup to handle non-contiguous blocks Jan Vrany
2026-02-19 20:06   ` Tom Tromey
2026-02-19 20:20   ` Tom Tromey
2026-02-20 13:03     ` Jan Vraný
2026-02-20 16:38       ` Tom Tromey
2026-03-03 11:06         ` Jan Vraný
2026-03-09 15:52         ` Jan Vraný
2026-02-19 18:56 ` [PATCH 6/7] gdb: remove address map from struct blockvector Jan Vrany
2026-02-19 18:56 ` [PATCH 7/7] gdb: add unit test for blockvector::lookup of non-contiguous blocks Jan Vrany
2026-02-19 20:12   ` Tom Tromey

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=6bdb19fc83d8e9c75a32947f1420bfca30a375eb.camel@labware.com \
    --to=jan.vrany@labware.com \
    --cc=gdb-patches@sourceware.org \
    --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