public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug symtab/25700] Forward-imported CU causes duplicate partial symtab
Date: Fri, 27 Mar 2020 12:50:55 +0000	[thread overview]
Message-ID: <bug-25700-4717-X9sDRJTCA8@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-25700-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=25700

--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #5)
> (In reply to Tom de Vries from comment #3)
> > Tentative patch:
> > ...
> > diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
> > index 0e879e08a0..97f7c8f003 100644
> > --- a/gdb/dwarf2/read.c
> > +++ b/gdb/dwarf2/read.c
> > @@ -7808,7 +7808,12 @@ dwarf2_build_psymtabs_hard (struct dwarf2_per_objfile
> > *dwarf2_per_objfile)
> >                            addrmap_create_mutable (&temp_obstack));
> >  
> >    for (dwarf2_per_cu_data *per_cu : dwarf2_per_objfile->all_comp_units)
> > -    process_psymtab_comp_unit (per_cu, false, language_minimal);
> > +    {
> > +      if (per_cu->v.psymtab != NULL)
> > +       /* In case a forward DW_TAG_imported_unit has read the CU already. 
> > */
> > +       continue;
> > +      process_psymtab_comp_unit (per_cu, false, language_minimal);
> > +    }
> >  
> >    /* This has to wait until we read the CUs, we need the list of DWOs.  */
> >    process_skeletonless_type_units (dwarf2_per_objfile);
> > ...
> 
> I've tested the patch using target board
> unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects in combination with
> gcc-9, and I see a regression:
> ...
> FAIL: gdb.ada/char_enum.exp: ptype pck.Global_Enum_Type
> FAIL: gdb.ada/char_enum.exp: print pck.Global_Enum_Type'('x')
> FAIL: gdb.ada/char_enum.exp: print pck.Global_Enum_Type'('Y')
> FAIL: gdb.ada/char_enum.exp: print pck.Global_Enum_Type'('+')
> ...
> 
> Minimal example:
> ...
> $ gdb outputs/gdb.ada/char_enum/foo -batch  -ex "b foo.adb:23" -ex r  -ex
> "ptype pck.Global_Enum_Type" 
> Breakpoint 1 at 0x402c62: file
> /data/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/char_enum/
> foo.adb, line 23.
> 
> Breakpoint 1, foo () at
> /data/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/char_enum/
> foo.adb:23
> 23         Do_Nothing (Char'Address);  -- STOP
> No definition of "pck.global_enum_type" in current context.
> ...

Tentative patch:
...
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index bdc893d7ad..a31c03fa51 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -5840,7 +5840,7 @@ struct dwarf2_include_psymtab : public partial_symtab
       return;
     /* It's an include file, no symbols to read for it.
        Everything is in the parent symtab.  */
-    read_dependencies (objfile);
+    dependencies[0]->read_symtab (objfile);
     m_readin = true;
   }

...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2020-03-27 12:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-19 13:36 [Bug gdb/25700] New: " vries at gcc dot gnu.org
2020-03-19 13:37 ` [Bug gdb/25700] " vries at gcc dot gnu.org
2020-03-19 13:58 ` vries at gcc dot gnu.org
2020-03-19 14:06 ` vries at gcc dot gnu.org
2020-03-20 13:55 ` [Bug symtab/25700] " vries at gcc dot gnu.org
2020-03-24 13:01 ` vries at gcc dot gnu.org
2020-03-24 13:05 ` vries at gcc dot gnu.org
2020-03-24 13:36 ` vries at gcc dot gnu.org
2020-03-24 14:17 ` vries at gcc dot gnu.org
2020-03-27 12:50 ` vries at gcc dot gnu.org [this message]
2020-03-31 10:17 ` cvs-commit at gcc dot gnu.org
2020-04-08 10:20 ` vries at gcc dot gnu.org
2020-04-22  6:09 ` cvs-commit at gcc dot gnu.org
2020-04-22  6:11 ` vries at gcc dot gnu.org

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=bug-25700-4717-X9sDRJTCA8@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).