From: Ken Werner Date: Wed, 6 Oct 2010 08:44:15 +0000 (+0000) Subject: gdb: X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2844d6b5a2e0a0a7ec180f97d29acc06000587cd;p=binutils-gdb.git gdb: * gdbtypes.h (struct main_type): Remove flag_nottext. (enum type_flag_value): Remove TYPE_FLAG_NOTTEXT. (enum type_instance_flag_value): Add TYPE_INSTANCE_FLAG_NOTTEXT. (TYPE_NOTTEXT): Use TYPE_INSTANCE_FLAG_NOTTEXT instead of flag_nottext. * gdbtypes.c (make_vector_type): Use TYPE_INSTANCE_FLAG_NOTTEXT instead of TYPE_FLAG_NOTTEXT. (init_type): Remove the initialization of the flag_nottext field. (gdbtypes_post_init): Use TYPE_INSTANCE_FLAG_NOTTEXT instead of TYPE_FLAG_NOTTEXT. * c-valprint.c (c_val_print): Remove TYPE_VECTOR check. gdb/testsuite: * gdb.base/gnu_vector.c: Add variable c4. * gdb.base/gnu_vector.exp: Add tests for character vector printing. * gdb.arch/altivec-abi.exp: Fix expect pattern of character vectors. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7968e937ffa..62045effc0f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2010-10-06 Ken Werner + + * gdbtypes.h (struct main_type): Remove flag_nottext. + (enum type_flag_value): Remove TYPE_FLAG_NOTTEXT. + (enum type_instance_flag_value): Add TYPE_INSTANCE_FLAG_NOTTEXT. + (TYPE_NOTTEXT): Use TYPE_INSTANCE_FLAG_NOTTEXT instead of flag_nottext. + * gdbtypes.c (make_vector_type): Use TYPE_INSTANCE_FLAG_NOTTEXT instead + of TYPE_FLAG_NOTTEXT. + (init_type): Remove the initialization of the flag_nottext field. + (gdbtypes_post_init): Use TYPE_INSTANCE_FLAG_NOTTEXT instead of + TYPE_FLAG_NOTTEXT. + * c-valprint.c (c_val_print): Remove TYPE_VECTOR check. + 2010-10-04 Doug Evans * cc-with-index.sh: New file. diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index f0895a4d9c1..521460b21fc 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -180,8 +180,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, /* Print arrays of textual chars with a string syntax, as long as the entire array is valid. */ - if (!TYPE_VECTOR (type) - && c_textual_element_type (unresolved_elttype, options->format) + if (c_textual_element_type (unresolved_elttype, options->format) && value_bits_valid (original_value, TARGET_CHAR_BIT * embedded_offset, TARGET_CHAR_BIT * TYPE_LENGTH (type))) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index c35adbb84b9..af28ca122e9 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -942,7 +942,7 @@ make_vector_type (struct type *array_type) elt_type = TYPE_TARGET_TYPE (inner_array); if (TYPE_CODE (elt_type) == TYPE_CODE_INT) { - flags = TYPE_INSTANCE_FLAGS (elt_type) | TYPE_FLAG_NOTTEXT; + flags = TYPE_INSTANCE_FLAGS (elt_type) | TYPE_INSTANCE_FLAG_NOTTEXT; elt_type = make_qualified_type (elt_type, flags, NULL); TYPE_TARGET_TYPE (inner_array) = elt_type; } @@ -1801,8 +1801,6 @@ init_type (enum type_code code, int length, int flags, TYPE_VECTOR (type) = 1; if (flags & TYPE_FLAG_STUB_SUPPORTED) TYPE_STUB_SUPPORTED (type) = 1; - if (flags & TYPE_FLAG_NOTTEXT) - TYPE_NOTTEXT (type) = 1; if (flags & TYPE_FLAG_FIXED_INSTANCE) TYPE_FIXED_INSTANCE (type) = 1; @@ -3490,8 +3488,10 @@ gdbtypes_post_init (struct gdbarch *gdbarch) = arch_integer_type (gdbarch, 128, 0, "int128_t"); builtin_type->builtin_uint128 = arch_integer_type (gdbarch, 128, 1, "uint128_t"); - TYPE_NOTTEXT (builtin_type->builtin_int8) = 1; - TYPE_NOTTEXT (builtin_type->builtin_uint8) = 1; + TYPE_INSTANCE_FLAGS (builtin_type->builtin_int8) |= + TYPE_INSTANCE_FLAG_NOTTEXT; + TYPE_INSTANCE_FLAGS (builtin_type->builtin_uint8) |= + TYPE_INSTANCE_FLAG_NOTTEXT; /* Wide character types. */ builtin_type->builtin_char16 diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index dba7284377d..a6e5762a1fa 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -159,18 +159,17 @@ enum type_code enum type_flag_value { - TYPE_FLAG_UNSIGNED = (1 << 6), - TYPE_FLAG_NOSIGN = (1 << 7), - TYPE_FLAG_STUB = (1 << 8), - TYPE_FLAG_TARGET_STUB = (1 << 9), - TYPE_FLAG_STATIC = (1 << 10), - TYPE_FLAG_PROTOTYPED = (1 << 11), - TYPE_FLAG_INCOMPLETE = (1 << 12), - TYPE_FLAG_VARARGS = (1 << 13), - TYPE_FLAG_VECTOR = (1 << 14), - TYPE_FLAG_FIXED_INSTANCE = (1 << 15), - TYPE_FLAG_STUB_SUPPORTED = (1 << 16), - TYPE_FLAG_NOTTEXT = (1 << 17), + TYPE_FLAG_UNSIGNED = (1 << 7), + TYPE_FLAG_NOSIGN = (1 << 8), + TYPE_FLAG_STUB = (1 << 9), + TYPE_FLAG_TARGET_STUB = (1 << 10), + TYPE_FLAG_STATIC = (1 << 11), + TYPE_FLAG_PROTOTYPED = (1 << 12), + TYPE_FLAG_INCOMPLETE = (1 << 13), + TYPE_FLAG_VARARGS = (1 << 14), + TYPE_FLAG_VECTOR = (1 << 15), + TYPE_FLAG_FIXED_INSTANCE = (1 << 16), + TYPE_FLAG_STUB_SUPPORTED = (1 << 17), /* Used for error-checking. */ TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED @@ -186,7 +185,8 @@ enum type_instance_flag_value TYPE_INSTANCE_FLAG_CODE_SPACE = (1 << 2), TYPE_INSTANCE_FLAG_DATA_SPACE = (1 << 3), TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 = (1 << 4), - TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 = (1 << 5) + TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 = (1 << 5), + TYPE_INSTANCE_FLAG_NOTTEXT = (1 << 6), }; /* Unsigned integer type. If this is not set for a TYPE_CODE_INT, the @@ -269,7 +269,7 @@ enum type_instance_flag_value /* Not textual. By default, GDB treats all single byte integers as characters (or elements of strings) unless this flag is set. */ -#define TYPE_NOTTEXT(t) (TYPE_MAIN_TYPE (t)->flag_nottext) +#define TYPE_NOTTEXT(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_NOTTEXT) /* Type owner. If TYPE_OBJFILE_OWNED is true, the type is owned by the objfile retrieved as TYPE_OBJFILE. Otherweise, the type is @@ -388,7 +388,6 @@ struct main_type unsigned int flag_varargs : 1; unsigned int flag_vector : 1; unsigned int flag_stub_supported : 1; - unsigned int flag_nottext : 1; unsigned int flag_fixed_instance : 1; unsigned int flag_objfile_owned : 1; /* True if this type was declared with "class" rather than diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index dfa5f0824b0..f7d3eb5c258 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-10-06 Ken Werner + + * gdb.base/gnu_vector.c: Add variable c4. + * gdb.base/gnu_vector.exp: Add tests for character vector printing. + * gdb.arch/altivec-abi.exp: Fix expect pattern of character vectors. + 2010-10-05 Maciej W. Rozycki * gdb.arch/altivec-abi.exp: Fix a typo. diff --git a/gdb/testsuite/gdb.arch/altivec-abi.exp b/gdb/testsuite/gdb.arch/altivec-abi.exp index 72723d8c962..9915ee41187 100644 --- a/gdb/testsuite/gdb.arch/altivec-abi.exp +++ b/gdb/testsuite/gdb.arch/altivec-abi.exp @@ -82,7 +82,7 @@ proc altivec_abi_tests { extra_flags force_abi } { # now all the arguments of vec_fun are initialized - set pattern "vec_func .vshort_f=.111, 222, 333, 444, 555, 666, 777, 888., vushort_f=.100, 200, 300, 400, 500, 600, 700, 800., vint_f=.-10, -20, -30, -40., vuint_f=.1111, 2222, 3333, 4444., vchar_f=.97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g', 104 'h', 105 'i', 108 'l', 109 'm', 110 'n', 111 'o', 112 'p', 113 'q', 114 'r'., vuchar_f=.65 'A', 66 'B', 67 'C', 68 'D', 69 'E', 70 'F', 71 'G', 72 'H', 73 'I', 76 'L', 77 'M', 78 'N', 79 'O', 80 'P', 81 'Q', 82 'R'., vfloat_f=.1.25, 3.75, 5.5, 1.25., x_f=.1, 2, 3, 4, 5, 6, 7, 8., y_f=.12, 22, 32, 42., a_f=.118 'v', 101 'e', 99 'c', 116 't', 111 'o', 114 'r', 32 ' ', 111 'o', 102 'f', 32 ' ', 99 'c', 104 'h', 97 'a', 114 'r', 115 's', 46 '.'., b_f=.5.5, 4.5, 3.75, 2.25., c_f=.1.25, 3.5, 5.5, 7.75., intv_on_stack_f=.12, 34, 56, 78.." + set pattern "vec_func .vshort_f=.111, 222, 333, 444, 555, 666, 777, 888., vushort_f=.100, 200, 300, 400, 500, 600, 700, 800., vint_f=.-10, -20, -30, -40., vuint_f=.1111, 2222, 3333, 4444., vchar_f=.97, 98, 99, 100, 101, 102, 103, 104, 105, 108, 109, 110, 111, 112, 113, 114., vuchar_f=.65, 66, 67, 68, 69, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82., vfloat_f=.1.25, 3.75, 5.5, 1.25., x_f=.1, 2, 3, 4, 5, 6, 7, 8., y_f=.12, 22, 32, 42., a_f=.118, 101, 99, 116, 111, 114, 32, 111, 102, 32, 99, 104, 97, 114, 115, 46., b_f=.5.5, 4.5, 3.75, 2.25., c_f=.1.25, 3.5, 5.5, 7.75., intv_on_stack_f=.12, 34, 56, 78.." set pattern1 $pattern append pattern1 " at.*altivec-abi.c.*vint_res = vec_add.*vint_f, intv_on_stack_f.;" diff --git a/gdb/testsuite/gdb.base/gnu_vector.c b/gdb/testsuite/gdb.base/gnu_vector.c index 8efb4cb8f28..4bcb6e58b2a 100644 --- a/gdb/testsuite/gdb.base/gnu_vector.c +++ b/gdb/testsuite/gdb.base/gnu_vector.c @@ -17,6 +17,7 @@ Contributed by Ken Werner */ +char __attribute__ ((vector_size (4 * sizeof(char)))) c4 = {1, 2, 3, 4}; int __attribute__ ((vector_size (4 * sizeof(int)))) i4a = {2, 4, 8, 16}; int __attribute__ ((vector_size (4 * sizeof(int)))) i4b = {1, 2, 8, 4}; float __attribute__ ((vector_size (4 * sizeof(float)))) f4a = {2, 4, 8, 16}; diff --git a/gdb/testsuite/gdb.base/gnu_vector.exp b/gdb/testsuite/gdb.base/gnu_vector.exp index b2f1dab684a..bedc059382e 100644 --- a/gdb/testsuite/gdb.base/gnu_vector.exp +++ b/gdb/testsuite/gdb.base/gnu_vector.exp @@ -46,6 +46,10 @@ if { ![runto main] } { return -1 } +# Test printing of character vector types +gdb_test "print c4" "\\\$$decimal = \\{1, 2, 3, 4\\}" +gdb_test "print c4\[2\]" "\\\$$decimal = 3" + # Test binary operators on integer vector types gdb_test "print i4a" "\\\$$decimal = \\{2, 4, 8, 16\\}" gdb_test "print i4b" "\\\$$decimal = \\{1, 2, 8, 4\\}"