public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
To: Christophe Lyon <christophe.lyon@linaro.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 4/5] gdb/testsuite: Add gdb.arch/aarch64-mops-atomic-inst.exp
Date: Mon, 06 May 2024 23:10:38 -0300	[thread overview]
Message-ID: <877cg6gyn5.fsf@linaro.org> (raw)
In-Reply-To: <CAPS5khbrmrkfuggPz1oo2R7Q-LeOqEVEZZ2wxT4Afi2TBQK5Ng@mail.gmail.com> (Christophe Lyon's message of "Mon, 6 May 2024 11:42:27 +0200")


Hello Christophe,

Christophe Lyon <christophe.lyon@linaro.org> writes:

> On Sat, 4 May 2024 at 02:06, Thiago Jung Bauermann
> <thiago.bauermann@linaro.org> wrote:
>>
>> +gdb_continue_to_breakpoint "memset breakpoint"
>> +
>> +if { [arrive_at_instruction setp] } {
>> +    # The nexti output isn't useful to detect whether we skipped the sequence.
>> +    gdb_test "nexti" "\[^\r\n\]+" "step through the memset sequence"
>> +    gdb_assert { [is_at_instruction setm] == 0 \
>> +                    && [is_at_instruction sete] == 0 } \
>> +       "stepped through the memset sequence"
>> +}
>> +
>> +gdb_continue_to_breakpoint "memcpy breakpoint"
>> +
>> +if { [arrive_at_instruction cpyfp] } {
>> +    # The nexti output isn't useful to detect whether we skipped the sequence.
>> +    gdb_test "nexti" "\[^\r\n\]+" "step through the memcpy sequence"
>> +    gdb_assert { [is_at_instruction cpyfm] == 0 \
>> +                    && [is_at_instruction cpyfe] == 0 } \
>> +       "stepped through the memcpy sequence"
>> +}
>> +
>> +gdb_continue_to_breakpoint "memmove breakpoint"
>> +
>> +if { [arrive_at_instruction cpyp] } {
>> +    # The nexti output isn't useful to detect whether we skipped the sequence.
>> +    gdb_test "nexti" "\[^\r\n\]+" "step through the memmove sequence"
>> +    gdb_assert { [is_at_instruction cpym] == 0 \
>> +                    && [is_at_instruction cpye] == 0 } \
>> +       "stepped through the memmove sequence"
>> +}
>
> I don't know how easy it is nor if it's feasible in the GDB testsuite,
> but maybe you could also assert that we stop on the first instruction
> after the sequence (so this asm for 'p = dest' and 'return 0'), but I
> suspect this would be fragile?

It's feasible, but you are right that it would be fragile: the first
instruction after the sequence is "str x1, [sp, #72]", which isn't
very remarkable and can occur at many places in the program.

Your comment gave me an idea though: I can put an uncommon instruction
right after the epilogue instruction and check for it in the test. I
chose "prfm" which is "Prefetch Memory" so it's both uncommon and
basically a NOP. I'll send a v2 with the change. Thanks for pointing
this out!

-- 
Thiago

  reply	other threads:[~2024-05-07  2:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-04  0:05 [PATCH 0/5] Add support for AArch64 MOPS instructions Thiago Jung Bauermann
2024-05-04  0:05 ` [PATCH 1/5] gdb/aarch64: Implement software single stepping for " Thiago Jung Bauermann
2024-05-06  9:29   ` Christophe Lyon
2024-05-07  0:56     ` Thiago Jung Bauermann
2024-05-04  0:05 ` [PATCH 2/5] gdb/aarch64: Add record support " Thiago Jung Bauermann
2024-05-04  0:05 ` [PATCH 3/5] gdb/testsuite: Add gdb.arch/aarch64-mops-watchpoint.exp Thiago Jung Bauermann
2024-05-04  0:05 ` [PATCH 4/5] gdb/testsuite: Add gdb.arch/aarch64-mops-atomic-inst.exp Thiago Jung Bauermann
2024-05-06  9:42   ` Christophe Lyon
2024-05-07  2:10     ` Thiago Jung Bauermann [this message]
2024-05-04  0:05 ` [PATCH 5/5] gdb/testsuite: Add gdb.reverse/aarch64-mops.exp Thiago Jung Bauermann

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=877cg6gyn5.fsf@linaro.org \
    --to=thiago.bauermann@linaro.org \
    --cc=christophe.lyon@linaro.org \
    --cc=gdb-patches@sourceware.org \
    /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).