~vcs-imports/gdb/trunk

« back to all changes in this revision

Viewing changes to gdb/testsuite/gdb.base/gnu_vector.exp

  • Committer: jemarch
  • Date: 2013-10-21 12:34:24 UTC
  • Revision ID: git-v1:c8eb88c30c69109495d92e053a63116d084033e0
2013-10-21  Jose E. Marchesi  <jose.marchesi@oracle.com>

        * gdb.base/gnu_vector.exp: Care about endianness when casting
        scalars to vectors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
    return -1
41
41
}
42
42
 
 
43
# Get endianess for the scalar->vector casts
 
44
gdb_test_multiple "show endian" "show endian" {
 
45
    -re ".* (big|little) endian.*$gdb_prompt $" { 
 
46
        set endian $expect_out(1,string) 
 
47
        pass "endianness: $endian"
 
48
    }
 
49
}
 
50
 
43
51
# Test printing of character vector types
44
52
gdb_test "print c4" "\\\$$decimal = \\{1, 2, 3, 4\\}"
45
53
gdb_test "print c4\[2\]" "\\\$$decimal = 3"
83
91
# When casting to vector the input type must have the same length as
84
92
# the total length of the vector.
85
93
gdb_test "print (char4) 0x01010101" "\\\$$decimal = \\{1, 1, 1, 1\\}"
86
 
gdb_test "print (char4) ia" "\\\$$decimal = \\{2, 0, 0, 0\\}"
87
94
gdb_test "print (int2) lla" "\\\$$decimal = \\{1, 1\\}"
88
95
 
 
96
if { ![string compare $endian big] } then {
 
97
    gdb_test "print (char4) ia" "\\\$$decimal = \\{0, 0, 0, 2\\}"
 
98
} else {
 
99
    gdb_test "print (char4) ia" "\\\$$decimal = \\{2, 0, 0, 0\\}"
 
100
}
 
101
 
89
102
gdb_test "print (int2) 1" "can only cast scalar to vector of same size"
90
103
gdb_test "print (longlong2) 2" "can only cast scalar to vector of same size"
91
104
gdb_test "print (float2) 3" "can only cast scalar to vector of same size"