From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Cc: Bruno Larsen <blarsen@redhat.com>,
Andrew Burgess <aburgess@redhat.com>,
Luis Machado <luis.machado@arm.com>
Subject: Re: [PATCH 3/4] [gdb/tdep, aarch64] Fix frame address of last insn in leaf function
Date: Fri, 20 Jan 2023 11:25:44 +0100 [thread overview]
Message-ID: <b6ba5ef0-e451-e698-6895-0d4846820595@suse.de> (raw)
In-Reply-To: <20230119104618.15503-4-tdevries@suse.de>
On 1/19/23 11:46, Tom de Vries via Gdb-patches wrote:
> diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
> index b576d3b9d99..06349353716 100644
> --- a/gdb/aarch64-tdep.c
> +++ b/gdb/aarch64-tdep.c
> @@ -996,7 +996,11 @@ aarch64_make_prologue_cache_1 (frame_info_ptr this_frame,
> if (unwound_fp == 0)
> return;
>
> - cache->prev_sp = unwound_fp + cache->framesize;
> + if (cache->framereg == AARCH64_SP_REGNUM
> + && get_frame_register_unsigned (this_frame, AARCH64_FP_REGNUM) == unwound_fp)
> + cache->prev_sp = unwound_fp;
> + else
> + cache->prev_sp = unwound_fp + cache->framesize;
>
> /* Calculate actual addresses of saved registers using offsets
> determined by aarch64_analyze_prologue. */
I came across the aarch64 version of stack_frame_destroyed_p, and
realized I can do the fix like this:
...
@@ -999,7 +1001,10 @@ aarch64_make_prologue_cache_1 (frame_info_ptr
this_frame,
if (unwound_fp == 0)
return;
- cache->prev_sp = unwound_fp + cache->framesize;
+ cache->prev_sp = unwound_fp;
+ if (!aarch64_stack_frame_destroyed_p (get_frame_arch (this_frame),
+ cache->prev_pc))
+ cache->prev_sp += cache->framesize;
/* Calculate actual addresses of saved registers using offsets
determined by aarch64_analyze_prologue. */
...
This fixes both the leaf and non-leaf case.
Thanks,
- Tom
next prev parent reply other threads:[~2023-01-20 10:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-19 10:46 [PATCH 0/4] [gdb] Test-case gdb.base/unwind-on-each-insn.exp improvements Tom de Vries
2023-01-19 10:46 ` [PATCH 1/4] [gdb/testsuite] Simplify gdb.base/unwind-on-each-insn.exp Tom de Vries
2023-01-23 9:36 ` Tom de Vries
2023-01-19 10:46 ` [PATCH 2/4] [gdb/testsuite] Improve gdb.base/unwind-on-each-insn.exp Tom de Vries
2023-01-23 9:55 ` Luis Machado
2023-01-19 10:46 ` [PATCH 3/4] [gdb/tdep, aarch64] Fix frame address of last insn in leaf function Tom de Vries
2023-01-20 10:25 ` Tom de Vries [this message]
2023-01-23 10:07 ` Luis Machado
2023-01-23 11:59 ` Tom de Vries
2023-01-23 12:09 ` Luis Machado
2023-01-19 10:46 ` [PATCH 4/4] [gdb/testsuite] Analyze non-leaf fn in gdb.base/unwind-on-each-insn.exp Tom de Vries
2023-01-23 10:18 ` Luis Machado
2023-01-25 12:32 ` [PATCH 0/4] [gdb] Test-case gdb.base/unwind-on-each-insn.exp improvements Tom de Vries
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=b6ba5ef0-e451-e698-6895-0d4846820595@suse.de \
--to=tdevries@suse.de \
--cc=aburgess@redhat.com \
--cc=blarsen@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=luis.machado@arm.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).