public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/30799] New: [gdb/symtab] hang in inherit_abstract_dies
@ 2023-08-28  4:24 vries at gcc dot gnu.org
  2023-08-28  4:25 ` [Bug symtab/30799] " vries at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-28  4:24 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30799
           Summary: [gdb/symtab] hang in inherit_abstract_dies
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

I build gdb with gcc 7.5.0 and -O2 -flto -flto-partition=one, and ran into
timeouts in gdb.gdb/*.exp.

The hang seems to be related to a self-referencing DIE:
...
 <2><91dace>: Abbrev Number: 405 (DW_TAG_label)
    <91dad0>   DW_AT_abstract_origin: <0x91dace>
...

We're stuck in this loop in inherit_abstract_dies:
...
      /* For each CHILD_DIE, find the corresponding child of                    
         ORIGIN_DIE.  If there is more than one layer of                        
         DW_AT_abstract_origin, follow them all; there shouldn't be,            
         but GCC versions at least through 4.4 generate this (GCC PR            
         40573).  */
      die_info *child_origin_die = child_die;
      dwarf2_cu *child_origin_cu = cu;
      while (true)
        {
          attr = dwarf2_attr (child_origin_die, DW_AT_abstract_origin,
                              child_origin_cu);
          if (attr == nullptr)
            break;


          child_origin_die = follow_die_ref (child_origin_die, attr,
                                             &child_origin_cu);
        }
...

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug symtab/30799] [gdb/symtab] hang in inherit_abstract_dies
  2023-08-28  4:24 [Bug symtab/30799] New: [gdb/symtab] hang in inherit_abstract_dies vries at gcc dot gnu.org
@ 2023-08-28  4:25 ` vries at gcc dot gnu.org
  2023-08-28  6:36 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-28  4:25 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index eb4cb9ba72e..d68882ae657 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -9935,8 +9935,12 @@ inherit_abstract_dies (struct die_info *die, struct
dwarf2_cu *cu)
          if (attr == nullptr)
            break;

+         die_info *prev_child_origin_die = child_origin_die;
          child_origin_die = follow_die_ref (child_origin_die, attr,
                                             &child_origin_cu);
+         if (prev_child_origin_die == child_origin_die)
+           break;
        }

       /* If missing DW_AT_abstract_origin, try the corresponding child
...

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug symtab/30799] [gdb/symtab] hang in inherit_abstract_dies
  2023-08-28  4:24 [Bug symtab/30799] New: [gdb/symtab] hang in inherit_abstract_dies vries at gcc dot gnu.org
  2023-08-28  4:25 ` [Bug symtab/30799] " vries at gcc dot gnu.org
@ 2023-08-28  6:36 ` vries at gcc dot gnu.org
  2023-08-28 14:27 ` cvs-commit at gcc dot gnu.org
  2023-08-28 14:28 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-28  6:36 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2023-August/201914.html

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug symtab/30799] [gdb/symtab] hang in inherit_abstract_dies
  2023-08-28  4:24 [Bug symtab/30799] New: [gdb/symtab] hang in inherit_abstract_dies vries at gcc dot gnu.org
  2023-08-28  4:25 ` [Bug symtab/30799] " vries at gcc dot gnu.org
  2023-08-28  6:36 ` vries at gcc dot gnu.org
@ 2023-08-28 14:27 ` cvs-commit at gcc dot gnu.org
  2023-08-28 14:28 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-28 14:27 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8d83f51b91072bc3d79061eba7e564ba9be6afd7

commit 8d83f51b91072bc3d79061eba7e564ba9be6afd7
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Aug 28 16:27:58 2023 +0200

    [gdb/symtab] Handle self-reference in inherit_abstract_dies

    Building gdb with gcc 7.5.0 and -flto -O2 -flto-partition=one generates a
    self-referencing DIE:
    ...
     <2><91dace>: Abbrev Number: 405 (DW_TAG_label)
        <91dad0>   DW_AT_abstract_origin: <0x91dace>
    ...

    When encountering the self-reference DIE in inherit_abstract_dies we loop
    following the abstract origin, effectively hanging gdb.

    Fix this by handling self-referencing DIEs in the loop in
    inherit_abstract_dies.

    Tested on x86_64-linux.

    Approved-By: Tom Tromey <tom@tromey.com>

    PR symtab/30799
    https://sourceware.org/bugzilla/show_bug.cgi?id=30799

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug symtab/30799] [gdb/symtab] hang in inherit_abstract_dies
  2023-08-28  4:24 [Bug symtab/30799] New: [gdb/symtab] hang in inherit_abstract_dies vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-08-28 14:27 ` cvs-commit at gcc dot gnu.org
@ 2023-08-28 14:28 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-28 14:28 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |14.1
             Status|NEW                         |RESOLVED

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-28 14:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-28  4:24 [Bug symtab/30799] New: [gdb/symtab] hang in inherit_abstract_dies vries at gcc dot gnu.org
2023-08-28  4:25 ` [Bug symtab/30799] " vries at gcc dot gnu.org
2023-08-28  6:36 ` vries at gcc dot gnu.org
2023-08-28 14:27 ` cvs-commit at gcc dot gnu.org
2023-08-28 14:28 ` vries at gcc dot gnu.org

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).