01917d
commit 4c406179784990e349f3b554c93dc418e9a007a5
01917d
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
01917d
Date:   Mon Oct 21 12:34:25 2013 +0000
01917d
01917d
    2013-10-21  Jose E. Marchesi  <jose.marchesi@oracle.com>
01917d
    
01917d
    	* gdb.base/gnu_vector.exp: Care about endianness when casting
01917d
    	scalars to vectors.
01917d
01917d
### a/gdb/testsuite/ChangeLog
01917d
### b/gdb/testsuite/ChangeLog
01917d
## -1,3 +1,8 @@
01917d
+2013-10-21  Jose E. Marchesi  <jose.marchesi@oracle.com>
01917d
+
01917d
+	* gdb.base/gnu_vector.exp: Care about endianness when casting
01917d
+	scalars to vectors.
01917d
+
01917d
 2013-10-18  Tom Tromey  <tromey@redhat.com>
01917d
 
01917d
 	* lib/gdb.exp (build_executable_from_specs): Remove duplicate set
01917d
--- a/gdb/testsuite/gdb.base/gnu_vector.exp
01917d
+++ b/gdb/testsuite/gdb.base/gnu_vector.exp
01917d
@@ -40,6 +40,14 @@ if { ![runto main] } {
01917d
     return -1
01917d
 }
01917d
 
01917d
+# Get endianess for the scalar->vector casts
01917d
+gdb_test_multiple "show endian" "show endian" {
01917d
+    -re ".* (big|little) endian.*$gdb_prompt $" { 
01917d
+	set endian $expect_out(1,string) 
01917d
+	pass "endianness: $endian"
01917d
+    }
01917d
+}
01917d
+
01917d
 # Test printing of character vector types
01917d
 gdb_test "print c4" "\\\$$decimal = \\{1, 2, 3, 4\\}"
01917d
 gdb_test "print c4\[2\]" "\\\$$decimal = 3"
01917d
@@ -83,9 +91,14 @@ gdb_test "print -f4a" "\\\$$decimal = \\{-2, -4, -8, -16\\}"
01917d
 # When casting to vector the input type must have the same length as
01917d
 # the total length of the vector.
01917d
 gdb_test "print (char4) 0x01010101" "\\\$$decimal = \\{1, 1, 1, 1\\}"
01917d
-gdb_test "print (char4) ia" "\\\$$decimal = \\{2, 0, 0, 0\\}"
01917d
 gdb_test "print (int2) lla" "\\\$$decimal = \\{1, 1\\}"
01917d
 
01917d
+if { ![string compare $endian big] } then {
01917d
+    gdb_test "print (char4) ia" "\\\$$decimal = \\{0, 0, 0, 2\\}"
01917d
+} else {
01917d
+    gdb_test "print (char4) ia" "\\\$$decimal = \\{2, 0, 0, 0\\}"
01917d
+}
01917d
+
01917d
 gdb_test "print (int2) 1" "can only cast scalar to vector of same size"
01917d
 gdb_test "print (longlong2) 2" "can only cast scalar to vector of same size"
01917d
 gdb_test "print (float2) 3" "can only cast scalar to vector of same size"