Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: gdb-patches@sourceware.org
Subject: [5/10] Add "explicit size" types to builtin_type
Date: Fri, 08 Jun 2007 23:16:00 -0000	[thread overview]
Message-ID: <200706082316.l58NGCCu017575@d12av02.megacenter.de.ibm.com> (raw)

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


             reply	other threads:[~2007-06-08 23:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-08 23:16 Ulrich Weigand [this message]
2007-06-12 15:22 ` Daniel Jacobowitz
2007-06-12 16:24   ` Ulrich Weigand
2007-06-12 16:32     ` Daniel Jacobowitz
2007-06-13 14:10       ` Ulrich Weigand
2007-06-13 14:19         ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200706082316.l58NGCCu017575@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox