Summary: | [gdb/symtab] hang in inherit_abstract_dies | ||
---|---|---|---|
Product: | gdb | Reporter: | Tom de Vries <vries> |
Component: | symtab | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | HEAD | ||
Target Milestone: | 14.1 | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
Tom de Vries
2023-08-28 04:24:08 UTC
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 ... 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 Fixed. |