This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[rfc/rft] Remove "fundamental type" infrastructure


Hello,

I've been trying to simplify the various types currently in use
throughout GDB, and was wondering in particular what the purpose
of the "fundamental type" infrastructure was.

It appears that these types were originally used to create types
with "correct" names and attributes for certain debug formats that
do not provide explicit information on some "fundamental" types.
To this purpose, GDB defines a number of FT_ constants, and allows
each language to define a type corresponding to that fundamental
type in the given language.

However, from what I can see:

- For the C family of languages, the names and properties of the fundamendal
  type are in fact the same as those already provided via the gdbarch builtin
  type infrastructure.  In addition, many non-C languages also simply use the
  C names (with various FIXMEs) for many of the fundamental type -- it is
  often not completely clear that the FT_ types actually *have* well-defined
  correspondances in some of the languages.

- In any case, with one exception, all remaining users of the fundamental
  types use them solely in situations where exact types don't really matter,
  e.g. as error fallback in case of bugs in the debug data, or to represent
  range index types that are not externally visible anyway.  These uses can
  be replaced with builtin types or ad-hoc created types without name.

  In particular, all uses of fundamental types in the stabs and DWARF-2
  debug formats fall under that category.  Note that DWARF-1 actually did
  make use of the fundamental type concept, but DWARF-2 already requires
  every type to be explicitly defined and named.  Only if this requirement
  is violated are fundamental types still used -- and this fallback does not
  appear to be needed in practice; an assert I put there never triggered 
  during a testsuite run (on amd64-linux).

- The one exception where the debug format still needs fundamental types
  is the COFF SDB format.  However, as mentioned above, for the C family
  of languages we can just use builtin types instead.  I'm not sure if
  GDB actually does support COFF SDB for any non-C language on any
  platform -- from a bit of googling it appeared that e.g. COFF Fortran
  compilers use their own "extended" fundamental types, which we wouldn't
  handle anyway ...


So in conclusion, it looks like the fundamental type infrastructure may
not really be needed any longer.  The following patch removes it:

- All internal or error case uses are replaced by either builtin types
  or types generated ad-hoc via init_type (in those places where types
  are generated anyway).

- One obvious bug in read_tag_string_type is fixed: it looks up a 
  fundamental type only to clobber it with the new string type.

- The remaining "real" uses in coffread.c are replaced by builtin types.
  As said, this would affect debugging non-C-family programs in COFF SDB.


Tested on amd64-linux with no regressions, also with -gstabs.
Tests on any COFF SDB platforms would be appreciated.

Any comments?  Do we still have any users of COFF SDB for non-C
programs that would be affected?

Bye,
Ulrich


ChangeLog:

	* 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.


diff -urNp gdb-orig/gdb/ada-lang.c gdb-head/gdb/ada-lang.c
--- gdb-orig/gdb/ada-lang.c	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/ada-lang.c	2007-11-04 03:51:53.000000000 +0100
@@ -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_prin
   {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_
   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 -urNp gdb-orig/gdb/c-lang.c gdb-head/gdb/c-lang.c
--- gdb-orig/gdb/c-lang.c	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/c-lang.c	2007-11-04 03:51:53.000000000 +0100
@@ -180,205 +180,6 @@ c_printstr (struct ui_file *stream, cons
   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_de
   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_languag
   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_
   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_langu
   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 -urNp gdb-orig/gdb/c-lang.h gdb-head/gdb/c-lang.h
--- gdb-orig/gdb/c-lang.h	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/c-lang.h	2007-11-04 03:51:53.000000000 +0100
@@ -59,8 +59,6 @@ extern void finished_macro_expansion (vo
 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 -urNp gdb-orig/gdb/coffread.c gdb-head/gdb/coffread.c
--- gdb-orig/gdb/coffread.c	2007-11-04 03:47:13.000000000 +0100
+++ gdb-head/gdb/coffread.c	2007-11-04 03:51:46.000000000 +0100
@@ -1700,7 +1700,7 @@ decode_type (struct coff_symbol *cs, uns
 	  *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
     {
     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
       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 -urNp gdb-orig/gdb/dwarf2read.c gdb-head/gdb/dwarf2read.c
--- gdb-orig/gdb/dwarf2read.c	2007-11-04 03:47:15.000000000 +0100
+++ gdb-head/gdb/dwarf2read.c	2007-11-04 03:51:49.000000000 +0100
@@ -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 (struc
 
 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 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, s
   /* 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);
@@ -4266,7 +4246,7 @@ read_array_type (struct die_info *die, s
      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);
@@ -4701,19 +4681,11 @@ read_tag_string_type (struct die_info *d
           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);
 }
 
@@ -4828,6 +4800,9 @@ read_base_type (struct die_info *die, st
   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)
@@ -4846,71 +4821,57 @@ read_base_type (struct die_info *die, st
       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);
 }
 
@@ -4936,8 +4897,8 @@ read_subrange_type (struct die_info *die
       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)
@@ -7492,7 +7453,7 @@ die_type (struct die_info *die, struct d
   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);
@@ -7737,92 +7698,6 @@ typename_concat (struct obstack *obs, co
     }
 }
 
-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)
@@ -9046,28 +8921,6 @@ follow_die_ref (struct die_info *src_die
   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 -urNp gdb-orig/gdb/f-lang.c gdb-head/gdb/f-lang.c
--- gdb-orig/gdb/f-lang.c	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/f-lang.c	2007-11-04 03:51:53.000000000 +0100
@@ -70,7 +70,6 @@ static SAVED_F77_COMMON_PTR allocate_sav
 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, cons
   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_de
   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 -urNp gdb-orig/gdb/gdbtypes.c gdb-head/gdb/gdbtypes.c
--- gdb-orig/gdb/gdbtypes.c	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/gdbtypes.c	2007-11-04 03:51:53.000000000 +0100
@@ -1794,65 +1794,6 @@ append_composite_type_field (struct type
     }
 }
 
-/* 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 -urNp gdb-orig/gdb/gdbtypes.h gdb-head/gdb/gdbtypes.h
--- gdb-orig/gdb/gdbtypes.h	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/gdbtypes.h	2007-11-04 03:51:53.000000000 +0100
@@ -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)))
@@ -1316,8 +1273,6 @@ extern struct type *lookup_typename (cha
 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 -urNp gdb-orig/gdb/jv-lang.c gdb-head/gdb/jv-lang.c
--- gdb-orig/gdb/jv-lang.c	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/jv-lang.c	2007-11-04 03:51:53.000000000 +0100
@@ -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
   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 -urNp gdb-orig/gdb/language.c gdb-head/gdb/language.c
--- gdb-orig/gdb/language.c	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/language.c	2007-11-04 03:51:53.000000000 +0100
@@ -68,8 +68,6 @@ static void unk_lang_emit_char (int c, s
 
 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 *strea
   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_langu
   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
   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_languag
   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 -urNp gdb-orig/gdb/language.h gdb-head/gdb/language.h
--- gdb-orig/gdb/language.h	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/language.h	2007-11-04 03:51:53.000000000 +0100
@@ -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 
    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 -urNp gdb-orig/gdb/m2-lang.c gdb-head/gdb/m2-lang.c
--- gdb-orig/gdb/m2-lang.c	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/m2-lang.c	2007-11-04 03:51:53.000000000 +0100
@@ -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 *ex
  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_d
   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 -urNp gdb-orig/gdb/objc-lang.c gdb-head/gdb/objc-lang.c
--- gdb-orig/gdb/objc-lang.c	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/objc-lang.c	2007-11-04 03:51:53.000000000 +0100
@@ -421,152 +421,6 @@ objc_printstr (struct ui_file *stream, c
     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
   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 -urNp gdb-orig/gdb/objfiles.h gdb-head/gdb/objfiles.h
--- gdb-orig/gdb/objfiles.h	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/objfiles.h	2007-11-04 03:51:53.000000000 +0100
@@ -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 -urNp gdb-orig/gdb/p-lang.c gdb-head/gdb/p-lang.c
--- gdb-orig/gdb/p-lang.c	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/p-lang.c	2007-11-04 03:51:53.000000000 +0100
@@ -294,153 +294,6 @@ pascal_printstr (struct ui_file *stream,
   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_langua
   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 -urNp gdb-orig/gdb/p-lang.h gdb-head/gdb/p-lang.h
--- gdb-orig/gdb/p-lang.h	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/p-lang.h	2007-11-04 03:51:53.000000000 +0100
@@ -50,8 +50,6 @@ extern void pascal_printchar (int, struc
 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 -urNp gdb-orig/gdb/scm-lang.c gdb-head/gdb/scm-lang.c
--- gdb-orig/gdb/scm-lang.c	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/scm-lang.c	2007-11-04 03:51:53.000000000 +0100
@@ -249,7 +249,6 @@ const struct language_defn scm_language_
   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 -urNp gdb-orig/gdb/stabsread.c gdb-head/gdb/stabsread.c
--- gdb-orig/gdb/stabsread.c	2007-11-04 03:47:12.000000000 +0100
+++ gdb-head/gdb/stabsread.c	2007-11-04 03:51:51.000000000 +0100
@@ -725,24 +725,19 @@ define_symbol (CORE_ADDR valu, char *str
 	  {
 	    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 *str
 	       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 -urNp gdb-orig/gdb/symfile.c gdb-head/gdb/symfile.c
--- gdb-orig/gdb/symfile.c	2007-11-04 03:47:17.000000000 +0100
+++ gdb-head/gdb/symfile.c	2007-11-04 03:51:53.000000000 +0100
@@ -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)
 		{
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]