From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id pPthDpuqumnI5y4AWB0awg (envelope-from ) for ; Wed, 18 Mar 2026 09:37:31 -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=ftGN66xE; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 295B11E08C; Wed, 18 Mar 2026 09:37:31 -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 9ADE71E08C for ; Wed, 18 Mar 2026 09:37:30 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 3BA264BC7EE0 for ; Wed, 18 Mar 2026 13:37:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BA264BC7EE0 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=ftGN66xE Received: from CH5PR02CU005.outbound.protection.outlook.com (mail-northcentralusazon11012025.outbound.protection.outlook.com [40.107.200.25]) by sourceware.org (Postfix) with ESMTPS id D0A434BBCDAD for ; Wed, 18 Mar 2026 13:37:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0A434BBCDAD 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 D0A434BBCDAD Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.200.25 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1773841021; cv=pass; b=C+RTDxtHlFgZ4k1120mdEXd9oUCUju+7zKRskIpRNn2SOLYStmj2iMyotxUeAewUs1VdgmpldV7qC4/iUMSaDwsUmK3Z+Q6ZEM8C5zr6jQZCtz8q7Ssb1oXG5DOx+Mf688rmcf154CppjhFs7EbcRi3zQ6sHGP2H3cm7I4jncLg= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1773841021; c=relaxed/simple; bh=YA8dj3awmSU8L52a22PAru2fRMCZRtJDm1/YP47Qk5c=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RJ+V3fTKGGuWTdem2JKzd5Tn8qn8/NnWAbY0CuxWoMKhrQdxxJOefhTQve5fpQOJyuR89DIjLooVrA3rx5Dvyrlye9l3pTtHavrZwDjhYBCGYe4HAUffhxgYV0PideeY8EGg6zabbWF6pYWB9xtBDFuRB/6cNeBtPgOORKy50tA= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D0A434BBCDAD ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=y9o15X50qb9R3SDPN+CDueFcSyV1WUjCg9J3vunbPjS/1JgGjwrT6rSMt//Zl5wI80coODz1sDMbx9FVGk1ZRLRLPNNHKPUc2oK62jrwKbAvw9Zw7liW0kpr8wNDbbYLhx2qQsFJ8+ZmDItRsACG9T65HrfARtP0KLguNUIb8KGaKyR+ak8+QPUVHYpsOEms9KomWrVZhjjC8rkmRvMfIITB55AEMKmD1nFwbKXl+fnuACwpeQHita0IZLRPfBh+X27c4n4uzlYUvaZSEEo/wdnlYTjZGRq1sqD9oH4wsp5OMxcQD2oCC/uw+h0fwD3k6NzPtoXQDSfR+kX7XJyYIw== 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=Ba/wjp/OEvKej8GphxzYKVC42Rsar379TDwf5fSpHLc=; b=UnCyDWsnfyUe3ZMxU0lrgm17W4pNS7dwiELvdzXOpWbEDe1qATI9Pnm+It6aXCnPRrwayq/WNl/NiPvr0dkfusEgPldPuQ5h4iNqJ8Scla5pn/Ta1uqGvjr819l+8pCdfSGEDkgAoyjG6GLjZAkUgl8xlH62s78MXcTZ8gORD4yINW1R1uEOMEoXuT9zp/ftrrUMrquPw2Qlef2QkwQ9ZGa9cacFv7ytTut7H2EjyNxzOBt2x7U34le+PxxGfH7gD2A+2yT3lE4/MN2/iZf1Rq784qDjgxGj66Tv1pZsI2DbWadR+SLDebfCbBVyovlqqqClPwMHJPOGISRXVg6FPA== 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=Ba/wjp/OEvKej8GphxzYKVC42Rsar379TDwf5fSpHLc=; b=ftGN66xE5CQJHvzXfcCB2tDGt6XSdVJ32mLsI8yCcpfWOrLRV+a+7Qj3yHDY/SnphSPSRJh5mHz2sfrBfQnGAhTIhviscOKQsHqRpi0Bb6k9LcYFzaRZ98FJGppBXD7Bj0mj8JP4btcECh8/zk+ZWrGXBt5vd1NbySk2YPOU6yk= Received: from SA0PR11CA0047.namprd11.prod.outlook.com (2603:10b6:806:d0::22) by DS7PR12MB8201.namprd12.prod.outlook.com (2603:10b6:8:ef::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9723.19; Wed, 18 Mar 2026 13:36:55 +0000 Received: from SN1PEPF0002BA50.namprd03.prod.outlook.com (2603:10b6:806:d0:cafe::6a) by SA0PR11CA0047.outlook.office365.com (2603:10b6:806:d0::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9700.27 via Frontend Transport; Wed, 18 Mar 2026 13:36:55 +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 SN1PEPF0002BA50.mail.protection.outlook.com (10.167.242.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9700.17 via Frontend Transport; Wed, 18 Mar 2026 13:36:55 +0000 Received: from rocm-BirmanPlus-KRK2e.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; Wed, 18 Mar 2026 08:36:51 -0500 From: Bratislav Filipovic To: CC: , Bratislav Filipovic Subject: [PATCH] dwarf2: avoid decoding .debug_line for type units Date: Wed, 18 Mar 2026 19:05:37 +0530 Message-ID: <20260318133618.2805916-1-bfilipov@amd.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002BA50:EE_|DS7PR12MB8201:EE_ X-MS-Office365-Filtering-Correlation-Id: 95a76685-0ec8-48ea-2cd2-08de84f36ba3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|376014|36860700016|56012099003|18002099003; X-Microsoft-Antispam-Message-Info: SX1V/B1WnIO+tvAaYbmtOUO3HVfGJyR4xyTjSPQbL88mpxEvp6zjwVEWued6bemPeKr3U0bkA2db7FDX7w8Qj+96AhTc35dx39NDgIvnTBJX+AgUzaoRhnfvCgeQHSv5SLdLgW0saoBbAA4W/aI9Aih+o4vUWYh3cZlBIfUh24LVjnI81QdkVbvJFgZlRJvMsPprGcVJWkAkPgq3iBB6tXb8aqzs3yPZ6Qz+pZqqpySHXQdwv0mM5hT582Y5yz70L4Oi450Zln3dOH0tXPfWMXgwgclq0p8szuAchmpig7ZTGnxdYjgOxgx7u9ZAWm4LyKRGwduxXfdwiM0yBmi6JqtICcNALKg/Btk6ds37XwkaFRy82Jc59f5/Z9OKm5Rmp/fXm1f4U5/vqkhRvhddOjZm12wZlQQ+pljHylplOA7WIADZcLTs1iaJxR6mmeOdG2byXKCd9hbcv3OPcdXXOkpq5JGcFFVUX1fBjXdVt8s25nIJkE3YbZIkthEYyHXKAN+IIEmWXGIBKQz7+GBytlfMYa7apHGUDidNjbh2R07djszv7JrEfmOHn5cYRxX2uonuu2Gx84pSsLAEJT7TLwuFM6fnHFtKseMqfBxxJgNBs+ObHuZ0j95pos17nX4UHWXMVQnV6veXv7omavgIPZTI59mUWHTZF/7LVbySnwo8rc7D5OoCAXdFE4O7UTGOWDTRirBDITLtlXaApuaHjWlzBdvkvT2pSyeUL1RBk3NyRyJePuUcSGxvZL+7krdcRXBQDRa413rWVKwpn2sGPw== 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)(1800799024)(376014)(36860700016)(56012099003)(18002099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Y2ryxonCkWEjgmktyGHef/P3/Adu3ZSr3wgpf9RcYfD0mozuWUQ4TYMEUxjCNmFM7JZnXUPDzN9Bvp+YVrXgpnQ3si0+n1GYtrF4br6Nlo6keuBrKT/cEEIseA7bMY4GaSsAQbyvysy95apck6KF9aLIRRUYDwiYdbD2NT9S2c+x3IfNwtM8EycMvKyfF+a63Sz+cUklc+ENklqgwEaf1SMuAaEwVjm6X7SgoFUBYXBsrnF2k9AWz9ZpUBrca5lPuIfj1z+YXVa+9LF7QTgAs5jvBHkIQlI3f+ULDaTz7LQ2AM00jbYz7AhG+/qj0Yr7CqAIQyE0RHkxMcogKtXOu00Uu60EFFFszdOJKGRJk5uXXZmktOLTVE4Hw16nuiJx05WT2kHnWrc+oD1t0H729X2qDClAPmmCTURoOQVOP7YKsH5tY49kFsxCTM5rYt9x X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2026 13:36:55.0308 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 95a76685-0ec8-48ea-2cd2-08de84f36ba3 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: SN1PEPF0002BA50.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8201 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) --- gdb/dwarf2/read.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 8b87d58d..2e897e65 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -15484,23 +15484,32 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, if (index_cst.has_value ()) { file_name_index file_index = (file_name_index) *index_cst; - struct file_entry *fe; - if (file_cu->line_header == nullptr) + /* Resolve DW_AT_decl_file/DW_AT_call_file. These attributes are + indices into the file-name table, which lives in the unit's + decoded .debug_line header. + 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); } if (file_cu->line_header != nullptr) - fe = file_cu->line_header->file_name_at (file_index); - else - fe = NULL; - - if (fe == NULL) - complaint (_("file index out of range")); + { + if (file_entry *fe + = file_cu->line_header->file_name_at (file_index); + fe != nullptr) + sym->set_symtab (fe->symtab (*file_cu)); + else + complaint (_("file index out of range")); + } else - sym->set_symtab (fe->symtab (*file_cu)); + complaint (_("missing .debug_line information to resolve file index")); } } -- 2.43.0