public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@arm.com>
To: Sylwester Garncarek <sylwester.garncarek@gmail.com>, gdb@sourceware.org
Subject: Re: AArch64 and fixed return address register (x30)
Date: Thu, 5 Jan 2023 14:36:21 +0000	[thread overview]
Message-ID: <e7d9c6d1-377a-52fb-e6b4-ff9cd0b2a11f@arm.com> (raw)
In-Reply-To: <130c9bae-22d9-2d74-45ec-4e4b7ee59c00@gmail.com>

Hi,

On 1/3/23 00:50, Sylwester Garncarek via Gdb wrote:
> Hi All,
> 
> I've been working on adding CFI directives to assembler sources (GNU Asm) of an RTOS and I noticed that GDB seems to ignore .cfi_return_column directive. I checked GDB sources and indeed for AArch64 architecture the return address is fixed to x30 register. Normally this is not a problem, but for exception/interrupt the return address is in ELR_mode register. Because GDB is fixed to x30, there is no way to get a valid call stack. Are there any plans to make the return address register adjustable according to the info provided in DWARF data?

It used to be the case that gdb only restored the PC from x30. A recent (ish) patch (1fe8486103e482bcd6cd74fdbf79a7d2ab9b111f) adjusted gdb so the PC can be explicitly set.

You can check how the test does it, and replicate the CFI (gdb.arch/aarch64-unwind-pc.S). From what I recall, gdb was taught about the existence of a formal PC column, which is documented in the aadwarf64 spec [1].

Hopefully that will be useful for your use case.

[1] https://github.com/ARM-software/abi-aa/blob/2022Q1/aadwarf64/aadwarf64.rst#dwarf-register-names

> 
> Thanks,
> Sylwester


  reply	other threads:[~2023-01-05 14:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-03  0:50 Sylwester Garncarek
2023-01-05 14:36 ` Luis Machado [this message]
     [not found]   ` <d394976c-451b-cfd6-a8dc-3ad715221024@gmail.com>
2023-01-06  9:37     ` Luis Machado

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=e7d9c6d1-377a-52fb-e6b4-ff9cd0b2a11f@arm.com \
    --to=luis.machado@arm.com \
    --cc=gdb@sourceware.org \
    --cc=sylwester.garncarek@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).