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>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Implement gdbarch_stack_frame_destroyed_p for aarch64
Date: Mon, 14 Mar 2022 09:30:25 +0000	[thread overview]
Message-ID: <00c20109-0a0c-b70c-a962-5a64539cc43a@arm.com> (raw)
In-Reply-To: <20220311163133.668809-1-tromey@adacore.com>

Hi Tom,

Thanks for the patch.

On 3/11/22 16:31, Tom Tromey via Gdb-patches wrote:
> The internal AdaCore testsuite has a test that checks that an
> out-of-scope watchpoint is deleted.  This fails on some aarch64
> configurations, reporting an extra stop:
> 
>      (gdb) continue
>      Continuing.
> 
>      Thread 3 hit Watchpoint 2: result
> 
>      Old value = 64
>      New value = 0
>      0x0000000040021648 in pck.get_val (seed=0, off_by_one=false) at [...]/pck.adb:13
>      13	   end Get_Val;
> 
> I believe what is happening here is that the variable is stored at:
> 
>      <efa>   DW_AT_location    : 2 byte block: 91 7c 	(DW_OP_fbreg: -4)
> 
> and the extra stop is reported just before a return, when the ldp
> instruction is executed:
> 
>     0x0000000040021644 <+204>:	ldp	x29, x30, [sp], #48
>     0x0000000040021648 <+208>:	ret
> 
> This instruction modifies the frame base calculation, and so the test
> picks up whatever memory is pointed to in the callee frame.
> 
> Implementing the gdbarch hook gdbarch_stack_frame_destroyed_p fixes
> this problem.
> 
> As usual with this sort of patch, it has passed internal testing, but
> I don't have a good way to try it with dejagnu.  So, I don't know
> whether some existing test covers this.  I suspect there must be one,
> but it's also worth noting that this test passes for aarch64 in some
> configurations -- I don't know what causes one to fail and another to
> succeed.

Are the passing/failing runs using different compiler versions? If the 
variable no longer exists, then having a stale location like that seems 
wrong. Can you pinpoint what is different from a passing test and a 
failing one? GDB version, compiler version, different binary?

These hooks seem to take care of functions without debuginfo, so they 
tend to walk instruction by instruction to figure things out.

I don't have a problem with the patch itself, and I don't see 
regressions on aarch64-linux. But I'd like to understand if the compiler 
is possibly generating something that it shouldn't.

  reply	other threads:[~2022-03-14  9:30 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 [this message]
2022-03-14 13:24   ` Tom Tromey
2022-03-14 13:41     ` Luis Machado
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=00c20109-0a0c-b70c-a962-5a64539cc43a@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).