public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@arm.com>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Implement gdbarch_stack_frame_destroyed_p for aarch64
Date: Mon, 14 Mar 2022 13:41:08 +0000	[thread overview]
Message-ID: <60f230a4-77b7-0a97-2f80-a2caa7a6f4a1@arm.com> (raw)
In-Reply-To: <87ee34lla9.fsf@tromey.com>

Hi,

On 3/14/22 13:24, Tom Tromey wrote:
> Luis> Are the passing/failing runs using different compiler versions?
> 
> Nope.
> 
> Luis> If the
> Luis> variable no longer exists, then having a stale location like that
> Luis> seems wrong. Can you pinpoint what is different from a passing test
> Luis> and a failing one? GDB version, compiler version, different binary?
> 
> I didn't dig quite this deep but I think it's different memory contents
> in the caller's stack frame.

The kind of which will change from run to run, not triggering the 
watchpoint in some cases?

> 
> Luis> These hooks seem to take care of functions without debuginfo, so they
> Luis> tend to walk instruction by instruction to figure things out.
> 
> No, this is a case with full debuginfo.  What's happening is that the
> DWARF for the callee describes the location of a variable as relative to
> the stack frame:
> 
>>       <efa>   DW_AT_location    : 2 byte block: 91 7c 	(DW_OP_fbreg: -4)
> 
> However, at the end of the callee, there's an 'ldp' instruction -- which
> resets the stack pointer.  So now, that variable's location description
> points to an offset relative to the caller's frame.  However, this is
> clearly incorrect, because the caller and the callee generally will not
> agree on the relative location of anything in their frames.
> 
> Basically, this is a kind of epilogue detection.  It might be better if
> the compiler told gdb about this (but it doesn't) or if variable
> locations ended at the 'ldp' (but they don't).

Yeah. Anyway, other backends rely on this hook as well. So the patch is 
fine to me. As I've said before, I didn't see any regressions.

Thanks,
Luis

  reply	other threads:[~2022-03-14 13:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11 16:31 Tom Tromey
2022-03-14  9:30 ` Luis Machado
2022-03-14 13:24   ` Tom Tromey
2022-03-14 13:41     ` Luis Machado [this message]
2022-03-18 17:00       ` Tom Tromey

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=60f230a4-77b7-0a97-2f80-a2caa7a6f4a1@arm.com \
    --to=luis.machado@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.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).