]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[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)
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

index c40b20f69254ac4a6b7856492270da14f18c4731..6dab76dfa1f6a0771a0f69b99153835f44bf4816 100644 (file)
@@ -176,7 +176,7 @@ proc setup { syscall } {
     #   0xf7fd5159 <__kernel_vsyscall+9>:    pop    %ebp
     # then a stepi at sysenter will step over the int insn, so make sure
     # next_insn_addr points after the int insn.
-    if { $actual_syscall_insn == "sysenter" } {
+    if { $actual_syscall_insn == "sysenter" || $actual_syscall_insn == "syscall" } {
        set test "pc after sysenter instruction"
        set re_int_insn "\[ \t\]*int\[ \t\]\[^\r\n\]*"
        set re [multi_line \