]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/testsuite] Fix gdb.base/step-over-syscall.exp with -m32 for AMD
authorTom de Vries <tdevries@suse.de>
Sat, 8 Mar 2025 08:52:08 +0000 (09:52 +0100)
committerTom de Vries <tdevries@suse.de>
Sat, 8 Mar 2025 08:52:08 +0000 (09:52 +0100)
commit4f0636220e6a60d85809fb4a982150f8bc3f218e
treeda93447921cb03a91107dfed80d630ddd23f9a98
parent86a53c0b2ead2d0da2a6bf91741c705df6b97f76
[gdb/testsuite] Fix gdb.base/step-over-syscall.exp with -m32 for AMD

When running test-case gdb.base/step-over-syscall.exp with target board
unix/-m32 on an AMD processor, I run into:
...
(gdb) x/2i $pc^M
=> 0xf7fc9575 <__kernel_vsyscall+5>:    syscall^M
   0xf7fc9577 <__kernel_vsyscall+7>:    int    $0x80^M
(gdb) PASS: $exp: fork: displaced=off: pc before/after syscall instruction
stepi^M
[Detaching after fork from child process 65650]^M
0xf7fc9579 in __kernel_vsyscall ()^M
1: x/i $pc^M
=> 0xf7fc9579 <__kernel_vsyscall+9>:    pop    %ebp^M
(gdb) $exp: fork: displaced=off: stepi fork insn
print /x $pc^M
$2 = 0xf7fc9579^M
(gdb) PASS: gdb.base/step-over-syscall.exp: fork: displaced=off: pc after stepi
FAIL: $exp: fork: displaced=off: pc after stepi matches insn addr after syscall
...

The problem is that the syscall returns at the "pop %ebp" insn, while the
test-case expects it to return at the "int $0x80" insn.

This is similar to the problem I fixed in commit 14852123287 ("[gdb/testsuite]
Fix gdb.base/step-over-syscall.exp with -m32"), just that the syscall sequence
used there used the "sysenter" insn instead of the "syscall" insn.

Fix this by extending the fix for commit 14852123287 to also handle the
"syscall" insn.

Tested on x86_64-linux, both using an AMD and Intel processor.

PR testsuite/32439
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32439
gdb/testsuite/gdb.base/step-over-syscall.exp