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]

[5/10] Add "explicit size" types to builtin_type


Hello,

the builtin_type structure does not contain the builtin types that
are supposedly independent of the gdbarch.  However, as already
noted in comments in gdbtypes.c, this isn't really true: those types
contain pointer_type and reference_type fields caching pointer and
reference types to those base types -- and those will always be
platform-dependent.  Thus the base types must be treated as
platform-dependent as well.

This patch adds all those missing types to the builtin_type structure.

Bye,
Ulrich


ChangeLog:

	* gdbarch.h (struct builtin_type): New members builtin_int0,
	builtin_int8, builtin_uint8, builtin_int16, builtin_uint16,
	builtin_int32, builtin_uint32, builtin_int64, builtin_uint64,
	builtin_int128, builtin_uint128, builtin_ieee_single,
	builtin_ieee_double, builtin_i387_ext, builtin_m68881_ext,
	builtin_arm_ext, builtin_ia64_spill, builtin_ia64_quad.
	* gdbarch.c (gdbtypes_post_init): Initialize them.


diff -urNp gdb-orig/gdb/gdbtypes.c gdb-head/gdb/gdbtypes.c
--- gdb-orig/gdb/gdbtypes.c	2007-06-08 18:25:35.311859405 +0200
+++ gdb-head/gdb/gdbtypes.c	2007-06-08 18:25:42.417900011 +0200
@@ -3583,6 +3583,74 @@ gdbtypes_post_init (struct gdbarch *gdba
 	       TYPE_FLAG_UNSIGNED,
 	       "__bfd_vma", (struct objfile *) NULL);
 
+
+  /* Explicit types. 
+
+     Even though all types below here do not themselves depend on the
+     architecture, we still provide per-architecture instances.  This is
+     because their pointer_type and reference_type fields may refer to
+     types that *are* architecture specific.  */
+
+  builtin_type->builtin_int0 =
+    init_type (TYPE_CODE_INT, 0 / 8,
+	       0,
+	       "int0_t", (struct objfile *) NULL);
+  builtin_type->builtin_int8 =
+    init_type (TYPE_CODE_INT, 8 / 8,
+	       0,
+	       "int8_t", (struct objfile *) NULL);
+  builtin_type->builtin_uint8 =
+    init_type (TYPE_CODE_INT, 8 / 8,
+	       TYPE_FLAG_UNSIGNED,
+	       "uint8_t", (struct objfile *) NULL);
+  builtin_type->builtin_int16 =
+    init_type (TYPE_CODE_INT, 16 / 8,
+	       0,
+	       "int16_t", (struct objfile *) NULL);
+  builtin_type->builtin_uint16 =
+    init_type (TYPE_CODE_INT, 16 / 8,
+	       TYPE_FLAG_UNSIGNED,
+	       "uint16_t", (struct objfile *) NULL);
+  builtin_type->builtin_int32 =
+    init_type (TYPE_CODE_INT, 32 / 8,
+	       0,
+	       "int32_t", (struct objfile *) NULL);
+  builtin_type->builtin_uint32 =
+    init_type (TYPE_CODE_INT, 32 / 8,
+	       TYPE_FLAG_UNSIGNED,
+	       "uint32_t", (struct objfile *) NULL);
+  builtin_type->builtin_int64 =
+    init_type (TYPE_CODE_INT, 64 / 8,
+	       0,
+	       "int64_t", (struct objfile *) NULL);
+  builtin_type->builtin_uint64 =
+    init_type (TYPE_CODE_INT, 64 / 8,
+	       TYPE_FLAG_UNSIGNED,
+	       "uint64_t", (struct objfile *) NULL);
+  builtin_type->builtin_int128 =
+    init_type (TYPE_CODE_INT, 128 / 8,
+	       0,
+	       "int128_t", (struct objfile *) NULL);
+  builtin_type->builtin_uint128 =
+    init_type (TYPE_CODE_INT, 128 / 8,
+	       TYPE_FLAG_UNSIGNED,
+	       "uint128_t", (struct objfile *) NULL);
+
+  builtin_type->builtin_ieee_single
+    = build_flt (-1, "builtin_type_ieee_single", floatformats_ieee_single);
+  builtin_type->builtin_ieee_double
+    = build_flt (-1, "builtin_type_ieee_double", floatformats_ieee_double);
+  builtin_type->builtin_i387_ext
+    = build_flt (-1, "builtin_type_i387_ext", floatformats_i387_ext);
+  builtin_type->builtin_m68881_ext
+    = build_flt (-1, "builtin_type_m68881_ext", floatformats_m68881_ext);
+  builtin_type->builtin_arm_ext
+    = build_flt (-1, "builtin_type_arm_ext", floatformats_arm_ext);
+  builtin_type->builtin_ia64_spill
+    = build_flt (-1, "builtin_type_ia64_spill", floatformats_ia64_spill);
+  builtin_type->builtin_ia64_quad
+    = build_flt (-1, "builtin_type_ia64_quad", floatformats_ia64_quad);
+
   return builtin_type;
 }
 
diff -urNp gdb-orig/gdb/gdbtypes.h gdb-head/gdb/gdbtypes.h
--- gdb-orig/gdb/gdbtypes.h	2007-06-08 18:25:35.356852928 +0200
+++ gdb-head/gdb/gdbtypes.h	2007-06-08 18:25:42.460893821 +0200
@@ -1034,6 +1034,38 @@ struct builtin_type
   struct type *builtin_bool;
   struct type *builtin_long_long;
   struct type *builtin_unsigned_long_long;
+
+
+  /* Explicit types.
+
+     Even though all types below here do not themselves depend on the
+     architecture, we still provide per-architecture instances.  This is
+     because their pointer_type and reference_type fields may refer to
+     types that *are* architecture specific.  */
+
+  /* Explicit integer types - see C9X <intypes.h> for naming scheme.
+     The "int0" is for when an architecture needs to describe a register
+     that has no size.  */
+  struct type *builtin_int0;
+  struct type *builtin_int8;
+  struct type *builtin_uint8;
+  struct type *builtin_int16;
+  struct type *builtin_uint16;
+  struct type *builtin_int32;
+  struct type *builtin_uint32;
+  struct type *builtin_int64;
+  struct type *builtin_uint64;
+  struct type *builtin_int128;
+  struct type *builtin_uint128;
+
+  /* Explicit floating-point types.  */
+  struct type *builtin_ieee_single;
+  struct type *builtin_ieee_double;
+  struct type *builtin_i387_ext;
+  struct type *builtin_m68881_ext;
+  struct type *builtin_arm_ext;
+  struct type *builtin_ia64_spill;
+  struct type *builtin_ia64_quad;
 };
 
 /* Return the type table for the specified architecture.  */
-- 
  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]