[PATCH 4/5] gdb/testsuite: Add gdb.arch/aarch64-mops-atomic-inst.exp

Thiago Jung Bauermann thiago.bauermann@linaro.org
Tue May 7 02:10:38 GMT 2024


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


More information about the Gdb-patches mailing list