From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id AK1kJ5rV6mk82zcAWB0awg (envelope-from ) for ; Thu, 23 Apr 2026 22:29:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1776997786; bh=aMEmiAdfl6FSxmRpO7K+IyqvihTwN7eqvOES6Xe6rmk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=RRu3BsRPuhW68yQbGQh/VjMev+YDF0wJWqVmDQmrFzbNKyTcDwuCsAHKHG33S+vqc XjxLCUcQrw99hLLhkobnY7kgfT0nn91IrnvxMXzSm/vS/fZSfbS5juP7TJ+kK/jFYQ aIWCRIBwPx9bkTfAGIk/iIa12fch68zVK2D/8RXo= Received: by simark.ca (Postfix, from userid 112) id 8F1B01E0BA; Thu, 23 Apr 2026 22:29:46 -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=MnxLtNFk; 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 F3B4A1E093 for ; Thu, 23 Apr 2026 22:29:44 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id A8FE84B99F7A for ; Fri, 24 Apr 2026 02:29:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A8FE84B99F7A 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=MnxLtNFk Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 5F1564B99F71 for ; Fri, 24 Apr 2026 02:29:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5F1564B99F71 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 5F1564B99F71 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=1776997759; cv=none; b=TI/Wa+MwBZU/zP+0J3PENBCORIc88Km4wtqheTrH0xnkNMh8qxKE4ixn1YQ0zAxfWW9ke6v9Nw712dVemhe6otjpSmNlW5gF/iUaTb8/GbnsGafasSkSvb/PXQQ/HdO+lFeBdMHRnd2FvyiSlrTR/j8tMqb89Gk8LADHPr0aPNE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776997759; c=relaxed/simple; bh=aMEmiAdfl6FSxmRpO7K+IyqvihTwN7eqvOES6Xe6rmk=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=LGeb3Id7z6IBAsYW1nx2Xai331cSlPZdYEblY/nUm4mUd6KtUNjWHipkdxPsQGYKQcRsgrBpHVYMesIHFdNhEld8R48MDaSJ1+RiFqVGanx6/fNIA2BnvigVaAt5cyNTxdIrhH5ijMc3LGRAwMBGBEF3jscXYDazl16E+G1lUaM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F1564B99F71 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1776997757; bh=aMEmiAdfl6FSxmRpO7K+IyqvihTwN7eqvOES6Xe6rmk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=MnxLtNFkMkkDr09+Lil2DYQ5gLMkC892IReTkRbhTCyxFVmH3cdq1qop9VBVPm+lA zQvPFhnANHor6kDMikUy/9N0ggS0NoLZd68TzUQ5aUbw1EkROKyWf4uosAiCvV/9IU frH1rFcx5WbNObRrIckf+H7//ATd+jQ0uNAt4sog= Received: by simark.ca (Postfix) id C7AF91E093; Thu, 23 Apr 2026 22:29:17 -0400 (EDT) Message-ID: <86598927-dce1-4f9d-aa57-4bed893f2c5c@simark.ca> Date: Thu, 23 Apr 2026 22:29:17 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdb/dwarf: fix internal error in dwarf2_fetch_cfa_info for FDEs without a CFA rule To: Kevin Buettner , gdb-patches@sourceware.org Cc: Simon Marchi References: <20260423173711.804174-1-simon.marchi@efficios.com> <20260423191837.3e4e7ca9@f42-zbm-amd> Content-Language: en-US From: Simon Marchi In-Reply-To: <20260423191837.3e4e7ca9@f42-zbm-amd> 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 22:18, Kevin Buettner wrote: > On Thu, 23 Apr 2026 13:37:06 -0400 > Simon Marchi wrote: > >> Commit a910478f65a5 ("gdb/dwarf: fix internal error when FDEs do not >> describe the CFA") fixed the switch on cfa_how in dwarf2_frame_cache, >> but there is a very similar switch in dwarf2_fetch_cfa_info that has >> the same issue. If the unwind info does not set a rule for the CFA, >> fs.regs.cfa_how is left as CFA_UNSET and we hit the default case, >> triggering an internal error. >> >> dwarf2_fetch_cfa_info is called from two places, both while compiling >> a DWARF expression that contains DW_OP_call_frame_cfa: >> >> - dwarf2_compile_expr_to_ax, when compiling to agent-expression >> bytecode >> >> - do_compile_dwarf_expr_to_c, when compiling to C source (used by >> the "compile" commands). >> >> Unlike dwarf2_frame_cache, where we can degrade gracefully by setting >> undefined_retaddr, the callers of dwarf2_fetch_cfa_info need a concrete >> CFA to generate code, so we can't continue. Throw an error with the >> same message used a few lines above, when the FDE itself cannot be >> found. >> >> Extend the debug-frame-no-cfa.exp test to reproduce this case: add a >> compile unit describing the "main" function and with a DW_AT_frame_base >> that uses DW_OP_call_frame_cfa and a local variable "x" that uses >> DW_OP_fbreg (the evaluation of which requires the CFA). Then, try to >> translate the location of "x" to agent-expression bytecode with "maint" >> agent. This hits the internal error without the corresponding fix. > > LGTM. > > Approved-by: Kevin Buettner > Thanks, pushed. Simon