From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 62E5D3858D3C; Wed, 29 Jun 2022 14:53:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 62E5D3858D3C From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug symtab/27981] [gdb/symtab] CU importing itself causes gdb to segfault Date: Wed, 29 Jun 2022 14:53:00 +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: 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: Wed, 29 Jun 2022 14:53:00 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27981 --- Comment #2 from Tom de Vries --- Ad-hoc fixes to make the test-case pass: ... diff --git a/gdb/block.c b/gdb/block.c index 26126f5b76f..94feeb0f87c 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -488,7 +488,7 @@ initialize_block_iterator (const struct block *block, /* If this is an included symtab, find the canonical includer and use it instead. */ - while (cu->user !=3D NULL) + while (cu->user !=3D NULL && cu->user !=3D cu) cu =3D cu->user; /* Putting this check here simplifies the logic of the iterator diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index a36f25f4e62..9859328c276 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -18258,6 +18258,9 @@ cooked_indexer::index_imported_unit (cutu_reader *reader, dwarf2_per_objfile *per_objfile =3D reader->cu->per_objfile; cutu_reader *new_reader =3D ensure_cu_exists (reader, per_objfile, sect_= off, is_dwz, true); + if (new_reader =3D=3D reader) + return info_ptr; + if (new_reader !=3D nullptr) { index_dies (new_reader, new_reader->info_ptr, nullptr, false); ... --=20 You are receiving this mail because: You are on the CC list for the bug.=