2013-10-21 Jose E. Marchesi <jose.marchesi@oracle.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / gnu_vector.exp
index 67a44c1878d6d124653bf42d02a1f4a31d896d3e..457892c4e9dd642db1d00854083d0c9b6309d0fb 100644 (file)
@@ -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"
This page took 0.026697 seconds and 4 git commands to generate.