From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/2] [gdb/testsuite] Fix gdb.base/examine-address-class.exp for big endian
Date: Sun, 2 Aug 2026 11:34:20 +0200 [thread overview]
Message-ID: <20260802093421.794182-2-tdevries@suse.de> (raw)
In-Reply-To: <20260802093421.794182-1-tdevries@suse.de>
On ppc64-linux and s390x-linux, with test-case
gdb.base/examine-address-class.exp I get:
...
(gdb) x/1dh (int *) &var^M
0x3fffffffe560: 0^M
(gdb) FAIL: $exp: x/1dh (int *) &var
...
This is caused by big vs. little endian.
On x86_64-linux (little endian), we have:
...
(gdb) p /x ((short *)&var)[0]
$6 = 0x2a
(gdb) p /x ((short *)&var)[1]
$7 = 0x0
(gdb)
...
And on ppc64-linux (big endian), we have:
...
(gdb) p /x ((short *)&var)[0]
$2 = 0x0
(gdb) p /x ((short *)&var)[1]
$3 = 0x2a
...
Fix this by assigning 0x002a0x002a to var, making sure that
((short *)&var)[0] == ((short *)&var)[1] == 42.
Tested on x86_64-linux, ppc64-linux and s390x-linux.
---
gdb/testsuite/gdb.base/examine-address-class.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.base/examine-address-class.c b/gdb/testsuite/gdb.base/examine-address-class.c
index c868b10119f..8f6b89c14bf 100644
--- a/gdb/testsuite/gdb.base/examine-address-class.c
+++ b/gdb/testsuite/gdb.base/examine-address-class.c
@@ -18,6 +18,6 @@
int
main (void)
{
- int var = 42;
+ int var = 0x002a002a;
return 0; /* break-here. */
}
--
2.51.0
next prev parent reply other threads:[~2026-08-02 9:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-02 9:34 [PATCH 0/2] [gdb/testsuite] Two ppc64 fixes Tom de Vries
2026-08-02 9:34 ` Tom de Vries [this message]
2026-08-03 4:51 ` [PATCH 1/2] [gdb/testsuite] Fix gdb.base/examine-address-class.exp for big endian Kevin Buettner
2026-08-03 8:20 ` Tom de Vries
2026-08-02 9:34 ` [PATCH 2/2] [gdb/testsuite] Fix gdb.base/msym-lang.exp on ppc64-linux Tom de Vries
2026-08-03 4:57 ` Kevin Buettner
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=20260802093421.794182-2-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