From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QCD7JS1BGmhGhBcAWB0awg (envelope-from ) for ; Tue, 06 May 2025 13:04:45 -0400 Received: by simark.ca (Postfix, from userid 112) id 8231D1E114; Tue, 6 May 2025 13:04:45 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.0 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=unavailable autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 9A6961E089 for ; Tue, 6 May 2025 13:04:44 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2BC093858405 for ; Tue, 6 May 2025 17:04:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BC093858405 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id D5A143858C60 for ; Tue, 6 May 2025 17:04:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D5A143858C60 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D5A143858C60 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1746551049; cv=none; b=nZ5pJmPDHL8WQJgjwK5fNc6pVDXQ0tRXU8oKkzWa5WFGwwDohO9MytIY+97y7+cwM1QgCfyIPQrySDsJlyaPxmxHQl0t1uUNA+8KOmbdVTZcMeXz+JklK2/P0Z0a1vP+5FLrFmenYEz+9h5hn5Js0UNRN5ccF4Zw1S0d3TWNgds= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1746551049; c=relaxed/simple; bh=xfiOZd8F//uB/1oDaI89XZreu7lBKofi8QaV2if29GI=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=VU7L9KGKEX1YQooSAEuuEokeMODvjYJlectwb1LnhSTSSeL+cH176ewRAxEjVSppw/v/SqZo4DOaFQ6VFZ1YLFA0GOOcwOtssn6iClIJnRlXJ7Yj/EF6uJMIaWk3OojCA7peI41CnI6HSrhSGYlllcjNkK0Taauldn9YZJrkDGE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5A143858C60 Received: by simark.ca (Postfix, from userid 112) id 760AE1E11C; Tue, 6 May 2025 13:04:09 -0400 (EDT) Received: from smarchi-efficios.internal.efficios.com (96-127-217-162.qc.cable.ebox.net [96.127.217.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 4CE441E0C1; Tue, 6 May 2025 13:04:08 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 2/2] gdb/dwarf: skip broken .debug_macro.dwo Date: Tue, 6 May 2025 13:03:47 -0400 Message-ID: <20250506170406.124741-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250506170406.124741-1-simon.marchi@efficios.com> References: <20250506170406.124741-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Running gdb.base/errno.exp with gcc <= 13 with split DWARF results in: $ make check TESTS="gdb.base/errno.exp" RUNTESTFLAGS="CC_FOR_TARGET=gcc-13 --target_board=fission" (gdb) break -qualified main /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:7549: internal-error: locate_dwo_sections: Assertion `!dw_sect->readin' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. ... FAIL: gdb.base/errno.exp: macros: gdb_breakpoint: set breakpoint at main (GDB internal error) The assert being hit has been added in 28f15782adab ("gdb/dwarf: read multiple .debug_info.dwo sections"), but it merely exposed an existing problem. gcc versions <= 13 are affected by this bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111409 Basically, it produces .dwo files with multiple .debug_macro.dwo sections, with some unresolved links between them. I think that this macro debug info is unusable, and all we can do is ignore it. In locate_dwo_sections, if we detect a second .debug_macro.dwo section, forget about the previous .debug_macro.dwo and any subsequent one. This will effectively make it as if the macro debug info wasn't there at all. The errno test seems happy with it: # of expected passes 84 # of expected failures 8 Change-Id: I6489b4713954669bf69f6e91865063ddcd1ac2c8 --- gdb/dwarf2/read.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 550968abc95c..63c0c007563e 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -7516,6 +7516,7 @@ cutu_reader::locate_dwo_sections (objfile *objfile, dwo_file &dwo_file) { const struct dwop_section_names *names = &dwop_section_names; dwo_sections &dwo_sections = dwo_file.sections; + bool complained_about_macro_already = false; for (asection *sec : gdb_bfd_sections (dwo_file.dbfd)) { @@ -7534,7 +7535,24 @@ cutu_reader::locate_dwo_sections (objfile *objfile, dwo_file &dwo_file) else if (names->macinfo_dwo.matches (sec->name)) dw_sect = &dwo_sections.macinfo; else if (names->macro_dwo.matches (sec->name)) - dw_sect = &dwo_sections.macro; + { + /* gcc versions <= 13 generate multiple .debug_macro.dwo sections with + some unresolved links between them. It's not usable, so do as if + there were not there. */ + if (!complained_about_macro_already) + { + if (dwo_sections.macro.s.section == nullptr) + dw_sect = &dwo_sections.macro; + else + { + complaint (_("Multiple .debug_macro.dwo sections found in " + "%s, ignoring them."), dwo_file.dbfd->filename); + + dwo_sections.macro = dwarf2_section_info {}; + complained_about_macro_already = true; + } + } + } else if (names->rnglists_dwo.matches (sec->name)) dw_sect = &dwo_sections.rnglists; else if (names->str_dwo.matches (sec->name)) -- 2.49.0