From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 7GnGMizY6mmu3jcAWB0awg (envelope-from ) for ; Thu, 23 Apr 2026 22:40:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1776998444; bh=Io9qUyWUydFdqzBQ4TURnQxaNCCI6594Zl8dlNc+mn4=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Vm5kNq1LEyBRHHEzF7ridqb5UuNWIzTn/WBg4nG8xqAxduP02E5ljqw7UKcHVd6Iq MBkNx+Gh5X1I1/81IaotqGFiom+jXcje5lK12aRLebrkkHf/8Bt3wTboxzIAPoYZZA XCz7h51ror0sgGJdLqevJe+RhDdmlJEyE48mFn90= Received: by simark.ca (Postfix, from userid 112) id BCAAD1E0BA; Thu, 23 Apr 2026 22:40:44 -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=S8SUb7N/; 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 3CD011E093 for ; Thu, 23 Apr 2026 22:40:44 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id B54904B99F7D for ; Fri, 24 Apr 2026 02:40:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B54904B99F7D 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=S8SUb7N/ Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 157994B99F7D for ; Fri, 24 Apr 2026 02:40:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 157994B99F7D 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 157994B99F7D 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=1776998420; cv=none; b=HEaxGdUSw4lkwsDqxi7cF/ORAM5RjNYvRS6yn6GUDNFkcRgbaCb24IuI6s/r7u39isC3rtVlecxgEVEUhBPBWq1ARGaUMG5+87a0YdCDUv9VFOEWoNe1kN1hNE35dGCEalvWhNzLwWOWPXo6ETbGX5Q4GN/I/JZbjsbzbNr6ems= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776998420; c=relaxed/simple; bh=Io9qUyWUydFdqzBQ4TURnQxaNCCI6594Zl8dlNc+mn4=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=LqhihYtkLMR0wVeZbOAc7NSCPJA+mgf6cvekcpnsTdEjKNRh4D0PZhd43ZQx3ZNPPytFlieKovmpa0sMNlecvrhymZ2a/oPJ6vWgDNCfEJu461tjwqi9geKyCzM7DykjqjqDq8hEb19Xw66wQ+m8nnf7u+stxK7mm/lwCplDW2s= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 157994B99F7D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1776998413; bh=Io9qUyWUydFdqzBQ4TURnQxaNCCI6594Zl8dlNc+mn4=; h=Date:Subject:To:References:From:In-Reply-To:From; b=S8SUb7N/QMe0wh2UJFUmdafScpiB9p2JPZDBLYDb74jryaGQJopOiFgto8GhcUKVG l/yWnXk1bMVSg7qfhzHHtSgnG+IG08dDElmMTTnEUH9bDaA15q0QIQJkbrvg66KoPC 7lzvTaerMqqyCx8Rs3S8q2GEghpfQBGNBZHX3taY= Received: by simark.ca (Postfix) id E55051E093; Thu, 23 Apr 2026 22:40:13 -0400 (EDT) Message-ID: Date: Thu, 23 Apr 2026 22:40:13 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Avoid crash in dwarf2/read.c:determine_prefix To: Tom Tromey , gdb-patches@sourceware.org References: <20260423185200.61358-1-tromey@adacore.com> Content-Language: en-US From: Simon Marchi In-Reply-To: <20260423185200.61358-1-tromey@adacore.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 2026-04-23 14:52, Tom Tromey wrote: > I found a gdb crash when using some changes to gnat-llvm to have it > emit unqualified names in the DWARF. The crash happens because > determine_prefix does this: > > return dwarf2_full_name (nullptr, parent, cu); > > However, dwarf2_full_name can return NULL, causing a crash in the > caller. > > The particular DWARF causing this is pretty strange -- it is a > function nested inside another nameless function. This may be a bug > in gnat-llvm, something I plan to investigate. > > Meanwhile, gdb shouldn't crash. This patch changes determine_prefix > to avoid possible crashes here, by following its contract and not > returning NULL. > > I'm not sure if it's worthwhile to write a test case for this. Seems fine. Did you go around and check if other calls to dwarf2_full_name handled nullptr correctly? Most of them do, but others seem like they would have a problem if dwarf2_full_name returned nullptr. Or perhaps if in some cases we can prove that dwarf2_full_name can't return nullptr, then we could use a gdb_assert. Approved-By: Simon Marchi Simon