* 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.
+2010-10-06 Ken Werner <ken.werner@de.ibm.com>
+
+ * 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 <dje@google.com>
* cc-with-index.sh: New file.
/* 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)))
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;
}
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;
= 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
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
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
/* 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
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
+2010-10-06 Ken Werner <ken.werner@de.ibm.com>
+
+ * 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 <macro@codesourcery.com>
* gdb.arch/altivec-abi.exp: Fix a typo.
# 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.;"
Contributed by Ken Werner <ken.werner@de.ibm.com> */
+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};
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\\}"