summaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-09-05 00:51:49 +0000
committerDaniel Jacobowitz <drow@false.org>2007-09-05 00:51:49 +0000
commitea37ba09261f349ac2748da0d4f8f513184776f9 (patch)
treee809a75cbee45334e9521254235524a6394f406c /gdb/gdbtypes.c
parentfcd776e5474bde02e7555b33ef57905eae0f7d3e (diff)
downloadbinutils-gdb-ea37ba09261f349ac2748da0d4f8f513184776f9.tar.gz
* NEWS: Update description of string changes. Mention print/s.
* c-valprint.c (textual_element_type): New. (c_val_print): Use it. Do not skip address printing for pointers with a string format. (c_value_print): Doc update. * dwarf2read.c (read_array_type): Use make_vector_type. * gdbtypes.c (make_vector_type): New. (init_vector_type): Use it. (gdbtypes_post_init): Initialize builtin_true_unsigned_char. (_initialize_gdbtypes): Mark int8_t and uint8_t as TYPE_FLAG_NOTTEXT. * gdbtypes.h (struct builtin_type): Add builtin_true_unsigned_char. (TYPE_FLAG_NOTTEXT, TYPE_NOTTEXT): New. (make_vector_type): New. * printcmd.c (print_formatted): Only handle 's' and 'i' for examine. Call the language print routine for string format. (print_scalar_formatted): Call val_print for string format. Handle unsigned original types for char format. (validate_format): Do not reject string format. * stabsread.c (read_type): Use make_vector_type. * xml-tdesc.c (tdesc_start_vector): Use init_vector_type. * gdb.texinfo (Output Formats): Update 'c' description. Describe 's'. (Examining Memory): Update mentions of the 's' format. (Automatic Display): Likewise. * gdb.arch/i386-sse.exp: Do not expect character constants. * gdb.base/charsign.c, gdb.base/charsign.exp: Delete. * gdb.base/display.exp: Allow print/s. * gdb.base/printcmds.exp, gdb.base/setvar.exp: Revert signed and unsigned char array changes.
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r--gdb/gdbtypes.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 171447d4cac..838bfcffeee 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -917,6 +917,32 @@ init_flags_type (char *name, int length)
return type;
}
+/* Convert ARRAY_TYPE to a vector type. This may modify ARRAY_TYPE
+ and any array types nested inside it. */
+
+void
+make_vector_type (struct type *array_type)
+{
+ struct type *inner_array, *elt_type;
+ int flags;
+
+ /* Find the innermost array type, in case the array is
+ multi-dimensional. */
+ inner_array = array_type;
+ while (TYPE_CODE (TYPE_TARGET_TYPE (inner_array)) == TYPE_CODE_ARRAY)
+ inner_array = TYPE_TARGET_TYPE (inner_array);
+
+ elt_type = TYPE_TARGET_TYPE (inner_array);
+ if (TYPE_CODE (elt_type) == TYPE_CODE_INT)
+ {
+ flags = TYPE_INSTANCE_FLAGS (elt_type) | TYPE_FLAG_NOTTEXT;
+ elt_type = make_qualified_type (elt_type, flags, NULL);
+ TYPE_TARGET_TYPE (inner_array) = elt_type;
+ }
+
+ TYPE_FLAGS (array_type) |= TYPE_FLAG_VECTOR;
+}
+
struct type *
init_vector_type (struct type *elt_type, int n)
{
@@ -926,7 +952,7 @@ init_vector_type (struct type *elt_type, int n)
create_range_type (0,
builtin_type_int,
0, n-1));
- TYPE_FLAGS (array_type) |= TYPE_FLAG_VECTOR;
+ make_vector_type (array_type);
return array_type;
}
@@ -3410,6 +3436,10 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0,
"true character", (struct objfile *) NULL);
+ builtin_type->builtin_true_unsigned_char =
+ init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED,
+ "true character", (struct objfile *) NULL);
builtin_type->builtin_signed_char =
init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0,
@@ -3557,11 +3587,11 @@ _initialize_gdbtypes (void)
"int0_t", (struct objfile *) NULL);
builtin_type_int8 =
init_type (TYPE_CODE_INT, 8 / 8,
- 0,
+ TYPE_FLAG_NOTTEXT,
"int8_t", (struct objfile *) NULL);
builtin_type_uint8 =
init_type (TYPE_CODE_INT, 8 / 8,
- TYPE_FLAG_UNSIGNED,
+ TYPE_FLAG_UNSIGNED | TYPE_FLAG_NOTTEXT,
"uint8_t", (struct objfile *) NULL);
builtin_type_int16 =
init_type (TYPE_CODE_INT, 16 / 8,