From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gXo3Ch1L6mmD/DYAWB0awg (envelope-from ) for ; Thu, 23 Apr 2026 12:38:53 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=j/3NpmCM; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 241C81E093; Thu, 23 Apr 2026 12:38:53 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,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 3384A1E093 for ; Thu, 23 Apr 2026 12:38:52 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 882BB4BABF3E for ; Thu, 23 Apr 2026 16:38:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 882BB4BABF3E Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=j/3NpmCM Received: from SN4PR0501CU005.outbound.protection.outlook.com (mail-southcentralusazon11011001.outbound.protection.outlook.com [40.93.194.1]) by sourceware.org (Postfix) with ESMTPS id B297D4BA23FC for ; Thu, 23 Apr 2026 16:38:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B297D4BA23FC Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=amd.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B297D4BA23FC Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.93.194.1 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1776962304; cv=pass; b=AEv3knpYJhptI+vhO2rJc6bdlvyEBXdGRfyYP8d7s6PDmUKbAmu/Q98Is6n1kWnXczGVWG4Ka2lYAoSkaJWF/OjjDfrJr44whepAlryCVIDF7KJ2hUKrnYqjVTFqS20xKlqeJaVcK6krR6B6P2KZiIvB3L+os5pFWLSOv9sw9zw= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1776962304; c=relaxed/simple; bh=QV8MtCfy6FVVZid17e5/VG/wllQh3LPnhRiA4gHsQYU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=E9Y4NhWQMXwUV5QpkL9XICHCT1JZR54DFGUXLGkr5xmYUWcgDesLWswMATOFLglAbSdHI/qrP2S2muO3W0tALBkF2J6iuKdalef5EJp1Wy9IvYpyLjddM0I6vbuV3+TrfO1xAfzLL9oe60Ioree0IkHcjsioq9iWL2aaJKc7LoI= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B297D4BA23FC ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vJDxIKQM3jbWlP0QRcLLCcgufdFFulJkKklsbuFhXjKojnaMu+IATV4rWSdqxZnMBjv+bmHLqkvGREsEFQbf2k+o7rh/p2XWVv3g6g3H1/ixpqNw5lBLs9iH82MeAycZmAk+pbEPY+Xwz4JLwNyp1vdPFkuFg9eBAqiqv/5mgAh7d0gHN+6WNLbvfpua9gpIcukcAJmdImIQwiuuMNYjhLZ+ImoKY/1J6kkZ3LJBbqLLH1EOnNwNofJH+GEARr01bIwohb8SopOyX9Fd2Q3ZNlaNhsz82DtNWnxmAcvizoyCxraRUk3+xtRVe5bmBDgCIVoe5ABFUiI4HzDjAqPheQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=33DAvOl9L0thQU2LyCryq6nFCLr1CtLf+Fnf4kRqVWQ=; b=kxMgrASoBUceJL+tju5xVBKMhejE7lwj/KkSaUwG5bvg/e7jtMoxmEkqss/4JsfaXnzYjzJ7Cffq83VBwBwkDolx5nUGmK3f1DwmRJguWCRufTFFZS4gGpnUVDnlyKKwvZOm43dZ3Vt2/H7mAM+ATXxULyW6Dq7a/eXshBSyI/0Iso4//uZdGKcLMEvsViZ+g7/0m64CwDePezzfq5wqWx67cQenrnG4pTVDcJPPTTa2/BtzjuY+FfSJ5ipXTI17IxZ9WWNaSZ0ia/EnhuPdWgtdyWSjBZgtT6qf3GbOX+aaFckVA/DhRW7TuHBMrRKEDVhquG8DmHhmMkchbp+Jlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=sourceware.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=33DAvOl9L0thQU2LyCryq6nFCLr1CtLf+Fnf4kRqVWQ=; b=j/3NpmCM4wjEyjS1XVyylfmCWbJB5rhI4J8VR1qmx3qvlDNRgr4tEdrQtN5/y5cJwKXGUHmyx/vmKIwMbeuTkceC/5QucLTxqPfmqLw9PHFswhTMKfHgVivLB5gedWgV1mqyqpvcOFpAsGitQyYj3ftp9+XwPuxMog4oL0QfPyc= Received: from MN0P220CA0011.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:52e::23) by DS0PR12MB8787.namprd12.prod.outlook.com (2603:10b6:8:14e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9846.20; Thu, 23 Apr 2026 16:38:16 +0000 Received: from MN1PEPF0000F0E5.namprd04.prod.outlook.com (2603:10b6:208:52e:cafe::a) by MN0P220CA0011.outlook.office365.com (2603:10b6:208:52e::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9846.21 via Frontend Transport; Thu, 23 Apr 2026 16:38:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by MN1PEPF0000F0E5.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9846.18 via Frontend Transport; Thu, 23 Apr 2026 16:38:11 +0000 Received: from ctr-s27-hpe-19.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 23 Apr 2026 11:38:05 -0500 From: Bratislav Filipovic To: CC: , , , Bratislav Filipovic Subject: [PATCH] dwarf2: avoid decoding .debug_line for type units Date: Thu, 23 Apr 2026 16:37:52 +0000 Message-ID: <20260423163752.3240149-1-bfilipov@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E5:EE_|DS0PR12MB8787:EE_ X-MS-Office365-Filtering-Correlation-Id: 0fd11b59-d855-4163-2609-08dea156b57e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700016|376014|1800799024|56012099003|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: WiS1rYVax2GNl9EJs7c3Htz/g27QI5lRMqT9UpcQNOhGBJ8FPS5bWt9vZ+O/uz/ibD4zrfswJfy3ekEB2Sw1GY+OJ0yd6mV5SFj3eJy52/zQkn+IRz/K/NjaMh8fKL09Is2f5c2AwDjFdC/T9T1VDPnoc4rDYdLCq3Ya8MaP/hnkctkeWMQNH/S1YUIEqwX5oQhGGgSMiU8gqPLXf9/1nS0W5QKDuouLWqHVWG4v++MR59gvaRbaU623bkhhvlNyBLurn7ZH8SqA7+ZdbEn1FkRj5txnSSevmdZGuaStJ7Yd0hIw6PZ/JgsZGUnzUK7aINVEsakM8HbswEplrD8nj+SiqhWJvoLQ7Ku6SSYy3MV6qFcsTAw0r/rI62TVCRFcDuIycsJ5hkxqobg7eQrO6HVDf7TJ1kTvi2wZ3DryYykNy3h9Kg6UDIe+1FkduCN5gEvc2rfAnKXghllAPZqPFjUhilzmt6QSSABqq5GHuCUdGr+rNBqnsC28S3pB1zuUFenRVGVN6gu9Fj4Tr7bPGe6cX8u4EGa9A6I1yDD88mSOqogHna+3g+q44qIh87+LMiu9+QV8UbmDkwgLfAn5eBDLRKoi/aYdw0r36uZLC10QixFwLjQVM3WMOLfmMxfkidc41ExHgurlyBOWWN0bHzBqr588yZgy4fWt/i0+si0VFhTi/B2ZRJcScH7NQHG0baPJB0C2seMLC77ZKFKXgiJqZ11lgjLQLqHAp3mIjKAqyRzIBTi2ckkHPPnFGT8ftMgqnapUR3C2CteAPavevg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(36860700016)(376014)(1800799024)(56012099003)(22082099003)(18002099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aaQglckVe+b7kuaNpQPFZNliS7wKZ594A1X9sUDK3/FP8Xn2ybcikPyeBkYdwrmfpYZuhdkp5TdSIEXyUynrQLdSNzd9RP/37ZokmAg24lQ1463SaoXPcUNg0xseRkwR0ibVi6rMPwn02lFEsd6K2o9g3eXpOWaeJiOpXvCLZc/DOzNQZl/Y4mXNUXAXuEHxmLLjyUu9qZyfnNHR9WbYmM2PemdK8laudZLUrhb7bwDQGbKK7vWOdk6jMwfK72+vOUKhG/7+H4+sDcnoyNYskArdzuWWR3xai49k2X3YRjEIs9+PXhFgyrCFEqcEeWNTfuquWLNWZqLTfkjcjbSfGlndM40U+NoXJKoNXLsMLS6GhMHb1n5/vAdtwrThAJ88YfOTVp/qC+uj4usQcXOIf3BedC5LfvlmGdGez0+Ijkge/ixOsH6qoQKaIxZXSxOD X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Apr 2026 16:38:11.6930 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0fd11b59-d855-4163-2609-08dea156b57e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000F0E5.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8787 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.dwarf2/pr13961.exp with clang fails with an internal error: gdb/dwarf2/read.c: internal-error: decode_line_header_for_cu: Assertion `!cu->per_cu->is_debug_types ()' failed. pr13961 is a legacy .S test that references a .debug_line label from both a CU and a TU. The assembly includes an empty .debug_line section declaration: .section .debug_line,"",%progbits .Ldebug_line0: With gcc this results in a dummy (valid, but content-less) .debug_line header being emitted, so GDB can build a line header and resolve file indices. With clang the .debug_line section can be missing/empty, leaving the line header unset. During symbol creation, new_symbol may then try to lazily decode the CU-only line header while processing a type unit, which triggers the assertion above. Fix this by only decoding the line header for non-type units. If no line header is available, emit a complaint and continue without setting the symtab rather than attempting CU-only line decoding from a TU. Tested: gdb.dwarf2/pr13961.exp (CC_FOR_TARGET=clang-23) --- gdb/dwarf2/read.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index bc7b8b46d87..655cc753334 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -15430,21 +15430,21 @@ is_ada_import_or_export (dwarf2_cu *cu, const char *name, static void new_symbol_file_line (struct die_info *die, struct dwarf2_cu *cu, - struct symbol *sym) + struct symbol *sym) { bool inlined_func = (die->tag == DW_TAG_inlined_subroutine); /* Handle DW_AT_call_line / DW_AT_decl_line. */ struct attribute *attr = dwarf2_attr (die, inlined_func ? DW_AT_call_line : DW_AT_decl_line, - cu); + cu); if (attr != nullptr) sym->set_line (attr->unsigned_constant ().value_or (0)); /* Handle DW_AT_call_file / DW_AT_decl_file. */ struct dwarf2_cu *file_cu = cu; attr = dwarf2_attr (die, inlined_func ? DW_AT_call_file : DW_AT_decl_file, - &file_cu); + &file_cu); if (attr == nullptr) return; @@ -15452,16 +15452,27 @@ new_symbol_file_line (struct die_info *die, struct dwarf2_cu *cu, if (!index_cst.has_value ()) return; - if (file_cu->line_header == nullptr) + /* decode_line_header_for_cu is CU-only and asserts on debug_types. + For type units, the TU setup code runs before processing child DIEs, + so if line_header is still nullptr here it means there is no usable + line table for this unit. */ + if (file_cu->line_header == nullptr + && !file_cu->per_cu->is_debug_types ()) { file_and_directory fnd (nullptr, nullptr); decode_line_header_for_cu (file_cu->dies, file_cu, fnd); } file_name_index file_index = (file_name_index) *index_cst; - struct file_entry *fe = nullptr; - if (file_cu->line_header != nullptr) - fe = file_cu->line_header->file_name_at (file_index); + + /* Check if we successfully got line_header. */ + if (file_cu->line_header == nullptr) + { + complaint (_("missing .debug_line information to resolve file index")); + return; + } + + struct file_entry *fe = file_cu->line_header->file_name_at (file_index); if (fe == nullptr) { -- 2.43.0