aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog26
-rw-r--r--gdb/c-exp.y34
-rw-r--r--gdb/gdbtypes.c66
-rw-r--r--gdb/gdbtypes.h11
-rw-r--r--gdb/m2-exp.y18
-rw-r--r--gdb/mipsread.c24
-rw-r--r--gdb/valprint.c179
7 files changed, 192 insertions, 166 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6ec6f61..8ee5268 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,29 @@
+Tue Apr 14 22:33:55 1992 Fred Fish (fnf@cygnus.com)
+
+ * gdbtypes.h (FT_FIXED_DECIMAL, FT_FLOAT_DECIMAL): Add defines.
+ * gdbtypes.h (TYPE_FLAG_FUND_TYPE): Add define for bit in a
+ type's flag word that marks it as a fundamental type.
+ * c-exp.y (_initialize_c_exp): Add TYPE_FLAG_FUND_TYPE bit to
+ flags argument for all calls to init_type().
+ * m2-exp.y (_initialize_m2_exp): Add TYPE_FLAG_FUND_TYPE bit to
+ flags argument for all calls to init_type(). Also remove
+ dependency on host sizes for ints, floats, etc.
+ * mipsread.c (_initialize_mipsread): Add TYPE_FLAG_FUND_TYPE bit to
+ flags argument for all calls to init_type(). Also remove
+ dependency on host sizes for ints, floats, etc.
+ * gdbtypes.c (lookup_fundamental_type): Add TYPE_FLAG_FUND_TYPE
+ bit to flags argument for all calls to init_type(). Add types
+ FT_FIXED_DECIMAL and FT_FLOAT_DECIMAL.
+ * valprint.c (unsigned_type_table, signed_type_table,
+ float_type_table): Remove.
+ * valprint.c (type_print_base): Test new TYPE_FLAG_FUND_TYPE
+ bit when printing fundamental types, and print the actual name
+ for such types, rather than inventing one. Remove code that
+ invented fundamental type names.
+ * valprint.c (_initialize_valprint): Remove initializations
+ for now removed unsigned_type_table, signed_type_table, and
+ float_type_table.
+
Mon Apr 13 20:59:21 1992 Fred Fish (fnf@cygnus.com)
* dwarfread.c (target_to_host): New function similar to previous
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index b3bf309..4026d04 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1568,71 +1568,71 @@ _initialize_c_exp ()
{
builtin_type_void =
init_type (TYPE_CODE_VOID, 1,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"void", (struct objfile *) NULL);
builtin_type_char =
init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"char", (struct objfile *) NULL);
builtin_type_signed_char =
init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_SIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_SIGNED,
"signed char", (struct objfile *) NULL);
builtin_type_unsigned_char =
init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_UNSIGNED,
"unsigned char", (struct objfile *) NULL);
builtin_type_short =
init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"short", (struct objfile *) NULL);
builtin_type_unsigned_short =
init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_UNSIGNED,
"unsigned short", (struct objfile *) NULL);
builtin_type_int =
init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"int", (struct objfile *) NULL);
builtin_type_unsigned_int =
init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_UNSIGNED,
"unsigned int", (struct objfile *) NULL);
builtin_type_long =
init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"long", (struct objfile *) NULL);
builtin_type_unsigned_long =
init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_UNSIGNED,
"unsigned long", (struct objfile *) NULL);
builtin_type_long_long =
init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"long long", (struct objfile *) NULL);
builtin_type_unsigned_long_long =
init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_UNSIGNED,
"unsigned long long", (struct objfile *) NULL);
builtin_type_float =
init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"float", (struct objfile *) NULL);
builtin_type_double =
init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"double", (struct objfile *) NULL);
builtin_type_long_double =
init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"long double", (struct objfile *) NULL);
builtin_type_complex =
init_type (TYPE_CODE_FLT, TARGET_COMPLEX_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"complex", (struct objfile *) NULL);
builtin_type_double_complex =
init_type (TYPE_CODE_FLT, TARGET_DOUBLE_COMPLEX_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"double complex", (struct objfile *) NULL);
add_language (&c_language_defn);
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 19dd66a..0d3782d 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -804,148 +804,158 @@ lookup_fundamental_type (objfile, typeid)
case FT_VOID:
type = init_type (TYPE_CODE_VOID,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"void", objfile);
break;
case FT_BOOLEAN:
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_UNSIGNED,
"boolean", objfile);
break;
case FT_STRING:
type = init_type (TYPE_CODE_PASCAL_ARRAY,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"string", objfile);
break;
case FT_CHAR:
type = init_type (TYPE_CODE_INT,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"char", objfile);
break;
case FT_SIGNED_CHAR:
type = init_type (TYPE_CODE_INT,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_SIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_SIGNED,
"signed char", objfile);
break;
case FT_UNSIGNED_CHAR:
type = init_type (TYPE_CODE_INT,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_UNSIGNED,
"unsigned char", objfile);
break;
case FT_SHORT:
type = init_type (TYPE_CODE_INT,
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"short", objfile);
break;
case FT_SIGNED_SHORT:
type = init_type (TYPE_CODE_INT,
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_SIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_SIGNED,
"signed short", objfile);
break;
case FT_UNSIGNED_SHORT:
type = init_type (TYPE_CODE_INT,
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_UNSIGNED,
"unsigned short", objfile);
break;
case FT_INTEGER:
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"int", objfile);
break;
case FT_SIGNED_INTEGER:
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_SIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_SIGNED,
"signed int", objfile);
break;
case FT_UNSIGNED_INTEGER:
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_UNSIGNED,
"unsigned int", objfile);
break;
+ case FT_FIXED_DECIMAL:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_INT_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_FUND_TYPE,
+ "fixed decimal", objfile);
+ break;
case FT_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"long", objfile);
break;
case FT_SIGNED_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_SIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_SIGNED,
"signed long", objfile);
break;
case FT_UNSIGNED_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_UNSIGNED,
"unsigned long", objfile);
break;
case FT_LONG_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"long long", objfile);
break;
case FT_SIGNED_LONG_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_SIGNED,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_SIGNED,
"signed long long", objfile);
break;
case FT_UNSIGNED_LONG_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
- "unsigned long long",
- objfile);
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_UNSIGNED,
+ "unsigned long long", objfile);
break;
case FT_FLOAT:
type = init_type (TYPE_CODE_FLT,
TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"float", objfile);
break;
case FT_DBL_PREC_FLOAT:
type = init_type (TYPE_CODE_FLT,
TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"double", objfile);
break;
+ case FT_FLOAT_DECIMAL:
+ type = init_type (TYPE_CODE_FLT,
+ TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_FUND_TYPE,
+ "floating decimal", objfile);
+ break;
case FT_EXT_PREC_FLOAT:
type = init_type (TYPE_CODE_FLT,
TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"long double", objfile);
break;
case FT_COMPLEX:
type = init_type (TYPE_CODE_FLT,
TARGET_COMPLEX_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"complex", objfile);
break;
case FT_DBL_PREC_COMPLEX:
type = init_type (TYPE_CODE_FLT,
TARGET_DOUBLE_COMPLEX_BIT / TARGET_CHAR_BIT,
- 0,
+ TYPE_FLAG_FUND_TYPE,
"double complex", objfile);
break;
case FT_EXT_PREC_COMPLEX:
type = init_type (TYPE_CODE_FLT,
TARGET_DOUBLE_COMPLEX_BIT / TARGET_CHAR_BIT,
- 0,
- "long double complex",
- objfile);
+ TYPE_FLAG_FUND_TYPE,
+ "long double complex", objfile);
break;
}
/* Install the newly created type in the objfile's fundamental_types
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 3594f8f..5d26033 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -49,8 +49,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define FT_DBL_PREC_COMPLEX 21
#define FT_EXT_PREC_COMPLEX 22
#define FT_STRING 23
+#define FT_FIXED_DECIMAL 24
+#define FT_FLOAT_DECIMAL 25
-#define FT_NUM_MEMBERS 24
+#define FT_NUM_MEMBERS 26
/* Different kinds of data types are distinguished by the `code' field. */
@@ -87,7 +89,7 @@ enum type_code
#define TYPE_FLAG_UNSIGNED (1 << 0)
-/* Explicity signed integer type */
+/* Explicitly signed integer type */
#define TYPE_FLAG_SIGNED (1 << 1)
@@ -97,6 +99,11 @@ enum type_code
#define TYPE_FLAG_STUB (1 << 2)
+/* This type is a fundamental type in the current source language. */
+
+#define TYPE_FLAG_FUND_TYPE (1 << 3)
+
+
struct type
{
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index a1bf96f..2274b16 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -1233,24 +1233,26 @@ const struct language_defn m2_language_defn = {
void
_initialize_m2_exp ()
{
- /* FIXME: The code below assumes that the sizes of the basic data
- types are the same on the host and target machines!!! */
-
/* Modula-2 "pervasive" types. NOTE: these can be redefined!!! */
builtin_type_m2_int =
- init_type (TYPE_CODE_INT, sizeof(int), 0,
+ init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_FUND_TYPE,
"INTEGER", (struct objfile *) NULL);
builtin_type_m2_card =
- init_type (TYPE_CODE_INT, sizeof(int), TYPE_FLAG_UNSIGNED,
+ init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_UNSIGNED,
"CARDINAL", (struct objfile *) NULL);
builtin_type_m2_real =
- init_type (TYPE_CODE_FLT, sizeof(float), 0,
+ init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_FUND_TYPE,
"REAL", (struct objfile *) NULL);
builtin_type_m2_char =
- init_type (TYPE_CODE_CHAR, sizeof(char), TYPE_FLAG_UNSIGNED,
+ init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_UNSIGNED,
"CHAR", (struct objfile *) NULL);
builtin_type_m2_bool =
- init_type (TYPE_CODE_BOOL, sizeof(int), TYPE_FLAG_UNSIGNED,
+ init_type (TYPE_CODE_BOOL, TARGET_INT_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_FUND_TYPE | TYPE_FLAG_UNSIGNED,
"BOOLEAN", (struct objfile *) NULL);
TYPE_NFIELDS(builtin_type_m2_bool) = 2;
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
index 55ec960..433beb3 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -3053,24 +3053,30 @@ _initialize_mipsread ()
add_symtab_fns (&ecoff_sym_fns);
/* Missing basic types */
+
builtin_type_string =
- init_type (TYPE_CODE_PASCAL_ARRAY,
- 1, 0, "string",
- (struct objfile *) NULL);
+ init_type(TYPE_CODE_PASCAL_ARRAY,
+ TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_FUND_TYPE, "string",
+ (struct objfile *) NULL);
builtin_type_complex =
init_type(TYPE_CODE_FLT,
- 2 * sizeof(float), 0, "complex",
+ TARGET_COMPLEX_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_FUND_TYPE, "complex",
(struct objfile *) NULL);
builtin_type_double_complex =
init_type(TYPE_CODE_FLT,
- 2 * sizeof(double), 0, "double_complex",
+ TARGET_DOUBLE_COMPLEX_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_FUND_TYPE, "double complex",
(struct objfile *) NULL);
builtin_type_fixed_dec =
- init_type(TYPE_CODE_INT, sizeof(int),
- 0, "fixed_decimal",
+ init_type(TYPE_CODE_INT,
+ TARGET_INT_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_FUND_TYPE, "fixed decimal",
(struct objfile *) NULL);
builtin_type_float_dec =
- init_type(TYPE_CODE_FLT, sizeof(double),
- 0, "floating_decimal",
+ init_type(TYPE_CODE_FLT,
+ TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_FUND_TYPE, "floating decimal",
(struct objfile *) NULL);
}
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 8b8c405..114c06b 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -95,12 +95,6 @@ unsigned input_radix = 10;
unsigned output_radix = 10;
int output_format = 0;
-
-char **unsigned_type_table;
-char **signed_type_table;
-char **float_type_table;
-
-
/* Print repeat counts if there are more than this
many repetitions of an element in an array. */
#define REPEAT_COUNT_THRESHOLD 10
@@ -662,6 +656,61 @@ cplus_val_print (type, valaddr, stream, format, recurse, pretty, dont_print)
}
}
+static void
+print_class_member (valaddr, domain, stream, prefix)
+ char *valaddr;
+ struct type *domain;
+ FILE *stream;
+ char *prefix;
+{
+
+ /* VAL is a byte offset into the structure type DOMAIN.
+ Find the name of the field for that offset and
+ print it. */
+ int extra = 0;
+ int bits = 0;
+ register unsigned int i;
+ unsigned len = TYPE_NFIELDS (domain);
+ /* @@ Make VAL into bit offset */
+ LONGEST val = unpack_long (builtin_type_int, valaddr) << 3;
+ for (i = TYPE_N_BASECLASSES (domain); i < len; i++)
+ {
+ int bitpos = TYPE_FIELD_BITPOS (domain, i);
+ QUIT;
+ if (val == bitpos)
+ break;
+ if (val < bitpos && i != 0)
+ {
+ /* Somehow pointing into a field. */
+ i -= 1;
+ extra = (val - TYPE_FIELD_BITPOS (domain, i));
+ if (extra & 0x7)
+ bits = 1;
+ else
+ extra >>= 3;
+ break;
+ }
+ }
+ if (i < len)
+ {
+ char *name;
+ fprintf_filtered (stream, prefix);
+ name = type_name_no_tag (domain);
+ if (name)
+ fputs_filtered (name, stream);
+ else
+ type_print_base (domain, stream, 0, 0);
+ fprintf_filtered (stream, "::");
+ fputs_filtered (TYPE_FIELD_NAME (domain, i), stream);
+ if (extra)
+ fprintf_filtered (stream, " + %d bytes", extra);
+ if (bits)
+ fprintf_filtered (stream, " (offset in bits)");
+ }
+ else
+ fprintf_filtered (stream, "%d", val >> 3);
+}
+
/* Print data of type TYPE located at VALADDR (within GDB),
which came from the inferior at address ADDRESS,
onto stdio stream STREAM according to FORMAT
@@ -871,47 +920,9 @@ val_print (type, valaddr, address, stream, format, deref_ref, recurse, pretty)
}
else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_MEMBER)
{
- struct type *domain = TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (type));
-
- /* VAL is a byte offset into the structure type DOMAIN.
- Find the name of the field for that offset and
- print it. */
- int extra = 0;
- int bits = 0;
- len = TYPE_NFIELDS (domain);
- /* @@ Make VAL into bit offset */
- val = unpack_long (builtin_type_int, valaddr) << 3;
- for (i = TYPE_N_BASECLASSES (domain); i < len; i++)
- {
- int bitpos = TYPE_FIELD_BITPOS (domain, i);
- QUIT;
- if (val == bitpos)
- break;
- if (val < bitpos && i != 0)
- {
- /* Somehow pointing into a field. */
- i -= 1;
- extra = (val - TYPE_FIELD_BITPOS (domain, i));
- if (extra & 0x7)
- bits = 1;
- else
- extra >>= 3;
- break;
- }
- }
- if (i < len)
- {
- fprintf_filtered (stream, "&");
- type_print_base (domain, stream, 0, 0);
- fprintf_filtered (stream, "::");
- fputs_filtered (TYPE_FIELD_NAME (domain, i), stream);
- if (extra)
- fprintf_filtered (stream, " + %d bytes", extra);
- if (bits)
- fprintf_filtered (stream, " (offset in bits)");
- break;
- }
- fprintf_filtered (stream, "%d", val >> 3);
+ print_class_member (valaddr,
+ TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (type)),
+ stream, "&");
}
else
{
@@ -1058,6 +1069,13 @@ val_print (type, valaddr, address, stream, format, deref_ref, recurse, pretty)
break;
case TYPE_CODE_REF:
+ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_MEMBER)
+ {
+ print_class_member (valaddr,
+ TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (type)),
+ stream, "");
+ break;
+ }
if (addressprint)
{
fprintf_filtered (stream, "@0x%lx",
@@ -1449,6 +1467,7 @@ type_print_varspec_prefix (type, stream, show, passed_a_ptr)
int show;
int passed_a_ptr;
{
+ char *name;
if (type == 0)
return;
@@ -1470,8 +1489,11 @@ type_print_varspec_prefix (type, stream, show, passed_a_ptr)
type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0,
0);
fprintf_filtered (stream, " ");
- type_print_base (TYPE_DOMAIN_TYPE (type), stream, 0,
- passed_a_ptr);
+ name = type_name_no_tag (TYPE_DOMAIN_TYPE (type));
+ if (name)
+ fputs_filtered (name, stream);
+ else
+ type_print_base (TYPE_DOMAIN_TYPE (type), stream, 0, passed_a_ptr);
fprintf_filtered (stream, "::");
break;
@@ -1656,7 +1678,12 @@ type_print_base (type, stream, show, level)
return;
}
- if (TYPE_NAME (type) && show <= 0)
+ /* If the type is a fundamental type, then always print the type name
+ directly from the type. Also print the type name directly whenever
+ SHOW drops to zero and there is a valid type name to print. */
+
+ if ((TYPE_FLAGS (type) & TYPE_FLAG_FUND_TYPE) ||
+ ((show <= 0) && (TYPE_NAME (type) != NULL)))
{
fputs_filtered (TYPE_NAME (type), stream);
return;
@@ -1836,27 +1863,6 @@ type_print_base (type, stream, show, level)
}
break;
- case TYPE_CODE_INT:
- name = 0;
- if (TYPE_LENGTH (type) <= sizeof (LONGEST))
- {
- if (TYPE_UNSIGNED (type))
- name = unsigned_type_table[TYPE_LENGTH (type)];
- else
- name = signed_type_table[TYPE_LENGTH (type)];
- }
- if (name)
- fputs_filtered (name, stream);
- else
- fprintf_filtered (stream, "<%d bit integer>",
- TYPE_LENGTH (type) * TARGET_CHAR_BIT);
- break;
-
- case TYPE_CODE_FLT:
- name = float_type_table[TYPE_LENGTH (type)];
- fputs_filtered (name, stream);
- break;
-
case TYPE_CODE_VOID:
fprintf_filtered (stream, "void");
break;
@@ -2070,36 +2076,5 @@ _initialize_valprint ()
print_max = 200;
- /* Initialize the names of the various types based on their lengths on
- the target, in bits. Note that ordering is important, so that for example,
- if ints and longs are the same size, that size will default to "int". */
-
- unsigned_type_table = (char **)
- xmalloc ((1 + (TARGET_LONG_LONG_BIT/TARGET_CHAR_BIT)) * sizeof (char *));
- bzero (unsigned_type_table, (1 + (TARGET_LONG_LONG_BIT/TARGET_CHAR_BIT)));
- unsigned_type_table[TARGET_CHAR_BIT/TARGET_CHAR_BIT] = "unsigned char";
- unsigned_type_table[TARGET_SHORT_BIT/TARGET_CHAR_BIT] = "unsigned short";
- unsigned_type_table[TARGET_LONG_LONG_BIT/TARGET_CHAR_BIT] = "unsigned long long";
- unsigned_type_table[TARGET_LONG_BIT/TARGET_CHAR_BIT] = "unsigned long";
- unsigned_type_table[TARGET_INT_BIT/TARGET_CHAR_BIT] = "unsigned int";
-
- signed_type_table = (char **)
- xmalloc ((1 + (TARGET_LONG_LONG_BIT/TARGET_CHAR_BIT)) * sizeof (char *));
- bzero (signed_type_table, (1 + (TARGET_LONG_LONG_BIT/TARGET_CHAR_BIT)));
- signed_type_table[TARGET_CHAR_BIT/TARGET_CHAR_BIT] = "char";
- signed_type_table[TARGET_SHORT_BIT/TARGET_CHAR_BIT] = "short";
- signed_type_table[TARGET_LONG_LONG_BIT/TARGET_CHAR_BIT] = "long long";
- signed_type_table[TARGET_LONG_BIT/TARGET_CHAR_BIT] = "long";
- signed_type_table[TARGET_INT_BIT/TARGET_CHAR_BIT] = "int";
-
- float_type_table = (char **)
- xmalloc ((1 + (TARGET_LONG_DOUBLE_BIT/TARGET_CHAR_BIT)) * sizeof (char *));
- bzero (float_type_table, (1 + (TARGET_LONG_DOUBLE_BIT/TARGET_CHAR_BIT)));
- float_type_table[TARGET_FLOAT_BIT/TARGET_CHAR_BIT] = "float";
- float_type_table[TARGET_DOUBLE_COMPLEX_BIT/TARGET_CHAR_BIT] = "double complex";
- float_type_table[TARGET_COMPLEX_BIT/TARGET_CHAR_BIT] = "complex";
- float_type_table[TARGET_LONG_DOUBLE_BIT/TARGET_CHAR_BIT] = "long double";
- float_type_table[TARGET_DOUBLE_BIT/TARGET_CHAR_BIT] = "double";
-
obstack_begin (&dont_print_obstack, 32 * sizeof (struct type *));
}