http://sourceware.org/ml/gdb-patches/2012-10/msg00525.html
authorAndrew Burgess <aburgess@broadcom.com>
Wed, 31 Oct 2012 09:26:22 +0000 (09:26 +0000)
committerAndrew Burgess <aburgess@broadcom.com>
Wed, 31 Oct 2012 09:26:22 +0000 (09:26 +0000)
gdb/ChangeLog

        PR cli/14772
        * c-typeprint.c (c_print_type): Don't print a space for vector
        types, this is handled within the suffix.
        (c_type_print_varspec_suffix): Add a space to vector suffix

gdb/testsuite/ChangeLog

        PR cli/14772
        * gdb.base/gnu_vector.c (union_with_vector_1)
        (struct_with_vector_1): Add new struct and union for testing
        ptype.
        * gdb.base/gnu_vector.exp: Add testing of ptype on vectors, and
        structs / unions containing vectors.

gdb/ChangeLog
gdb/c-typeprint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/gnu_vector.c
gdb/testsuite/gdb.base/gnu_vector.exp

index cb2c7d0b04eeae09b8f9455f40de9ff4cdc43afe..d234e6f5c231ae101a82b4b655c2cf764989f62f 100644 (file)
@@ -1,3 +1,10 @@
+2012-10-31  Andrew Burgess  <aburgess@broadcom.com>
+
+       PR cli/14772
+       * c-typeprint.c (c_print_type): Don't print a space for vector
+       types, this is handled within the suffix.
+       (c_type_print_varspec_suffix): Add a space to vector suffix.
+
 2012-10-26  Pedro Alves  <palves@redhat.com>
 
        * amd64-tdep.c (amd64_relocate_instruction): Use
index 8b5bc2170ac9f1df51b9df1ca3e8f92c6e3b6bba..a43dfce707a02882008a6d3cf6bf478350dddcc8 100644 (file)
@@ -67,7 +67,8 @@ c_print_type (struct type *type,
       || ((show > 0 || TYPE_NAME (type) == 0)
          && (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC
              || code == TYPE_CODE_METHOD
-             || code == TYPE_CODE_ARRAY
+             || (code == TYPE_CODE_ARRAY
+                 && !TYPE_VECTOR (type))
              || code == TYPE_CODE_MEMBERPTR
              || code == TYPE_CODE_METHODPTR
              || code == TYPE_CODE_REF)))
@@ -619,7 +620,7 @@ c_type_print_varspec_suffix (struct type *type,
          fprintf_filtered (stream, ")");
 
        fprintf_filtered (stream, (is_vector ?
-                                  "__attribute__ ((vector_size(" : "["));
+                                  " __attribute__ ((vector_size(" : "["));
        if (get_array_bounds (type, &low_bound, &high_bound))
          fprintf_filtered (stream, "%s", 
                            plongest (high_bound - low_bound + 1));
index b35c3362f846a0abf86f010ff2d51fd77bb99351..8a756aaa27fccbb0a96bd36a4b7a4f5a2ec2904b 100644 (file)
@@ -1,3 +1,12 @@
+2012-10-31  Andrew Burgess  <aburgess@broadcom.com>
+
+       PR cli/14772
+       * gdb.base/gnu_vector.c (union_with_vector_1)
+       (struct_with_vector_1): Add new struct and union for testing
+       ptype.
+       * gdb.base/gnu_vector.exp: Add testing of ptype on vectors, and
+       structs / unions containing vectors.
+
 2012-10-25  Yao Qi  <yao@codesourcery.com>
 
        * gdb.trace/ftrace.exp (test_fast_tracepoints): Use
index dc4f60d661fa3f7c6001bfd367726f28ddceba0f..a2a218f78a40d43e4bf5078acbb847d65427ed2e 100644 (file)
@@ -42,6 +42,19 @@ longlong2 ll2 = {1, 2};
 float2 f2 = {1, 2};
 double2 d2 = {1, 2};
 
+union
+{
+  int i;
+  char cv __attribute__ ((vector_size (sizeof (int))));
+} union_with_vector_1;
+
+struct
+{
+  int i;
+  char cv __attribute__ ((vector_size (sizeof (int))));
+  float4 f4;
+} struct_with_vector_1;
+
 int
 main ()
 {
index a1443a55615b312828d4702a671464178e7ee370..baba119f8eba767baca18fdf9c9d61295e4d86bf 100644 (file)
@@ -130,3 +130,13 @@ gdb_test "print i2 + i4a" "Cannot perform operation on vectors with different ty
 gdb_test "print f4a + f2" "Cannot perform operation on vectors with different types"
 gdb_test "print f2 + f4a" "Cannot perform operation on vectors with different types"
 
+# Test ptype on vector types.
+gdb_test "ptype c4" "type = char __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
+gdb_test "ptype char4" "type = char __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
+gdb_test "ptype i4a" "type = int __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
+gdb_test "ptype int4" "type = int __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
+gdb_test "ptype f4b" "type = float __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
+gdb_test "ptype 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 "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}"