diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2007-12-04 23:33:00 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2007-12-04 23:33:00 +0000 |
commit | 6ccb916229b6180c23485cc27d06acd1715efbdd (patch) | |
tree | fb462c428d66c1a217a96aa34e95dd7671e3f0ea /gdb | |
parent | abaa399568d8dea6b959350e387968eb746115c9 (diff) | |
download | gdb-6ccb916229b6180c23485cc27d06acd1715efbdd.zip gdb-6ccb916229b6180c23485cc27d06acd1715efbdd.tar.gz gdb-6ccb916229b6180c23485cc27d06acd1715efbdd.tar.bz2 |
* coffread.c (decode_type): Use builtin_type_int32 instead
of FT_INTEGER fundamental type for array range index type.
(decode_base_type): Use builtin types of current_gdbarch
instead of fundamental types.
* dwarf2read.c (struct dwarf2_cu): Remove ftypes member.
(read_file_scope): Do not initialize ftypes member.
(dwarf_base_type, dwarf2_fundamental_types): Remove functions.
(read_array_type): Use builtin_type_int32 instead of FT_INTEGER
fundamental type for array range index type.
(read_tag_string_type): Likewise for string range index type.
Also, do not overwrite FT_CHAR type with new string type.
(read_base_type): If DW_AT_name is missing, create unnamed type
with given properties instead of looking for a fundamental type.
Create new types as TYPE_TARGET_TYPE for DW_ATE_address and
DW_ATE_complex_float types.
(read_subrange_type): Create new type to represent missing
DW_AT_type instead of looking for a fundamental type.
(die_type): Use builtin type to represent "void" instead of
looking for a fundamental type.
* stabsread.c (define_symbol): Use builtin types to represent
'r' and 'i' floating-point and integer constants.
* gdbtypes.c (lookup_fundamental_type): Remove.
* gdbtypes.h (lookup_fundamental_type): Remove prototype.
(FT_VOID, FT_BOOLEAN, FT_CHAR, FT_SIGNED_CHAR, FT_UNSIGNED_CHAR,
FT_SHORT, FT_SIGNED_SHORT, FT_UNSIGNED_SHORT, FT_INTEGER,
FT_SIGNED_INTEGER, FT_UNSIGNED_INTEGER, FT_LONG, FT_SIGNED_LONG,
FT_UNSIGNED_LONG, FT_LONG_LONG, FT_SIGNED_LONG_LONG,
FT_UNSIGNED_LONG_LONG, FT_FLOAT, FT_DBL_PREC_FLOAT, FT_EXT_PREC_FLOAT,
FT_COMPLEX, FT_DBL_PREC_COMPLEX, FT_EXT_PREC_COMPLEX, FT_STRING,
FT_FIXED_DECIMAL, FT_FLOAT_DECIMAL, FT_BYTE, FT_UNSIGNED_BYTE,
FT_TEMPLATE_ARG, FT_DECFLOAT, FT_DBL_PREC_DECFLOAT,
FT_EXT_PREC_DECFLOAT, FT_NUM_MEMBERS): Remove macros.
* objfiles.c (struct objfile): Remove fundamental_types member.
* symfile.c (reread_symbols): Do not clear fundamental_types.
* language.h (struct language_defn): Remove la_fund_type member.
(create_fundamental_type): Remove.
* language.c (unk_lang_create_fundamental_type): Remove.
(unknown_language_defn, auto_language_defn,
local_language_defn): Adapt initializer.
* ada-lang.c (ada_create_fundamental_type): Remove.
(ada_language_defn): Adapt initializer.
* c-lang.h (c_create_fundamental_type): Remove prototype.
* c-lang.c (c_create_fundamental_type): Remove.
(c_language_defn, cplus_language_defn, asm_language_defn,
minimal_language_defn): Adapt initializer.
* f-lang.c (f_create_fundamental_type): Remove.
(f_language_defn): Adapt initializer.
* jv-lang.c (java_create_fundamental_type): Remove.
(java_language_defn): Adapt initializer.
* m2-lang.c (m2_create_fundamental_type): Remove.
(m2_language_defn): Adapt initializer.
* objc-lang.c (objc_create_fundamental_type): Remove.
(objc_language_defn): Adapt initializer.
* p-lang.h (pascal_create_fundamental_type): Remove prototype.
* p-lang.c (pascal_create_fundamental_type): Remove.
(pascal_language_defn): Adapt initializer.
* scm-lang.c (scm_language_defn): Adapt initializer.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 64 | ||||
-rw-r--r-- | gdb/ada-lang.c | 148 | ||||
-rw-r--r-- | gdb/c-lang.c | 203 | ||||
-rw-r--r-- | gdb/c-lang.h | 2 | ||||
-rw-r--r-- | gdb/coffread.c | 34 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 263 | ||||
-rw-r--r-- | gdb/f-lang.c | 166 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 59 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 45 | ||||
-rw-r--r-- | gdb/jv-lang.c | 32 | ||||
-rw-r--r-- | gdb/language.c | 11 | ||||
-rw-r--r-- | gdb/language.h | 5 | ||||
-rw-r--r-- | gdb/m2-lang.c | 170 | ||||
-rw-r--r-- | gdb/objc-lang.c | 147 | ||||
-rw-r--r-- | gdb/objfiles.h | 12 | ||||
-rw-r--r-- | gdb/p-lang.c | 148 | ||||
-rw-r--r-- | gdb/p-lang.h | 2 | ||||
-rw-r--r-- | gdb/scm-lang.c | 1 | ||||
-rw-r--r-- | gdb/stabsread.c | 34 | ||||
-rw-r--r-- | gdb/symfile.c | 1 |
20 files changed, 146 insertions, 1401 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d3256ec..1709fcb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,67 @@ +2007-12-04 Ulrich Weigand <uweigand@de.ibm.com> + + * coffread.c (decode_type): Use builtin_type_int32 instead + of FT_INTEGER fundamental type for array range index type. + (decode_base_type): Use builtin types of current_gdbarch + instead of fundamental types. + + * dwarf2read.c (struct dwarf2_cu): Remove ftypes member. + (read_file_scope): Do not initialize ftypes member. + (dwarf_base_type, dwarf2_fundamental_types): Remove functions. + (read_array_type): Use builtin_type_int32 instead of FT_INTEGER + fundamental type for array range index type. + (read_tag_string_type): Likewise for string range index type. + Also, do not overwrite FT_CHAR type with new string type. + (read_base_type): If DW_AT_name is missing, create unnamed type + with given properties instead of looking for a fundamental type. + Create new types as TYPE_TARGET_TYPE for DW_ATE_address and + DW_ATE_complex_float types. + (read_subrange_type): Create new type to represent missing + DW_AT_type instead of looking for a fundamental type. + (die_type): Use builtin type to represent "void" instead of + looking for a fundamental type. + + * stabsread.c (define_symbol): Use builtin types to represent + 'r' and 'i' floating-point and integer constants. + + * gdbtypes.c (lookup_fundamental_type): Remove. + * gdbtypes.h (lookup_fundamental_type): Remove prototype. + (FT_VOID, FT_BOOLEAN, FT_CHAR, FT_SIGNED_CHAR, FT_UNSIGNED_CHAR, + FT_SHORT, FT_SIGNED_SHORT, FT_UNSIGNED_SHORT, FT_INTEGER, + FT_SIGNED_INTEGER, FT_UNSIGNED_INTEGER, FT_LONG, FT_SIGNED_LONG, + FT_UNSIGNED_LONG, FT_LONG_LONG, FT_SIGNED_LONG_LONG, + FT_UNSIGNED_LONG_LONG, FT_FLOAT, FT_DBL_PREC_FLOAT, FT_EXT_PREC_FLOAT, + FT_COMPLEX, FT_DBL_PREC_COMPLEX, FT_EXT_PREC_COMPLEX, FT_STRING, + FT_FIXED_DECIMAL, FT_FLOAT_DECIMAL, FT_BYTE, FT_UNSIGNED_BYTE, + FT_TEMPLATE_ARG, FT_DECFLOAT, FT_DBL_PREC_DECFLOAT, + FT_EXT_PREC_DECFLOAT, FT_NUM_MEMBERS): Remove macros. + * objfiles.c (struct objfile): Remove fundamental_types member. + * symfile.c (reread_symbols): Do not clear fundamental_types. + + * language.h (struct language_defn): Remove la_fund_type member. + (create_fundamental_type): Remove. + * language.c (unk_lang_create_fundamental_type): Remove. + (unknown_language_defn, auto_language_defn, + local_language_defn): Adapt initializer. + * ada-lang.c (ada_create_fundamental_type): Remove. + (ada_language_defn): Adapt initializer. + * c-lang.h (c_create_fundamental_type): Remove prototype. + * c-lang.c (c_create_fundamental_type): Remove. + (c_language_defn, cplus_language_defn, asm_language_defn, + minimal_language_defn): Adapt initializer. + * f-lang.c (f_create_fundamental_type): Remove. + (f_language_defn): Adapt initializer. + * jv-lang.c (java_create_fundamental_type): Remove. + (java_language_defn): Adapt initializer. + * m2-lang.c (m2_create_fundamental_type): Remove. + (m2_language_defn): Adapt initializer. + * objc-lang.c (objc_create_fundamental_type): Remove. + (objc_language_defn): Adapt initializer. + * p-lang.h (pascal_create_fundamental_type): Remove prototype. + * p-lang.c (pascal_create_fundamental_type): Remove. + (pascal_language_defn): Adapt initializer. + * scm-lang.c (scm_language_defn): Adapt initializer. + 2007-12-04 Maciej W. Rozycki <macro@mips.com> * features/mips-cpu.xml: Specify "regnum" for "r0" explicitly. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index e7852c5..fa1068f 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -71,8 +71,6 @@ static void extract_string (CORE_ADDR addr, char *buf); -static struct type *ada_create_fundamental_type (struct objfile *, int); - static void modify_general_field (char *, LONGEST, int, int); static struct type *desc_base_type (struct type *); @@ -10165,151 +10163,6 @@ static const struct op_print ada_op_print_tab[] = { {NULL, 0, 0, 0} }; - /* Fundamental Ada Types */ - -/* Create a fundamental Ada type using default reasonable for the current - target machine. - - Some object/debugging file formats (DWARF version 1, COFF, etc) do not - define fundamental types such as "int" or "double". Others (stabs or - DWARF version 2, etc) do define fundamental types. For the formats which - don't provide fundamental types, gdb can create such types using this - function. - - FIXME: Some compilers distinguish explicitly signed integral types - (signed short, signed int, signed long) from "regular" integral types - (short, int, long) in the debugging information. There is some dis- - agreement as to how useful this feature is. In particular, gcc does - not support this. Also, only some debugging formats allow the - distinction to be passed on to a debugger. For now, we always just - use "short", "int", or "long" as the type name, for both the implicit - and explicitly signed types. This also makes life easier for the - gdb test suite since we don't have to account for the differences - in output depending upon what the compiler and debugging format - support. We will probably have to re-examine the issue when gdb - starts taking it's fundamental type information directly from the - debugging information supplied by the compiler. fnf@cygnus.com */ - -static struct type * -ada_create_fundamental_type (struct objfile *objfile, int typeid) -{ - struct type *type = NULL; - - switch (typeid) - { - default: - /* FIXME: For now, if we are asked to produce a type not in this - language, create the equivalent of a C integer type with the - name "<?type?>". When all the dust settles from the type - reconstruction work, this should probably become an error. */ - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "<?type?>", objfile); - warning (_("internal error: no Ada fundamental type %d"), typeid); - break; - case FT_VOID: - type = init_type (TYPE_CODE_VOID, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "void", objfile); - break; - case FT_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "character", objfile); - break; - case FT_SIGNED_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "signed char", objfile); - break; - case FT_UNSIGNED_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned char", objfile); - break; - case FT_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "short_integer", objfile); - break; - case FT_SIGNED_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "short_integer", objfile); - break; - case FT_UNSIGNED_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned short", objfile); - break; - case FT_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "integer", objfile); - break; - case FT_SIGNED_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "integer", objfile); /* FIXME -fnf */ - break; - case FT_UNSIGNED_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned int", objfile); - break; - case FT_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "long_integer", objfile); - break; - case FT_SIGNED_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "long_integer", objfile); - break; - case FT_UNSIGNED_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned long", objfile); - break; - case FT_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "long_long_integer", objfile); - break; - case FT_SIGNED_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "long_long_integer", objfile); - break; - case FT_UNSIGNED_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit (current_gdbarch) - / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned long long", objfile); - break; - case FT_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "float", objfile); - break; - case FT_DBL_PREC_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "long_float", objfile); - break; - case FT_EXT_PREC_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_long_double_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "long_long_float", objfile); - break; - } - return (type); -} - enum ada_primitive_types { ada_primitive_type_int, ada_primitive_type_long, @@ -10423,7 +10276,6 @@ const struct language_defn ada_language_defn = { ada_printchar, /* Print a character constant */ ada_printstr, /* Function to print string constant */ emit_char, /* Function to print single char (not used) */ - ada_create_fundamental_type, /* Create fundamental type in this language */ ada_print_type, /* Print a type using appropriate syntax */ ada_val_print, /* Print a value using appropriate syntax */ ada_value_print, /* Print a top-level value */ diff --git a/gdb/c-lang.c b/gdb/c-lang.c index cc952a8..e3151b9 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -180,205 +180,6 @@ c_printstr (struct ui_file *stream, const gdb_byte *string, if (force_ellipses || i < length) fputs_filtered ("...", stream); } - -/* Create a fundamental C type using default reasonable for the current - target machine. - - Some object/debugging file formats (DWARF version 1, COFF, etc) do not - define fundamental types such as "int" or "double". Others (stabs or - DWARF version 2, etc) do define fundamental types. For the formats which - don't provide fundamental types, gdb can create such types using this - function. - - FIXME: Some compilers distinguish explicitly signed integral types - (signed short, signed int, signed long) from "regular" integral types - (short, int, long) in the debugging information. There is some dis- - agreement as to how useful this feature is. In particular, gcc does - not support this. Also, only some debugging formats allow the - distinction to be passed on to a debugger. For now, we always just - use "short", "int", or "long" as the type name, for both the implicit - and explicitly signed types. This also makes life easier for the - gdb test suite since we don't have to account for the differences - in output depending upon what the compiler and debugging format - support. We will probably have to re-examine the issue when gdb - starts taking its fundamental type information directly from the - debugging information supplied by the compiler. fnf@cygnus.com */ - -struct type * -c_create_fundamental_type (struct objfile *objfile, int typeid) -{ - struct type *type = NULL; - - switch (typeid) - { - default: - /* FIXME: For now, if we are asked to produce a type not in this - language, create the equivalent of a C integer type with the - name "<?type?>". When all the dust settles from the type - reconstruction work, this should probably become an error. */ - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "<?type?>", objfile); - warning (_("internal error: no C/C++ fundamental type %d"), typeid); - break; - case FT_VOID: - type = init_type (TYPE_CODE_VOID, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "void", objfile); - break; - case FT_BOOLEAN: - type = init_type (TYPE_CODE_BOOL, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "bool", objfile); - break; - case FT_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_NOSIGN, "char", objfile); - break; - case FT_SIGNED_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "signed char", objfile); - break; - case FT_UNSIGNED_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned char", objfile); - break; - case FT_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "short", objfile); - break; - case FT_SIGNED_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "short", objfile); /* FIXME-fnf */ - break; - case FT_UNSIGNED_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned short", objfile); - break; - case FT_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "int", objfile); - break; - case FT_SIGNED_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "int", objfile); /* FIXME -fnf */ - break; - case FT_UNSIGNED_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned int", objfile); - break; - case FT_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "long", objfile); - break; - case FT_SIGNED_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "long", objfile); /* FIXME -fnf */ - break; - case FT_UNSIGNED_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned long", objfile); - break; - case FT_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "long long", objfile); - break; - case FT_SIGNED_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "signed long long", objfile); - break; - case FT_UNSIGNED_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit (current_gdbarch) - / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned long long", objfile); - break; - case FT_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "float", objfile); - break; - case FT_DBL_PREC_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "double", objfile); - break; - case FT_EXT_PREC_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_long_double_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "long double", objfile); - break; - case FT_DECFLOAT: - type = init_type (TYPE_CODE_DECFLOAT, - 32 / 8, - 0, "decimal float", objfile); - break; - case FT_DBL_PREC_DECFLOAT: - type = init_type (TYPE_CODE_DECFLOAT, - 64 / 8, - 0, "decimal double", objfile); - break; - case FT_EXT_PREC_DECFLOAT: - type = init_type (TYPE_CODE_DECFLOAT, - 128 / 8, - 0, "decimal long double", objfile); - break; - case FT_COMPLEX: - type = init_type (TYPE_CODE_FLT, - 2 * gdbarch_float_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "complex float", objfile); - TYPE_TARGET_TYPE (type) - = init_type (TYPE_CODE_FLT, - gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "float", objfile); - break; - case FT_DBL_PREC_COMPLEX: - type = init_type (TYPE_CODE_FLT, - 2 * gdbarch_double_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "complex double", objfile); - TYPE_TARGET_TYPE (type) - = init_type (TYPE_CODE_FLT, - gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "double", objfile); - break; - case FT_EXT_PREC_COMPLEX: - type = init_type (TYPE_CODE_FLT, - 2 * gdbarch_long_double_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "complex long double", objfile); - TYPE_TARGET_TYPE (type) - = init_type (TYPE_CODE_FLT, - gdbarch_long_double_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "long double", objfile); - break; - case FT_TEMPLATE_ARG: - type = init_type (TYPE_CODE_TEMPLATE_ARG, - 0, - 0, "<template arg>", objfile); - break; - } - return (type); -} /* Preprocessing and parsing C and C++ expressions. */ @@ -603,7 +404,6 @@ const struct language_defn c_language_defn = c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ c_emit_char, /* Print a single char */ - c_create_fundamental_type, /* Create fundamental type in this language */ c_print_type, /* Print a type using appropriate syntax */ c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ @@ -707,7 +507,6 @@ const struct language_defn cplus_language_defn = c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ c_emit_char, /* Print a single char */ - c_create_fundamental_type, /* Create fundamental type in this language */ c_print_type, /* Print a type using appropriate syntax */ c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ @@ -742,7 +541,6 @@ const struct language_defn asm_language_defn = c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ c_emit_char, /* Print a single char */ - c_create_fundamental_type, /* Create fundamental type in this language */ c_print_type, /* Print a type using appropriate syntax */ c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ @@ -782,7 +580,6 @@ const struct language_defn minimal_language_defn = c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ c_emit_char, /* Print a single char */ - c_create_fundamental_type, /* Create fundamental type in this language */ c_print_type, /* Print a type using appropriate syntax */ c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ diff --git a/gdb/c-lang.h b/gdb/c-lang.h index cc49b9f..070ed75 100644 --- a/gdb/c-lang.h +++ b/gdb/c-lang.h @@ -59,8 +59,6 @@ extern void finished_macro_expansion (void); extern macro_lookup_ftype *expression_macro_lookup_func; extern void *expression_macro_lookup_baton; -extern struct type *c_create_fundamental_type (struct objfile *, int); - extern void c_language_arch_info (struct gdbarch *gdbarch, struct language_arch_info *lai); diff --git a/gdb/coffread.c b/gdb/coffread.c index d1a4246..4598e24 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1700,7 +1700,7 @@ decode_type (struct coff_symbol *cs, unsigned int c_type, *dim = 0; base_type = decode_type (cs, new_c_type, aux); - index_type = lookup_fundamental_type (current_objfile, FT_INTEGER); + index_type = builtin_type_int32; range_type = create_range_type ((struct type *) NULL, index_type, 0, n - 1); type = @@ -1763,39 +1763,39 @@ decode_base_type (struct coff_symbol *cs, unsigned int c_type, { case T_NULL: /* shows up with "void (*foo)();" structure members */ - return lookup_fundamental_type (current_objfile, FT_VOID); + return builtin_type (current_gdbarch)->builtin_void; #ifdef T_VOID case T_VOID: /* Intel 960 COFF has this symbol and meaning. */ - return lookup_fundamental_type (current_objfile, FT_VOID); + return builtin_type (current_gdbarch)->builtin_void; #endif case T_CHAR: - return lookup_fundamental_type (current_objfile, FT_CHAR); + return builtin_type (current_gdbarch)->builtin_char; case T_SHORT: - return lookup_fundamental_type (current_objfile, FT_SHORT); + return builtin_type (current_gdbarch)->builtin_short; case T_INT: - return lookup_fundamental_type (current_objfile, FT_INTEGER); + return builtin_type (current_gdbarch)->builtin_int; case T_LONG: if (cs->c_sclass == C_FIELD && aux->x_sym.x_misc.x_lnsz.x_size > gdbarch_long_bit (current_gdbarch)) - return lookup_fundamental_type (current_objfile, FT_LONG_LONG); + return builtin_type (current_gdbarch)->builtin_long_long; else - return lookup_fundamental_type (current_objfile, FT_LONG); + return builtin_type (current_gdbarch)->builtin_long; case T_FLOAT: - return lookup_fundamental_type (current_objfile, FT_FLOAT); + return builtin_type (current_gdbarch)->builtin_float; case T_DOUBLE: - return lookup_fundamental_type (current_objfile, FT_DBL_PREC_FLOAT); + return builtin_type (current_gdbarch)->builtin_double; case T_LNGDBL: - return lookup_fundamental_type (current_objfile, FT_EXT_PREC_FLOAT); + return builtin_type (current_gdbarch)->builtin_long_double; case T_STRUCT: if (cs->c_naux != 1) @@ -1873,24 +1873,24 @@ decode_base_type (struct coff_symbol *cs, unsigned int c_type, break; case T_UCHAR: - return lookup_fundamental_type (current_objfile, FT_UNSIGNED_CHAR); + return builtin_type (current_gdbarch)->builtin_unsigned_char; case T_USHORT: - return lookup_fundamental_type (current_objfile, FT_UNSIGNED_SHORT); + return builtin_type (current_gdbarch)->builtin_unsigned_short; case T_UINT: - return lookup_fundamental_type (current_objfile, FT_UNSIGNED_INTEGER); + return builtin_type (current_gdbarch)->builtin_unsigned_int; case T_ULONG: if (cs->c_sclass == C_FIELD && aux->x_sym.x_misc.x_lnsz.x_size > gdbarch_long_bit (current_gdbarch)) - return lookup_fundamental_type (current_objfile, FT_UNSIGNED_LONG_LONG); + return builtin_type (current_gdbarch)->builtin_unsigned_long_long; else - return lookup_fundamental_type (current_objfile, FT_UNSIGNED_LONG); + return builtin_type (current_gdbarch)->builtin_unsigned_long; } complaint (&symfile_complaints, _("Unexpected type for symbol %s"), cs->c_name); - return lookup_fundamental_type (current_objfile, FT_VOID); + return builtin_type (current_gdbarch)->builtin_void; } /* This page contains subroutines of read_type. */ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index d6178a7..fa5d3c8 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -288,17 +288,6 @@ struct dwarf2_cu distinguish these in buildsym.c. */ struct pending **list_in_scope; - /* Maintain an array of referenced fundamental types for the current - compilation unit being read. For DWARF version 1, we have to construct - the fundamental types on the fly, since no information about the - fundamental types is supplied. Each such fundamental type is created by - calling a language dependent routine to create the type, and then a - pointer to that type is then placed in the array at the index specified - by it's FT_<TYPENAME> value. The array has a fixed size set by the - FT_NUM_MEMBERS compile time constant, which is the number of predefined - fundamental types gdb knows how to construct. */ - struct type *ftypes[FT_NUM_MEMBERS]; /* Fundamental types */ - /* DWARF abbreviation table associated with this compilation unit. */ struct abbrev_info **dwarf2_abbrevs; @@ -936,8 +925,6 @@ static void read_enumeration_type (struct die_info *, struct dwarf2_cu *); static void process_enumeration_scope (struct die_info *, struct dwarf2_cu *); -static struct type *dwarf_base_type (int, int, struct dwarf2_cu *); - static CORE_ADDR decode_locdesc (struct dwarf_block *, struct dwarf2_cu *); static void read_array_type (struct die_info *, struct dwarf2_cu *); @@ -1019,9 +1006,6 @@ static struct die_info *follow_die_ref (struct die_info *, struct attribute *, struct dwarf2_cu *); -static struct type *dwarf2_fundamental_type (struct objfile *, int, - struct dwarf2_cu *); - /* memory allocation interface */ static struct dwarf_block *dwarf_alloc_block (struct dwarf2_cu *); @@ -2844,10 +2828,6 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) /* We assume that we're processing GCC output. */ processing_gcc_compilation = 2; - /* The compilation unit may be in a different language or objfile, - zero out all remembered fundamental types. */ - memset (cu->ftypes, 0, FT_NUM_MEMBERS * sizeof (struct type *)); - start_symtab (name, comp_dir, lowpc); record_debugformat ("DWARF 2"); record_producer (cu->producer); @@ -4284,7 +4264,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) arrays with unspecified length. */ if (die->child == NULL) { - index_type = dwarf2_fundamental_type (objfile, FT_INTEGER, cu); + index_type = builtin_type_int32; range_type = create_range_type (NULL, index_type, 0, -1); set_die_type (die, create_array_type (NULL, element_type, range_type), cu); @@ -4719,19 +4699,11 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) length = 1; } } - index_type = dwarf2_fundamental_type (objfile, FT_INTEGER, cu); + + index_type = builtin_type_int32; range_type = create_range_type (NULL, index_type, 1, length); - if (cu->language == language_fortran) - { - /* Need to create a unique string type for bounds - information */ - type = create_string_type (0, range_type); - } - else - { - char_type = dwarf2_fundamental_type (objfile, FT_CHAR, cu); - type = create_string_type (char_type, range_type); - } + type = create_string_type (NULL, range_type); + set_die_type (die, type, cu); } @@ -4846,6 +4818,9 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) struct attribute *attr; int encoding = 0, size = 0; char *name; + enum type_code code = TYPE_CODE_INT; + int type_flags = 0; + struct type *target_type = NULL; /* If we've already decoded this die, this is a no-op. */ if (die->type) @@ -4864,71 +4839,57 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) size = DW_UNSND (attr); } name = dwarf2_name (die, cu); - if (name) + if (!name) { - enum type_code code = TYPE_CODE_INT; - int type_flags = 0; - - switch (encoding) - { - case DW_ATE_address: - /* Turn DW_ATE_address into a void * pointer. */ - code = TYPE_CODE_PTR; - type_flags |= TYPE_FLAG_UNSIGNED; - break; - case DW_ATE_boolean: - code = TYPE_CODE_BOOL; - type_flags |= TYPE_FLAG_UNSIGNED; - break; - case DW_ATE_complex_float: - code = TYPE_CODE_COMPLEX; - break; - case DW_ATE_decimal_float: - code = TYPE_CODE_DECFLOAT; - break; - case DW_ATE_float: - code = TYPE_CODE_FLT; - break; - case DW_ATE_signed: - break; - case DW_ATE_unsigned: - type_flags |= TYPE_FLAG_UNSIGNED; - break; - case DW_ATE_signed_char: - if (cu->language == language_m2) - code = TYPE_CODE_CHAR; - break; - case DW_ATE_unsigned_char: - if (cu->language == language_m2) - code = TYPE_CODE_CHAR; - type_flags |= TYPE_FLAG_UNSIGNED; - break; - default: - complaint (&symfile_complaints, _("unsupported DW_AT_encoding: '%s'"), - dwarf_type_encoding_name (encoding)); - break; - } - type = init_type (code, size, type_flags, name, objfile); - if (encoding == DW_ATE_address) - TYPE_TARGET_TYPE (type) = dwarf2_fundamental_type (objfile, FT_VOID, - cu); - else if (encoding == DW_ATE_complex_float) - { - if (size == 32) - TYPE_TARGET_TYPE (type) - = dwarf2_fundamental_type (objfile, FT_EXT_PREC_FLOAT, cu); - else if (size == 16) - TYPE_TARGET_TYPE (type) - = dwarf2_fundamental_type (objfile, FT_DBL_PREC_FLOAT, cu); - else if (size == 8) - TYPE_TARGET_TYPE (type) - = dwarf2_fundamental_type (objfile, FT_FLOAT, cu); - } + complaint (&symfile_complaints, + _("DW_AT_name missing from DW_TAG_base_type")); } - else + + switch (encoding) { - type = dwarf_base_type (encoding, size, cu); + case DW_ATE_address: + /* Turn DW_ATE_address into a void * pointer. */ + code = TYPE_CODE_PTR; + type_flags |= TYPE_FLAG_UNSIGNED; + target_type = init_type (TYPE_CODE_VOID, 1, 0, NULL, objfile); + break; + case DW_ATE_boolean: + code = TYPE_CODE_BOOL; + type_flags |= TYPE_FLAG_UNSIGNED; + break; + case DW_ATE_complex_float: + code = TYPE_CODE_COMPLEX; + target_type = init_type (TYPE_CODE_FLT, size / 2, 0, NULL, objfile); + break; + case DW_ATE_decimal_float: + code = TYPE_CODE_DECFLOAT; + break; + case DW_ATE_float: + code = TYPE_CODE_FLT; + break; + case DW_ATE_signed: + break; + case DW_ATE_unsigned: + type_flags |= TYPE_FLAG_UNSIGNED; + break; + case DW_ATE_signed_char: + if (cu->language == language_m2) + code = TYPE_CODE_CHAR; + break; + case DW_ATE_unsigned_char: + if (cu->language == language_m2) + code = TYPE_CODE_CHAR; + type_flags |= TYPE_FLAG_UNSIGNED; + break; + default: + complaint (&symfile_complaints, _("unsupported DW_AT_encoding: '%s'"), + dwarf_type_encoding_name (encoding)); + break; } + + type = init_type (code, size, type_flags, name, objfile); + TYPE_TARGET_TYPE (type) = target_type; + set_die_type (die, type, cu); } @@ -4954,8 +4915,8 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("DW_AT_type missing from DW_TAG_subrange_type")); base_type - = dwarf_base_type (DW_ATE_signed, - gdbarch_addr_bit (current_gdbarch) / 8, cu); + = init_type (TYPE_CODE_INT, gdbarch_addr_bit (current_gdbarch) / 8, + 0, NULL, cu->objfile); } if (cu->language == language_fortran) @@ -7515,7 +7476,7 @@ die_type (struct die_info *die, struct dwarf2_cu *cu) if (!type_attr) { /* A missing DW_AT_type represents a void type. */ - return dwarf2_fundamental_type (cu->objfile, FT_VOID, cu); + return builtin_type (current_gdbarch)->builtin_void; } else type_die = follow_die_ref (die, type_attr, cu); @@ -7760,92 +7721,6 @@ typename_concat (struct obstack *obs, const char *prefix, const char *suffix, } } -static struct type * -dwarf_base_type (int encoding, int size, struct dwarf2_cu *cu) -{ - struct objfile *objfile = cu->objfile; - - /* FIXME - this should not produce a new (struct type *) - every time. It should cache base types. */ - struct type *type; - switch (encoding) - { - case DW_ATE_address: - type = dwarf2_fundamental_type (objfile, FT_VOID, cu); - return type; - case DW_ATE_boolean: - type = dwarf2_fundamental_type (objfile, FT_BOOLEAN, cu); - return type; - case DW_ATE_complex_float: - if (size == 16) - { - type = dwarf2_fundamental_type (objfile, FT_DBL_PREC_COMPLEX, cu); - } - else - { - type = dwarf2_fundamental_type (objfile, FT_COMPLEX, cu); - } - return type; - case DW_ATE_float: - if (size == 8) - { - type = dwarf2_fundamental_type (objfile, FT_DBL_PREC_FLOAT, cu); - } - else - { - type = dwarf2_fundamental_type (objfile, FT_FLOAT, cu); - } - return type; - case DW_ATE_decimal_float: - if (size == 16) - type = dwarf2_fundamental_type (objfile, FT_DBL_PREC_DECFLOAT, cu); - else if (size == 8) - type = dwarf2_fundamental_type (objfile, FT_EXT_PREC_DECFLOAT, cu); - else - type = dwarf2_fundamental_type (objfile, FT_DECFLOAT, cu); - return type; - case DW_ATE_signed: - switch (size) - { - case 1: - type = dwarf2_fundamental_type (objfile, FT_SIGNED_CHAR, cu); - break; - case 2: - type = dwarf2_fundamental_type (objfile, FT_SIGNED_SHORT, cu); - break; - default: - case 4: - type = dwarf2_fundamental_type (objfile, FT_SIGNED_INTEGER, cu); - break; - } - return type; - case DW_ATE_signed_char: - type = dwarf2_fundamental_type (objfile, FT_SIGNED_CHAR, cu); - return type; - case DW_ATE_unsigned: - switch (size) - { - case 1: - type = dwarf2_fundamental_type (objfile, FT_UNSIGNED_CHAR, cu); - break; - case 2: - type = dwarf2_fundamental_type (objfile, FT_UNSIGNED_SHORT, cu); - break; - default: - case 4: - type = dwarf2_fundamental_type (objfile, FT_UNSIGNED_INTEGER, cu); - break; - } - return type; - case DW_ATE_unsigned_char: - type = dwarf2_fundamental_type (objfile, FT_UNSIGNED_CHAR, cu); - return type; - default: - type = dwarf2_fundamental_type (objfile, FT_SIGNED_INTEGER, cu); - return type; - } -} - #if 0 struct die_info * copy_die (struct die_info *old_die) @@ -9069,28 +8944,6 @@ follow_die_ref (struct die_info *src_die, struct attribute *attr, return NULL; } -static struct type * -dwarf2_fundamental_type (struct objfile *objfile, int typeid, - struct dwarf2_cu *cu) -{ - if (typeid < 0 || typeid >= FT_NUM_MEMBERS) - { - error (_("Dwarf Error: internal error - invalid fundamental type id %d [in module %s]"), - typeid, objfile->name); - } - - /* Look for this particular type in the fundamental type vector. If - one is not found, create and install one appropriate for the - current language and the current target machine. */ - - if (cu->ftypes[typeid] == NULL) - { - cu->ftypes[typeid] = cu->language_defn->la_fund_type (objfile, typeid); - } - - return (cu->ftypes[typeid]); -} - /* Decode simple location descriptions. Given a pointer to a dwarf block that defines a location, compute the location and return the value. diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 25fde40..6b49beb 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -70,7 +70,6 @@ static SAVED_F77_COMMON_PTR allocate_saved_f77_common_node (void); static void patch_common_entries (SAVED_F77_COMMON_PTR, CORE_ADDR, int); #endif -static struct type *f_create_fundamental_type (struct objfile *, int); static void f_printchar (int c, struct ui_file * stream); static void f_emit_char (int c, struct ui_file * stream, int quoter); @@ -223,170 +222,6 @@ f_printstr (struct ui_file *stream, const gdb_byte *string, if (force_ellipses || i < length) fputs_filtered ("...", stream); } - -/* FIXME: This is a copy of c_create_fundamental_type(), before - all the non-C types were stripped from it. Needs to be fixed - by an experienced F77 programmer. */ - -static struct type * -f_create_fundamental_type (struct objfile *objfile, int typeid) -{ - struct type *type = NULL; - - switch (typeid) - { - case FT_VOID: - type = init_type (TYPE_CODE_VOID, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "VOID", objfile); - break; - case FT_BOOLEAN: - type = init_type (TYPE_CODE_BOOL, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "boolean", objfile); - break; - case FT_STRING: - type = init_type (TYPE_CODE_STRING, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "string", objfile); - break; - case FT_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "character", objfile); - break; - case FT_SIGNED_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "integer*1", objfile); - break; - case FT_UNSIGNED_CHAR: - type = init_type (TYPE_CODE_BOOL, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "logical*1", objfile); - break; - case FT_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "integer*2", objfile); - break; - case FT_SIGNED_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "short", objfile); /* FIXME-fnf */ - break; - case FT_UNSIGNED_SHORT: - type = init_type (TYPE_CODE_BOOL, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "logical*2", objfile); - break; - case FT_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "integer*4", objfile); - break; - case FT_SIGNED_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "integer", objfile); /* FIXME -fnf */ - break; - case FT_UNSIGNED_INTEGER: - type = init_type (TYPE_CODE_BOOL, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "logical*4", objfile); - break; - case FT_FIXED_DECIMAL: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "fixed decimal", objfile); - break; - case FT_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "long", objfile); - break; - case FT_SIGNED_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "long", objfile); /* FIXME -fnf */ - break; - case FT_UNSIGNED_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned long", objfile); - break; - case FT_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "long long", objfile); - break; - case FT_SIGNED_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "signed long long", objfile); - break; - case FT_UNSIGNED_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit (current_gdbarch) - / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned long long", objfile); - break; - case FT_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "real", objfile); - break; - case FT_DBL_PREC_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "real*8", objfile); - break; - case FT_FLOAT_DECIMAL: - type = init_type (TYPE_CODE_FLT, - gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "floating decimal", objfile); - break; - case FT_EXT_PREC_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_long_double_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "real*16", objfile); - break; - case FT_COMPLEX: - type = init_type (TYPE_CODE_COMPLEX, - 2 * gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "complex*8", objfile); - TYPE_TARGET_TYPE (type) = builtin_type_f_real; - break; - case FT_DBL_PREC_COMPLEX: - type = init_type (TYPE_CODE_COMPLEX, - 2 * gdbarch_double_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "complex*16", objfile); - TYPE_TARGET_TYPE (type) = builtin_type_f_real_s8; - break; - case FT_EXT_PREC_COMPLEX: - type = init_type (TYPE_CODE_COMPLEX, - 2 * gdbarch_long_double_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "complex*32", objfile); - TYPE_TARGET_TYPE (type) = builtin_type_f_real_s16; - break; - default: - /* FIXME: For now, if we are asked to produce a type not in this - language, create the equivalent of a C integer type with the - name "<?type?>". When all the dust settles from the type - reconstruction work, this should probably become an error. */ - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "<?type?>", objfile); - warning (_("internal error: no F77 fundamental type %d"), typeid); - break; - } - return (type); -} /* Table of operators and their precedences for printing expressions. */ @@ -485,7 +320,6 @@ const struct language_defn f_language_defn = f_printchar, /* Print character constant */ f_printstr, /* function to print string constant */ f_emit_char, /* Function to print a single character */ - f_create_fundamental_type, /* Create fundamental type in this language */ f_print_type, /* Print a type using appropriate syntax */ f_val_print, /* Print a value using appropriate syntax */ c_value_print, /* FIXME */ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 8d81097..1026305 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1798,65 +1798,6 @@ append_composite_type_field (struct type *t, char *name, } } -/* Look up a fundamental type for the specified objfile. - May need to construct such a type if this is the first use. - - Some object file formats (ELF, COFF, etc) do not define fundamental - types such as "int" or "double". Others (stabs for example), do - define fundamental types. - - For the formats which don't provide fundamental types, gdb can - create such types, using defaults reasonable for the current - language and the current target machine. - - NOTE: This routine is obsolescent. Each debugging format reader - should manage it's own fundamental types, either creating them from - suitable defaults or reading them from the debugging information, - whichever is appropriate. The DWARF reader has already been fixed - to do this. Once the other readers are fixed, this routine will go - away. Also note that fundamental types should be managed on a - compilation unit basis in a multi-language environment, not on a - linkage unit basis as is done here. */ - - -struct type * -lookup_fundamental_type (struct objfile *objfile, int typeid) -{ - struct type **typep; - int nbytes; - - if (typeid < 0 || typeid >= FT_NUM_MEMBERS) - { - error (_("internal error - invalid fundamental type id %d"), - typeid); - } - - /* If this is the first time we need a fundamental type for this - objfile then we need to initialize the vector of type - pointers. */ - - if (objfile->fundamental_types == NULL) - { - nbytes = FT_NUM_MEMBERS * sizeof (struct type *); - objfile->fundamental_types = (struct type **) - obstack_alloc (&objfile->objfile_obstack, nbytes); - memset ((char *) objfile->fundamental_types, 0, nbytes); - OBJSTAT (objfile, n_types += FT_NUM_MEMBERS); - } - - /* Look for this particular type in the fundamental type vector. If - one is not found, create and install one appropriate for the - current language. */ - - typep = objfile->fundamental_types + typeid; - if (*typep == NULL) - { - *typep = create_fundamental_type (objfile, typeid); - } - - return (*typep); -} - int can_dereference (struct type *t) { diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 10a354b..a0d7dd2 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -29,49 +29,6 @@ struct field; struct block; -/* Codes for `fundamental types'. This is a monstrosity based on the - bogus notion that there are certain compiler-independent - `fundamental types'. None of these is well-defined (how big is - FT_SHORT? Does it depend on the language? How does the - language-specific code know which type to correlate to FT_SHORT?) */ - -#define FT_VOID 0 -#define FT_BOOLEAN 1 -#define FT_CHAR 2 /* we use this for not-unsigned C/C++ chars */ -#define FT_SIGNED_CHAR 3 /* we use this for C++ signed chars */ -#define FT_UNSIGNED_CHAR 4 /* we use this for C/C++ unsigned chars */ -#define FT_SHORT 5 -#define FT_SIGNED_SHORT 6 -#define FT_UNSIGNED_SHORT 7 -#define FT_INTEGER 8 -#define FT_SIGNED_INTEGER 9 -#define FT_UNSIGNED_INTEGER 10 -#define FT_LONG 11 -#define FT_SIGNED_LONG 12 -#define FT_UNSIGNED_LONG 13 -#define FT_LONG_LONG 14 -#define FT_SIGNED_LONG_LONG 15 -#define FT_UNSIGNED_LONG_LONG 16 -#define FT_FLOAT 17 -#define FT_DBL_PREC_FLOAT 18 -#define FT_EXT_PREC_FLOAT 19 -#define FT_COMPLEX 20 -#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_BYTE 26 -#define FT_UNSIGNED_BYTE 27 -#define FT_TEMPLATE_ARG 28 - -/* The following three fundamental types are for decimal floating point. */ -#define FT_DECFLOAT 29 -#define FT_DBL_PREC_DECFLOAT 30 -#define FT_EXT_PREC_DECFLOAT 31 - -#define FT_NUM_MEMBERS 32 /* Highest FT_* above, plus one. */ - /* Some macros for char-based bitfields. */ #define B_SET(a,x) ((a)[(x)>>3] |= (1 << ((x)&7))) @@ -1317,8 +1274,6 @@ extern struct type *lookup_typename (char *, struct block *, int); extern struct type *lookup_template_type (char *, struct type *, struct block *); -extern struct type *lookup_fundamental_type (struct objfile *, int); - extern void fill_in_vptr_fieldno (struct type *); extern int get_destructor_fn_field (struct type *, int *, int *); diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index e3c6299..1ab6b94 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -943,37 +943,6 @@ nosideret: return value_from_longest (builtin_type_long, (LONGEST) 1); } -static struct type * -java_create_fundamental_type (struct objfile *objfile, int typeid) -{ - switch (typeid) - { - case FT_VOID: - return java_void_type; - case FT_BOOLEAN: - return java_boolean_type; - case FT_CHAR: - return java_char_type; - case FT_FLOAT: - return java_float_type; - case FT_DBL_PREC_FLOAT: - return java_double_type; - case FT_BYTE: - case FT_SIGNED_CHAR: - return java_byte_type; - case FT_SHORT: - case FT_SIGNED_SHORT: - return java_short_type; - case FT_INTEGER: - case FT_SIGNED_INTEGER: - return java_int_type; - case FT_LONG: - case FT_SIGNED_LONG: - return java_long_type; - } - return c_create_fundamental_type (objfile, typeid); -} - static char *java_demangle (const char *mangled, int options) { return cplus_demangle (mangled, options | DMGL_JAVA); @@ -1097,7 +1066,6 @@ const struct language_defn java_language_defn = c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ java_emit_char, /* Function to print a single character */ - java_create_fundamental_type, /* Create fundamental type in this language */ java_print_type, /* Print a type using appropriate syntax */ java_val_print, /* Print a value using appropriate syntax */ java_value_print, /* Print a top-level value */ diff --git a/gdb/language.c b/gdb/language.c index fe2939e..84a095f 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -68,8 +68,6 @@ static void unk_lang_emit_char (int c, struct ui_file *stream, int quoter); static void unk_lang_printchar (int c, struct ui_file *stream); -static struct type *unk_lang_create_fundamental_type (struct objfile *, int); - static void unk_lang_print_type (struct type *, char *, struct ui_file *, int, int); @@ -1116,12 +1114,6 @@ unk_lang_printstr (struct ui_file *stream, const gdb_byte *string, error (_("internal error - unimplemented function unk_lang_printstr called.")); } -static struct type * -unk_lang_create_fundamental_type (struct objfile *objfile, int typeid) -{ - error (_("internal error - unimplemented function unk_lang_create_fundamental_type called.")); -} - static void unk_lang_print_type (struct type *type, char *varstring, struct ui_file *stream, int show, int level) @@ -1190,7 +1182,6 @@ const struct language_defn unknown_language_defn = unk_lang_printchar, /* Print character constant */ unk_lang_printstr, unk_lang_emit_char, - unk_lang_create_fundamental_type, unk_lang_print_type, /* Print a type using appropriate syntax */ unk_lang_val_print, /* Print a value using appropriate syntax */ unk_lang_value_print, /* Print a top-level value */ @@ -1226,7 +1217,6 @@ const struct language_defn auto_language_defn = unk_lang_printchar, /* Print character constant */ unk_lang_printstr, unk_lang_emit_char, - unk_lang_create_fundamental_type, unk_lang_print_type, /* Print a type using appropriate syntax */ unk_lang_val_print, /* Print a value using appropriate syntax */ unk_lang_value_print, /* Print a top-level value */ @@ -1261,7 +1251,6 @@ const struct language_defn local_language_defn = unk_lang_printchar, /* Print character constant */ unk_lang_printstr, unk_lang_emit_char, - unk_lang_create_fundamental_type, unk_lang_print_type, /* Print a type using appropriate syntax */ unk_lang_val_print, /* Print a value using appropriate syntax */ unk_lang_value_print, /* Print a top-level value */ diff --git a/gdb/language.h b/gdb/language.h index 798c4d0..fc1a99d 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -191,8 +191,6 @@ struct language_defn void (*la_emitchar) (int ch, struct ui_file * stream, int quoter); - struct type *(*la_fund_type) (struct objfile *, int); - /* Print a type using syntax appropriate for this language. */ void (*la_print_type) (struct type *, char *, struct ui_file *, int, @@ -342,9 +340,6 @@ extern enum language set_language (enum language); the current setting of working_lang, which the user sets with the "set language" command. */ -#define create_fundamental_type(objfile,typeid) \ - (current_language->la_fund_type(objfile, typeid)) - #define LA_PRINT_TYPE(type,varstring,stream,show,level) \ (current_language->la_print_type(type,varstring,stream,show,level)) diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 42338af..b102dda 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -29,7 +29,6 @@ #include "valprint.h" extern void _initialize_m2_language (void); -static struct type *m2_create_fundamental_type (struct objfile *, int); static void m2_printchar (int, struct ui_file *); static void m2_emit_char (int, struct ui_file *, int); @@ -276,174 +275,6 @@ evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp, nosideret: return value_from_longest (builtin_type_long, (LONGEST) 1); } - -/* FIXME: This is a copy of c_create_fundamental_type(), before - all the non-C types were stripped from it. Needs to be fixed - by an experienced Modula programmer. */ - -static struct type * -m2_create_fundamental_type (struct objfile *objfile, int typeid) -{ - struct type *type = NULL; - - switch (typeid) - { - default: - /* FIXME: For now, if we are asked to produce a type not in this - language, create the equivalent of a C integer type with the - name "<?type?>". When all the dust settles from the type - reconstruction work, this should probably become an error. */ - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "<?type?>", objfile); - warning (_("internal error: no Modula fundamental type %d"), typeid); - break; - case FT_VOID: - type = init_type (TYPE_CODE_VOID, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "void", objfile); - break; - case FT_BOOLEAN: - type = init_type (TYPE_CODE_BOOL, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "boolean", objfile); - break; - case FT_STRING: - type = init_type (TYPE_CODE_STRING, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "string", objfile); - break; - case FT_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "char", objfile); - break; - case FT_SIGNED_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "signed char", objfile); - break; - case FT_UNSIGNED_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned char", objfile); - break; - case FT_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "short", objfile); - break; - case FT_SIGNED_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "short", objfile); /* FIXME-fnf */ - break; - case FT_UNSIGNED_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned short", objfile); - break; - case FT_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "int", objfile); - break; - case FT_SIGNED_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "int", objfile); /* FIXME -fnf */ - break; - case FT_UNSIGNED_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned int", objfile); - break; - case FT_FIXED_DECIMAL: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "fixed decimal", objfile); - break; - case FT_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "long", objfile); - break; - case FT_SIGNED_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "long", objfile); /* FIXME -fnf */ - break; - case FT_UNSIGNED_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned long", objfile); - break; - case FT_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "long long", objfile); - break; - case FT_SIGNED_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "signed long long", objfile); - break; - case FT_UNSIGNED_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit (current_gdbarch) - / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned long long", objfile); - break; - case FT_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "float", objfile); - break; - case FT_DBL_PREC_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "double", objfile); - break; - case FT_FLOAT_DECIMAL: - type = init_type (TYPE_CODE_FLT, - gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "floating decimal", objfile); - break; - case FT_EXT_PREC_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_long_double_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "long double", objfile); - break; - case FT_COMPLEX: - type = init_type (TYPE_CODE_COMPLEX, - 2 * gdbarch_float_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "complex", objfile); - TYPE_TARGET_TYPE (type) - = m2_create_fundamental_type (objfile, FT_FLOAT); - break; - case FT_DBL_PREC_COMPLEX: - type = init_type (TYPE_CODE_COMPLEX, - 2 * gdbarch_double_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "double complex", objfile); - TYPE_TARGET_TYPE (type) - = m2_create_fundamental_type (objfile, FT_DBL_PREC_FLOAT); - break; - case FT_EXT_PREC_COMPLEX: - type = init_type (TYPE_CODE_COMPLEX, - 2 * gdbarch_long_double_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "long double complex", objfile); - TYPE_TARGET_TYPE (type) - = m2_create_fundamental_type (objfile, FT_EXT_PREC_FLOAT); - break; - } - return (type); -} /* Table of operators and their precedences for printing expressions. */ @@ -540,7 +371,6 @@ const struct language_defn m2_language_defn = m2_printchar, /* Print character constant */ m2_printstr, /* function to print string constant */ m2_emit_char, /* Function to print a single character */ - m2_create_fundamental_type, /* Create fundamental type in this language */ m2_print_type, /* Print a type using appropriate syntax */ m2_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 83bc4ef..698525a 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -421,152 +421,6 @@ objc_printstr (struct ui_file *stream, const gdb_byte *string, fputs_filtered ("...", stream); } -/* Create a fundamental C type using default reasonable for the - current target. - - Some object/debugging file formats (DWARF version 1, COFF, etc) do - not define fundamental types such as "int" or "double". Others - (stabs or DWARF version 2, etc) do define fundamental types. For - the formats which don't provide fundamental types, gdb can create - such types using this function. - - FIXME: Some compilers distinguish explicitly signed integral types - (signed short, signed int, signed long) from "regular" integral - types (short, int, long) in the debugging information. There is - some disagreement as to how useful this feature is. In particular, - gcc does not support this. Also, only some debugging formats allow - the distinction to be passed on to a debugger. For now, we always - just use "short", "int", or "long" as the type name, for both the - implicit and explicitly signed types. This also makes life easier - for the gdb test suite since we don't have to account for the - differences in output depending upon what the compiler and - debugging format support. We will probably have to re-examine the - issue when gdb starts taking it's fundamental type information - directly from the debugging information supplied by the compiler. - fnf@cygnus.com */ - -static struct type * -objc_create_fundamental_type (struct objfile *objfile, int typeid) -{ - struct type *type = NULL; - - switch (typeid) - { - default: - /* FIXME: For now, if we are asked to produce a type not in - this language, create the equivalent of a C integer type - with the name "<?type?>". When all the dust settles from - the type reconstruction work, this should probably become - an error. */ - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "<?type?>", objfile); - warning (_("internal error: no C/C++ fundamental type %d"), typeid); - break; - case FT_VOID: - type = init_type (TYPE_CODE_VOID, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "void", objfile); - break; - case FT_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "char", objfile); - break; - case FT_SIGNED_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "signed char", objfile); - break; - case FT_UNSIGNED_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned char", objfile); - break; - case FT_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "short", objfile); - break; - case FT_SIGNED_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "short", objfile); /* FIXME-fnf */ - break; - case FT_UNSIGNED_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned short", objfile); - break; - case FT_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "int", objfile); - break; - case FT_SIGNED_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "int", objfile); /* FIXME -fnf */ - break; - case FT_UNSIGNED_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned int", objfile); - break; - case FT_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "long", objfile); - break; - case FT_SIGNED_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "long", objfile); /* FIXME -fnf */ - break; - case FT_UNSIGNED_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned long", objfile); - break; - case FT_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "long long", objfile); - break; - case FT_SIGNED_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "signed long long", objfile); - break; - case FT_UNSIGNED_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit (current_gdbarch) - / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned long long", objfile); - break; - case FT_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "float", objfile); - break; - case FT_DBL_PREC_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_double_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "double", objfile); - break; - case FT_EXT_PREC_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_long_double_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "long double", objfile); - break; - } - return (type); -} - /* Determine if we are currently in the Objective-C dispatch function. If so, get the address of the method function that the dispatcher would call and use that as the function to step into instead. Also @@ -650,7 +504,6 @@ const struct language_defn objc_language_defn = { objc_printchar, /* Print a character constant */ objc_printstr, /* Function to print string constant */ objc_emit_char, - objc_create_fundamental_type, /* Create fundamental type in this language */ c_print_type, /* Print a type using appropriate syntax */ c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ diff --git a/gdb/objfiles.h b/gdb/objfiles.h index b9ace4d..1e37e56 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -279,18 +279,6 @@ struct objfile struct minimal_symbol *msymbol_demangled_hash[MINIMAL_SYMBOL_HASH_SIZE]; - /* For object file formats which don't specify fundamental types, gdb - can create such types. For now, it maintains a vector of pointers - to these internally created fundamental types on a per objfile basis, - however it really should ultimately keep them on a per-compilation-unit - basis, to account for linkage-units that consist of a number of - compilation units that may have different fundamental types, such as - linking C modules with ADA modules, or linking C modules that are - compiled with 32-bit ints with C modules that are compiled with 64-bit - ints (not inherently evil with a smarter linker). */ - - struct type **fundamental_types; - /* The mmalloc() malloc-descriptor for this objfile if we are using the memory mapped malloc() package to manage storage for this objfile's data. NULL if we are not. */ diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 7697279..28aef4a 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -294,153 +294,6 @@ pascal_printstr (struct ui_file *stream, const gdb_byte *string, if (force_ellipses || i < length) fputs_filtered ("...", stream); } - -/* Create a fundamental Pascal type using default reasonable for the current - target machine. - - Some object/debugging file formats (DWARF version 1, COFF, etc) do not - define fundamental types such as "int" or "double". Others (stabs or - DWARF version 2, etc) do define fundamental types. For the formats which - don't provide fundamental types, gdb can create such types using this - function. - - FIXME: Some compilers distinguish explicitly signed integral types - (signed short, signed int, signed long) from "regular" integral types - (short, int, long) in the debugging information. There is some dis- - agreement as to how useful this feature is. In particular, gcc does - not support this. Also, only some debugging formats allow the - distinction to be passed on to a debugger. For now, we always just - use "short", "int", or "long" as the type name, for both the implicit - and explicitly signed types. This also makes life easier for the - gdb test suite since we don't have to account for the differences - in output depending upon what the compiler and debugging format - support. We will probably have to re-examine the issue when gdb - starts taking it's fundamental type information directly from the - debugging information supplied by the compiler. fnf@cygnus.com */ - -/* Note there might be some discussion about the choosen correspondance - because it mainly reflects Free Pascal Compiler setup for now PM */ - - -struct type * -pascal_create_fundamental_type (struct objfile *objfile, int typeid) -{ - struct type *type = NULL; - - switch (typeid) - { - default: - /* FIXME: For now, if we are asked to produce a type not in this - language, create the equivalent of a C integer type with the - name "<?type?>". When all the dust settles from the type - reconstruction work, this should probably become an error. */ - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "<?type?>", objfile); - warning (_("internal error: no Pascal fundamental type %d"), typeid); - break; - case FT_VOID: - type = init_type (TYPE_CODE_VOID, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "void", objfile); - break; - case FT_CHAR: - type = init_type (TYPE_CODE_CHAR, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "char", objfile); - break; - case FT_SIGNED_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, "shortint", objfile); - break; - case FT_UNSIGNED_CHAR: - type = init_type (TYPE_CODE_INT, - TARGET_CHAR_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "byte", objfile); - break; - case FT_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "integer", objfile); - break; - case FT_SIGNED_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "integer", objfile); /* FIXME-fnf */ - break; - case FT_UNSIGNED_SHORT: - type = init_type (TYPE_CODE_INT, - gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "word", objfile); - break; - case FT_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "longint", objfile); - break; - case FT_SIGNED_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "longint", objfile); /* FIXME -fnf */ - break; - case FT_UNSIGNED_INTEGER: - type = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "cardinal", objfile); - break; - case FT_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "long", objfile); - break; - case FT_SIGNED_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "long", objfile); /* FIXME -fnf */ - break; - case FT_UNSIGNED_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned long", objfile); - break; - case FT_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit - (current_gdbarch) / TARGET_CHAR_BIT, - 0, "long long", objfile); - break; - case FT_SIGNED_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit - (current_gdbarch) / TARGET_CHAR_BIT, - 0, "signed long long", objfile); - break; - case FT_UNSIGNED_LONG_LONG: - type = init_type (TYPE_CODE_INT, - gdbarch_long_long_bit - (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned long long", objfile); - break; - case FT_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "float", objfile); - break; - case FT_DBL_PREC_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "double", objfile); - break; - case FT_EXT_PREC_FLOAT: - type = init_type (TYPE_CODE_FLT, - gdbarch_long_double_bit (current_gdbarch) - / TARGET_CHAR_BIT, - 0, "extended", objfile); - break; - } - return (type); -} /* Table mapping opcodes into strings for printing operators @@ -557,7 +410,6 @@ const struct language_defn pascal_language_defn = pascal_printchar, /* Print a character constant */ pascal_printstr, /* Function to print string constant */ pascal_emit_char, /* Print a single char */ - pascal_create_fundamental_type, /* Create fundamental type in this language */ pascal_print_type, /* Print a type using appropriate syntax */ pascal_val_print, /* Print a value using appropriate syntax */ pascal_value_print, /* Print a top-level value */ diff --git a/gdb/p-lang.h b/gdb/p-lang.h index 994d9ad..1f50bb2 100644 --- a/gdb/p-lang.h +++ b/gdb/p-lang.h @@ -50,8 +50,6 @@ extern void pascal_printchar (int, struct ui_file *); extern void pascal_printstr (struct ui_file *, const gdb_byte *, unsigned int, int, int); -extern struct type *pascal_create_fundamental_type (struct objfile *, int); - extern struct type **const (pascal_builtin_types[]); /* These are in p-typeprint.c: */ diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c index 24dac04..85a2073 100644 --- a/gdb/scm-lang.c +++ b/gdb/scm-lang.c @@ -249,7 +249,6 @@ const struct language_defn scm_language_defn = scm_printchar, /* Print a character constant */ scm_printstr, /* Function to print string constant */ NULL, /* Function to print a single character */ - NULL, /* Create fundamental type in this language */ c_print_type, /* Print a type using appropriate syntax */ scm_val_print, /* Print a value using appropriate syntax */ scm_value_print, /* Print a top-level value */ diff --git a/gdb/stabsread.c b/gdb/stabsread.c index fb031c7..07cfe08 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -725,24 +725,19 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, { double d = atof (p); gdb_byte *dbl_valu; + struct type *dbl_type; /* FIXME-if-picky-about-floating-accuracy: Should be using target arithmetic to get the value. real.c in GCC probably has the necessary code. */ - /* FIXME: lookup_fundamental_type is a hack. We should be - creating a type especially for the type of float constants. - Problem is, what type should it be? - - Also, what should the name of this type be? Should we - be using 'S' constants (see stabs.texinfo) instead? */ - - SYMBOL_TYPE (sym) = lookup_fundamental_type (objfile, - FT_DBL_PREC_FLOAT); + dbl_type = builtin_type (current_gdbarch)->builtin_double; dbl_valu = obstack_alloc (&objfile->objfile_obstack, - TYPE_LENGTH (SYMBOL_TYPE (sym))); - store_typed_floating (dbl_valu, SYMBOL_TYPE (sym), d); + TYPE_LENGTH (dbl_type)); + store_typed_floating (dbl_valu, dbl_type, d); + + SYMBOL_TYPE (sym) = dbl_type; SYMBOL_VALUE_BYTES (sym) = dbl_valu; SYMBOL_CLASS (sym) = LOC_CONST_BYTES; } @@ -756,22 +751,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, types; other languages probably should have at least unsigned as well as signed constants. */ - /* We just need one int constant type for all objfiles. - It doesn't depend on languages or anything (arguably its - name should be a language-specific name for a type of - that size, but I'm inclined to say that if the compiler - wants a nice name for the type, it can use 'e'). */ - static struct type *int_const_type; - - /* Yes, this is as long as a *host* int. That is because we - use atoi. */ - if (int_const_type == NULL) - int_const_type = - init_type (TYPE_CODE_INT, - sizeof (int) * HOST_CHAR_BIT / TARGET_CHAR_BIT, 0, - "integer constant", - (struct objfile *) NULL); - SYMBOL_TYPE (sym) = int_const_type; + SYMBOL_TYPE (sym) = builtin_type (current_gdbarch)->builtin_long; SYMBOL_VALUE (sym) = atoi (p); SYMBOL_CLASS (sym) = LOC_CONST; } diff --git a/gdb/symfile.c b/gdb/symfile.c index 10617a1..38fc5ae 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2405,7 +2405,6 @@ reread_symbols (void) sizeof (objfile->msymbol_hash)); memset (&objfile->msymbol_demangled_hash, 0, sizeof (objfile->msymbol_demangled_hash)); - objfile->fundamental_types = NULL; clear_objfile_data (objfile); if (objfile->sf != NULL) { |