Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH] gdb/dwarf: fix internal error in dwarf2_fetch_cfa_info for FDEs without a CFA rule
Date: Thu, 23 Apr 2026 19:18:37 -0700	[thread overview]
Message-ID: <20260423191837.3e4e7ca9@f42-zbm-amd> (raw)
In-Reply-To: <20260423173711.804174-1-simon.marchi@efficios.com>

On Thu, 23 Apr 2026 13:37:06 -0400
Simon Marchi <simon.marchi@efficios.com> 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 <kevinb@redhat.com>


  reply	other threads:[~2026-04-24  2:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23 17:37 Simon Marchi
2026-04-24  2:18 ` Kevin Buettner [this message]
2026-04-24  2:29   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260423191837.3e4e7ca9@f42-zbm-amd \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox