This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Big-endian targets: Fix implptrpiece.exp
- From: Andreas Arnez <arnez at linux dot vnet dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 19 Jan 2017 13:52:44 +0100
- Subject: [PATCH] Big-endian targets: Fix implptrpiece.exp
- Authentication-results: sourceware.org; auth=none
The test case implptrpiece.exp accesses the second byte of the short
integer number 1 and expects it to be zero. This is valid for
little-endian targets, but fails on big-endian targets.
This is fixed by determining the expected value in an
endianness-independent way.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/implptrpiece.exp: Fix check for big-endian targets.
---
gdb/testsuite/gdb.dwarf2/implptrpiece.exp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp
index af7dd37..3f6e0d6 100644
--- a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp
@@ -119,4 +119,7 @@ if ![runto_main] {
return -1
}
-gdb_test "print/d p\[-1\]" " = 0"
+# Access the second byte of s through an implicit pointer to the third
+# byte of s, using a negative offset. Compare that to the second byte of
+# the short integer 1 in target byte order.
+gdb_test "p/d p\[-1\] - ((signed char *)(short\[1\]){1})\[1\]" " = 0"
--
2.3.0