Re: [PATCH 1/2] [gdb/testsuite] Fix gdb.base/examine-address-class.exp for big endian
Kevin Buettner <[email protected]> Sun, 2 Aug 2026 21:51:35 -0700
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Organization | Red Hat |
| Message-ID | <20260802215135.37d2c18f@f44-mesa-1> |
Hi Tom, LGTM except for one typo in the commit log... On Sun, 2 Aug 2026 11:34:20 +0200 Tom de Vries <[email protected]> wrote: > 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 There's a '0x' in the middle of that constant. The code shows it correctly as 0x002a002a. > ((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 With the typo fixed: Approved-By: Kevin Buettner <[email protected]>