]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix regexp in gdb.arch/i386-disp-step-self-call.exp
authorTom de Vries <tdevries@suse.de>
Thu, 29 Aug 2024 05:31:12 +0000 (07:31 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 29 Aug 2024 05:31:12 +0000 (07:31 +0200)
Usually, with test-case gdb.arch/i386-disp-step-self-call.exp I get:
...
(gdb) x/1wx 0xffffc4f8^M
0xffffc4f8:     0x08048472^M
(gdb) PASS: $exp: check return address was updated correctly
...
but sometimes I run into:
...
(gdb) x/1wx 0xffffc5c8^M
0xffffc5c8:     0x0804917e^M
(gdb) FAIL: $exp: check return address was updated correctly
...

The problem is that here:
...
set next_insn_addr 0x[format %08X $next_insn_addr]
gdb_test "x/1wx 0x[format %x $sp]" "$hex:\\s+$next_insn_addr" \
    "check return address was updated correctly"
...
we're trying to match string 0x0804917e against regexp 0x0804917E due to using
"%08X" as format string.

We only run into this problem if the address contains letters, which apparently
usually isn't the case.

Fix this by using "%08x" instead as format string.

Likewise in test-case gdb.arch/amd64-disp-step-self-call.exp.

Tested on x86_64-linux.

PR testsuite/32121
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32121

gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp

index 762d19a2960ff4436a20fe87152e2db0a4469d27..2db3ff228c951e77b3fd206e0155a2247256b1c2 100644 (file)
@@ -77,6 +77,6 @@ gdb_assert {[expr $sp == $new_sp]} \
     "check stack pointer was updated as expected"
 
 # Check the contents of the stack were updated to the expected value.
-set next_insn_addr 0x[format %016X $next_insn_addr]
+set next_insn_addr 0x[format %016x $next_insn_addr]
 gdb_test "x/1gx 0x[format %x $sp]" "$hex:\\s+$next_insn_addr" \
     "check return address was updated correctly"
index b2cb902f8edb1f351ec000b962f64c746bced2a1..5de7ebcd69f062d676c897c9a69480875a5b1b56 100644 (file)
@@ -77,6 +77,6 @@ gdb_assert {[expr $sp == $new_sp]} \
     "check stack pointer was updated as expected"
 
 # Check the contents of the stack were updated to the expected value.
-set next_insn_addr 0x[format %08X $next_insn_addr]
+set next_insn_addr 0x[format %08x $next_insn_addr]
 gdb_test "x/1wx 0x[format %x $sp]" "$hex:\\s+$next_insn_addr" \
     "check return address was updated correctly"