From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F3EE838708C7; Mon, 19 Oct 2020 12:21:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F3EE838708C7 From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug symtab/26327] GDB hangs in get_builder() due to recursive ancestor pointers Date: Mon, 19 Oct 2020 12:21:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: symtab X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Oct 2020 12:21:23 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26327 Tom de Vries changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |keiths at redhat dot com, | |tromey at sourceware dot o= rg --- Comment #6 from Tom de Vries --- Tentative patch, prevents introducing cycles in ancestor chain: ... diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 37409c5c3f..72e5446b8b 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -22947,7 +22947,19 @@ follow_die_offset (sect_offset sect_off, int offset_in_dwz, temp_die.sect_off =3D sect_off; if (target_cu !=3D cu) - target_cu->ancestor =3D cu; + { + bool cycle_p =3D false; + for (struct dwarf2_cu *tmp =3D cu->ancestor; tmp; tmp =3D tmp->ances= tor) + { + if (tmp !=3D target_cu) + continue; + + cycle_p =3D true; + break; + } + if (!cycle_p) + target_cu->ancestor =3D cu; + } return (struct die_info *) htab_find_with_hash (target_cu->die_hash, &temp_die, @@ -24256,7 +24268,8 @@ dwarf2_cu::dwarf2_cu (dwarf2_per_cu_data *per_cu, producer_is_icc (false), producer_is_icc_lt_14 (false), producer_is_codewarrior (false), - processing_has_namespace_info (false) + processing_has_namespace_info (false), + ancestor (nullptr) { } ... --=20 You are receiving this mail because: You are on the CC list for the bug.=