aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJose E. Marchesi <jose.marchesi@oracle.com>2013-10-21 12:34:25 +0000
committerJose E. Marchesi <jose.marchesi@oracle.com>2013-10-21 12:34:25 +0000
commit4c406179784990e349f3b554c93dc418e9a007a5 (patch)
tree365af417fb3dd5a6c9cfd2ea11033050ef5119d2 /gdb
parente166eda42e239341543184c736893c1e0c1c1b2c (diff)
downloadgdb-4c406179784990e349f3b554c93dc418e9a007a5.zip
gdb-4c406179784990e349f3b554c93dc418e9a007a5.tar.gz
gdb-4c406179784990e349f3b554c93dc418e9a007a5.tar.bz2
2013-10-21 Jose E. Marchesi <jose.marchesi@oracle.com>
* gdb.base/gnu_vector.exp: Care about endianness when casting scalars to vectors.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/gnu_vector.exp15
2 files changed, 19 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 7b9a085..9bb575e 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-21 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * gdb.base/gnu_vector.exp: Care about endianness when casting
+ scalars to vectors.
+
2013-10-18 Tom Tromey <tromey@redhat.com>
* lib/gdb.exp (build_executable_from_specs): Remove duplicate set
diff --git a/gdb/testsuite/gdb.base/gnu_vector.exp b/gdb/testsuite/gdb.base/gnu_vector.exp
index 67a44c1..457892c 100644
--- a/gdb/testsuite/gdb.base/gnu_vector.exp
+++ b/gdb/testsuite/gdb.base/gnu_vector.exp
@@ -40,6 +40,14 @@ if { ![runto main] } {
return -1
}
+# Get endianess for the scalar->vector casts
+gdb_test_multiple "show endian" "show endian" {
+ -re ".* (big|little) endian.*$gdb_prompt $" {
+ set endian $expect_out(1,string)
+ pass "endianness: $endian"
+ }
+}
+
# Test printing of character vector types
gdb_test "print c4" "\\\$$decimal = \\{1, 2, 3, 4\\}"
gdb_test "print c4\[2\]" "\\\$$decimal = 3"
@@ -83,9 +91,14 @@ gdb_test "print -f4a" "\\\$$decimal = \\{-2, -4, -8, -16\\}"
# When casting to vector the input type must have the same length as
# the total length of the vector.
gdb_test "print (char4) 0x01010101" "\\\$$decimal = \\{1, 1, 1, 1\\}"
-gdb_test "print (char4) ia" "\\\$$decimal = \\{2, 0, 0, 0\\}"
gdb_test "print (int2) lla" "\\\$$decimal = \\{1, 1\\}"
+if { ![string compare $endian big] } then {
+ gdb_test "print (char4) ia" "\\\$$decimal = \\{0, 0, 0, 2\\}"
+} else {
+ gdb_test "print (char4) ia" "\\\$$decimal = \\{2, 0, 0, 0\\}"
+}
+
gdb_test "print (int2) 1" "can only cast scalar to vector of same size"
gdb_test "print (longlong2) 2" "can only cast scalar to vector of same size"
gdb_test "print (float2) 3" "can only cast scalar to vector of same size"