From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id f+WHMTBa6mkrEzcAWB0awg (envelope-from ) for ; Thu, 23 Apr 2026 13:43:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1776966192; bh=yqghIdxaJLXIiPuL64omwIXfW5x3x18lx3gsY4Ufk50=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=eFNmDE3Q0sWIiqYNREpGFVbBd5AaoK2+8K5ZiLMZZJtGtwFrZCtyglhWfDimk8flZ SVovJzXYnvpZ9UoO6b54EGryuM+9bPne0DLf+jTJ1j9kClUvAos42kY4Oe59CeRoMv Ip5n7ggeRuAx8o1Jtgvgd1wN/DlCeHWMQzIhcjqI= Received: by simark.ca (Postfix, from userid 112) id B73591E093; Thu, 23 Apr 2026 13:43:12 -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 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=GxQCBHYu; dkim-atps=neutral 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 F046A1E093 for ; Thu, 23 Apr 2026 13:43:11 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 78A914BABF3B for ; Thu, 23 Apr 2026 17:43:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 78A914BABF3B Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=GxQCBHYu Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 9D12D4BABF26 for ; Thu, 23 Apr 2026 17:42:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9D12D4BABF26 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9D12D4BABF26 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=1776966167; cv=none; b=WhNYiVa3cBMK+7mzOlbbD+2wg6MDl4kZXDkqx7Uxk0MfEw+FqD8QFs8FE2yi6jw9n24zGpBntom8TH/7s3AFvsHtOLPs9ZFCuFfNy6wU9GU9wImrY4B/ZSurJwSIVEq6ECmxLNnDraTtGtRkckRuguGhe71JrSgrIsgK3ZeFzhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776966167; c=relaxed/simple; bh=yqghIdxaJLXIiPuL64omwIXfW5x3x18lx3gsY4Ufk50=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=grymaEA/nNBAJPc+zaBahjARDVbubisXQGQlGRYZEbKqxJIsMR/B38i98gRDTv31dZ3I8CBdxYvoY7sEDrlLCZ+oznsAAyz7Ey8WEjFtM8C+oTOEhGWL89xeyVXtaLNeeiqJTi+O/oDIydhjKHCIZ+KgIy0xaT2QSxzNy1H6Ly4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D12D4BABF26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1776966167; bh=yqghIdxaJLXIiPuL64omwIXfW5x3x18lx3gsY4Ufk50=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=GxQCBHYuNlgq2Ns9zzMZx0JmRicauwrBOvq3rfobmE4cH6zU68j586ohKnuuK1wBn dELOFjnDPaY4LX8/y5v3zhGbFquJAE13yLNBbtJJ/aJhcu2cZmzhDY+P9fIIsEfDpM sv8qzzV+KslEpVeyFjEKJPYkFMTb8RQFbvxO65V4= Received: by simark.ca (Postfix) id 20BF31E093; Thu, 23 Apr 2026 13:42:46 -0400 (EDT) Message-ID: Date: Thu, 23 Apr 2026 13:42:45 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] dwarf2: avoid decoding .debug_line for type units To: Bratislav Filipovic , bratislav.filipovic@amd.com Cc: gdb-patches@sourceware.org, simon.marchi@efficios.com, tdevries@suse.de References: <20260423163752.3240149-1-bfilipov@amd.com> Content-Language: fr From: Simon Marchi In-Reply-To: <20260423163752.3240149-1-bfilipov@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 On 4/23/26 12:37 PM, Bratislav Filipovic wrote: > 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) There are some whitespace issues. I would suggest setting up pre-commit and running it: $ pre-commit run --all-files ... check-whitespace.........................................................Failed - hook id: check-whitespace - exit code: 2 gdb/dwarf2/read.c:15433: indent with spaces. + struct symbol *sym) gdb/dwarf2/read.c:15440: indent with spaces. + cu); gdb/dwarf2/read.c:15447: indent with spaces. + &file_cu); In fact, those warnings are about lines that shouldn't be changed by this patch. > @@ -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. */ Just a small suggestion to be more precise and less repetitive: /* decode_line_header_for_cu is CU-only and asserts on type units. For type units, the line header setup runs before processing child DIEs, in method dwarf2_cu::setup_type_unit_groups. So if line_header is still nullptr here it means there is no usable line table for this unit. */ With those fixed, the patch LGTM. Approved-By: Simon Marchi Simon