]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix gdb.base/write_mem.exp for big endian
authorTom de Vries <tdevries@suse.de>
Mon, 12 Dec 2022 13:25:58 +0000 (14:25 +0100)
committerTom de Vries <tdevries@suse.de>
Mon, 12 Dec 2022 13:25:58 +0000 (14:25 +0100)
On s390x-linux (big endian), I run into:
...
(gdb) x /xh main^M
0x1000638 <main>:       0x0000^M
(gdb) FAIL: gdb.base/write_mem.exp: x /xh main
...

In contrast, on x86_64-linux (little endian), we have the expected:
...
(gdb) x /xh main^M
0x4004a7 <main>:        0x4242^M
(gdb) PASS: gdb.base/write_mem.exp: x /xh main
...

The problem is that the test-case hard-codes expectations about endiannes by
writing an int-sized value (4 bytes in this case) and then printing only a
halfword by using "/h" (so, two bytes).

If we print 4 bytes, we have for s390x:
...
0x1000638 <main>:       0x00004242^M
...
and for x86_64:
...
0x4004a7 <main>:        0x00004242^M
...

Fix this by removing the "/h".

Tested on x86_64-linux and s390x-linux.

gdb/testsuite/gdb.base/write_mem.exp

index a9e940324478fe696293237be24ce3e617f05f72..ce862a5bd34b21efa1757e4009d6fb8d8b0e8e37 100644 (file)
@@ -42,6 +42,6 @@ gdb_test_no_output "set {int}main = 0x4242"
 # Check that memory write persists after quitting GDB
 gdb_exit
 gdb_start
-gdb_test "x /xh main" "<main>:.*4242"
+gdb_test "x /x main" "<main>:.*4242"
 
 set GDBFLAGS $old_gdbflags