Copyright year range updates after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / gnu_vector.exp
index 09593d25efe80e102f40bf08550f656cf76d6f06..23fc2dbbd98f61ce9d771b8cd7ffe2b3873501ba 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2010-2015 Free Software Foundation, Inc.
+# Copyright 2010-2020 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -48,12 +48,7 @@ if { ![runto main] } {
 }
 
 # 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"
-    }
-}
+set endian [get_endianness]
 
 # Test printing of character vector types
 gdb_test "print c4" "\\\$$decimal = \\{1, 2, 3, 4\\}"
@@ -100,6 +95,17 @@ gdb_test "print -f4a" "\\\$$decimal = \\{-2, -4, -8, -16\\}"
 gdb_test "print (char4) 0x01010101" "\\\$$decimal = \\{1, 1, 1, 1\\}"
 gdb_test "print (int2) lla" "\\\$$decimal = \\{1, 1\\}"
 
+# Check that "whatis" doesn't peel off the destination type's typedef
+# by mistake, in expressions that involve a cast to typedef type.
+gdb_test "whatis (char4) 0x01010101" "type = char4"
+gdb_test "whatis (int2) lla" "type = int2"
+# Check that OTOH "ptype" does peel off the destination type's
+# typedef.
+gdb_test "ptype (char4) 0x01010101" \
+    "type = char __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
+gdb_test "ptype (int2) lla" \
+    "type = int __attribute__ \\(\\(vector_size\\(2\\)\\)\\)"
+
 if { ![string compare $endian big] } then {
     gdb_test "print (char4) ia" "\\\$$decimal = \\{0, 0, 0, 2\\}"
 } else {
@@ -172,16 +178,30 @@ gdb_test "print (double2) f2" "Cannot convert between vector values of different
 gdb_test "print (int4) c4" "Cannot convert between vector values of different sizes"
 gdb_test "print (char4) i4a" "Cannot convert between vector values of different sizes"
 
-# Test ptype on vector types.
+# Test ptype/whatis on vector types/vars.
 gdb_test "ptype c4" "type = char __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
+gdb_test "whatis c4" "type = char4"
+
 gdb_test "ptype char4" "type = char __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
+gdb_test "whatis char4" "type = char __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
+
 gdb_test "ptype i4a" "type = int __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
+gdb_test "whatis i4a" "type = int4"
+
 gdb_test "ptype int4" "type = int __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
+gdb_test "whatis int4" "type = int __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
+
 gdb_test "ptype f4b" "type = float __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
+gdb_test "whatis f4b" "type = float4"
+
 gdb_test "ptype float4" "type = float __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
+gdb_test "whatis float4" "type = float __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
 
 gdb_test "ptype union_with_vector_1" "type = union {\r\n\[\t \]+int i;\r\n\[\t \]+char cv __attribute__ \\(\\(vector_size\\(4\\)\\)\\);\r\n}"
+gdb_test "whatis union_with_vector_1" {type = union {...}}
+
 gdb_test "ptype struct_with_vector_1" "type = struct {\r\n\[\t \]+int i;\r\n\[\t \]+char cv __attribute__ \\(\\(vector_size\\(4\\)\\)\\);\r\n\[\t \]+float4 f4;\r\n}"
+gdb_test "whatis struct_with_vector_1" {type = struct {...}}
 
 # Test inferior function calls with vector arguments and/or vector
 # return values.
@@ -216,8 +236,13 @@ gdb_test_multiple "finish" $test {
     }
 }
 
-# Test "return" from vector-valued function.
 gdb_continue "add_some_intvecs"
+gdb_test "up" ""
+gdb_test "p res" "\\{10, 20, 48, 72\\}.*"
+gdb_test "down" ""
+
+
+# Test "return" from vector-valued function.
 set test "return from vector-valued function"
 set should_kfail 0
 gdb_test_multiple "return (int4) \{4, 2, 7, 6\}" $test {
@@ -225,6 +250,7 @@ gdb_test_multiple "return (int4) \{4, 2, 7, 6\}" $test {
        pass $test
     }
     -re "The location .* is unknown.\r\n.* return value .* will be ignored.\r\n" {
+       # This happens, e.g., on s390x unless using the vector ABI.
        set should_kfail 1
        exp_continue
     }
@@ -233,13 +259,17 @@ gdb_test_multiple "return (int4) \{4, 2, 7, 6\}" $test {
        exp_continue
     }
 }
+
+gdb_test "next" ""
 set test "verify vector return value"
-gdb_test_multiple "continue" $test {
-    -re "4 2 7 6\r\n.*$gdb_prompt $" {
+gdb_test_multiple "p res" $test {
+    -re ".*= \\{4, 2, 7, 6\\}\r\n.*$gdb_prompt $" {
        pass $test
     }
-    -re "10 20 48 72\r\n.*$gdb_prompt $" {
+    -re ".*= \\{.*\\}\r\n.*$gdb_prompt $" {
        if { $should_kfail } {
+           # GDB had not actually set the return value, likely due to
+           # PR 8549.  So accept any return value and emit a KFAIL.
            kfail "gdb/8549" $test
        } else {
            fail $test
This page took 0.029202 seconds and 4 git commands to generate.