public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed] [gdb/testsuite] Fix gdb.base/write_mem.exp for big endian
Date: Mon, 12 Dec 2022 14:26:26 +0100	[thread overview]
Message-ID: <20221212132626.5484-1-tdevries@suse.de> (raw)

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/write_mem.exp b/gdb/testsuite/gdb.base/write_mem.exp
index a9e94032447..ce862a5bd34 100644
--- a/gdb/testsuite/gdb.base/write_mem.exp
+++ b/gdb/testsuite/gdb.base/write_mem.exp
@@ -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

base-commit: b5661ff24f7111246b9e9b5f1cba5afe9d479daf
-- 
2.35.3


                 reply	other threads:[~2022-12-12 13:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221212132626.5484-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).