From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KQM5KIiSuGnFlSwAWB0awg (envelope-from ) for ; Mon, 16 Mar 2026 19:30:16 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=cijZyUSV; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A0E0F1E0BC; Mon, 16 Mar 2026 19:30:16 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 29C5A1E08C for ; Mon, 16 Mar 2026 19:30:16 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id C7FEA4BB3B8E for ; Mon, 16 Mar 2026 23:30:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C7FEA4BB3B8E Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=cijZyUSV Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 0045C4BA2E18 for ; Mon, 16 Mar 2026 23:29:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0045C4BA2E18 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0045C4BA2E18 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773703769; cv=none; b=B0loz+yVBFlxhlXdPVpKpkzR4Xt8aFHPEXNXCoIm3C5uT+j4mB56aeeUvFEPz7YcTbwv9Jumksmi4dEO2dFNAQFn9QZFaHAkZRrGWHWjl/H/3hcknx8c5U9yXjmQoKyhPFMSDeYupGlwV73t96BG9jwJ+R9vnMB2xuXNXaYf/ww= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773703769; c=relaxed/simple; bh=gV7NiVS5N/43cJVMkl6RMriRlOFuvTBMd+/52R6PlCo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=XG51df+wy+caOW3CtYAEmbE8oA8FzF++lyIxD+US25pxONbhXlepjV5RfvpwqHGGykHftyI4I9KAk4aeJFJRgLRX9OdnUVav+dnVHUAS/aIsDhbX2HmL/aDvGGbsNxq9nGxyr2aqUrzIM6rssPgnfjEfAgpBdbyDnYZzEjZUSOg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0045C4BA2E18 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 62GNTNPZ240311 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Mar 2026 19:29:27 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 62GNTNPZ240311 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1773703768; bh=kF4/tnzon0rmPs32XM3Yd7GaT9o0yWQC7xGNRxni6uM=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=cijZyUSVbVf71jc3SYviV/4pHd3A/9DndwS8cOjmp3gi726xFHe511BSelo0gOcjs t1VWW1sBHtOIQiuFdBIKly9/t6cdkDqAbzLoYTBSafWyZJARNeBuicslCC/pI2vuYA f0Kar7ElASxB0owj8BLOkmH5U8i6+HxTECEjFojGC8OPvC9TvjYEkZz9ogK5mO+RUL Y3nOW20gVlkR2ws1BAlWS+riEjK1B5GqQxbwbdkcEJTAye+BjqQs1sM/ZqBVIm7ooi t+PukBLT6Zso7Z5tQ5JhYpDiMIV3fz6sz01TUbHkCiO9XO9kNvEPT5dDxJFTRPWTng NOrFYILxM4aSw== Received: by simark.ca (Postfix) id 348951E0E2; Mon, 16 Mar 2026 19:20:53 -0400 (EDT) From: simon.marchi@polymtl.ca To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 7/8] gdb/dwarf: add more context to complaints in mapped_debug_names_reader::scan_one_entry Date: Mon, 16 Mar 2026 19:19:25 -0400 Message-ID: <20260316232042.368080-8-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260316232042.368080-1-simon.marchi@polymtl.ca> References: <20260316232042.368080-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 16 Mar 2026 23:29:23 +0000 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 From: Simon Marchi I realize that complaints are not often enabled and shown, but if we emit them, I think they should include enough context to help a user who wishes to dig in the problem to pinpoint where the problem happened exactly. For this reason, change the complaints in mapped_debug_names_reader::scan_one_entry to include precisions regarding which index entry is problematic exactly. I am not attached to the particular format. I thought that because this is extra contextual information, I would put it in the square brackets at the end (which only shows the module name currently). However, it would be nice to converge towards a format that we could replicate elsewhere in the DWARF reader, so feel free to chime in. I factored out the formatting to a separate function, because I will be adding more of these in a subsequent patch, and it's easier to have the formatting centralized. I have not touched the "Unsupported .debug_names form" warning. If that comes up, we probably don't care about the specific index entry, we just need to implement support for that form. Change-Id: Id68a0ae406a3ca620408576b81f893f05c7e3df2 --- gdb/dwarf2/read-debug-names.c | 43 ++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/gdb/dwarf2/read-debug-names.c b/gdb/dwarf2/read-debug-names.c index 6ac65d101b16..487e2ea87edb 100644 --- a/gdb/dwarf2/read-debug-names.c +++ b/gdb/dwarf2/read-debug-names.c @@ -155,6 +155,25 @@ struct mapped_debug_names_reader std::vector> all_entries; }; +/* Emit a complaint about a specific index entry. */ + +static void ATTRIBUTE_PRINTF (4, 5) +complain_about_index_entry (bfd *abfd, const char *name, + ptrdiff_t offset_in_entry_pool, const char *fmt, + ...) +{ + va_list ap; + va_start (ap, fmt); + std::string msg = string_vprintf (fmt, ap); + va_end (ap); + + msg += string_printf (_(" [in module %s, index entry for name %s," + " entry pool offset 0x%tx]"), + bfd_get_filename (abfd), name, offset_in_entry_pool); + + complaint ("%s", msg.c_str ()); +} + /* Scan a single entry from the entries table. Set *RESULT and PARENT (if needed) and return the updated pointer on success, or return nullptr on error, or at the end of the table. */ @@ -180,9 +199,11 @@ mapped_debug_names_reader::scan_one_entry (const char *name, const auto indexval_it = abbrev_map.find (abbrev); if (indexval_it == abbrev_map.cend ()) { - complaint (_("Wrong .debug_names undefined abbrev code %s " - "[in module %s]"), - pulongest (abbrev), bfd_get_filename (abfd)); + complain_about_index_entry (abfd, name, offset_in_entry_pool, + _("Wrong .debug_names abbrev code %s"), + pulongest (abbrev)); + /* We can't go past this entry because we don't know its size, stop + reading this entry chain. */ return nullptr; } @@ -264,10 +285,10 @@ mapped_debug_names_reader::scan_one_entry (const char *name, /* Don't crash on bad data. */ if (ull >= this->comp_units.size ()) { - complaint (_(".debug_names entry has bad CU index %s" - " [in module %s]"), - pulongest (ull), - bfd_get_filename (abfd)); + complain_about_index_entry + (abfd, name, offset_in_entry_pool, + _(".debug_names entry has bad CU index %s"), + pulongest (ull)); continue; } @@ -279,10 +300,10 @@ mapped_debug_names_reader::scan_one_entry (const char *name, /* Don't crash on bad data. */ if (ull >= this->type_units.size ()) { - complaint (_(".debug_names entry has bad TU index %s" - " [in module %s]"), - pulongest (ull), - bfd_get_filename (abfd)); + complain_about_index_entry + (abfd, name, offset_in_entry_pool, + _(".debug_names entry has bad TU index %s"), + pulongest (ull)); continue; } -- 2.53.0