2007-06-13 Claudio Fontana <claudio.fontana@gmail.com>
[deliverable/binutils-gdb.git] / gdb / gdbtypes.c
index 92d5a39a846255584deb6ac78075d9a41bbc2e1e..d96d5feeadd0a34f8c56537204db6624cb99f4ef 100644 (file)
@@ -313,7 +313,7 @@ make_pointer_type (struct type *type, struct type **typeptr)
 
   /* FIXME!  Assume the machine has only one representation for pointers!  */
 
-  TYPE_LENGTH (ntype) = TARGET_PTR_BIT / TARGET_CHAR_BIT;
+  TYPE_LENGTH (ntype) = gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT;
   TYPE_CODE (ntype) = TYPE_CODE_PTR;
 
   /* Mark pointers as unsigned.  The target converts between pointers
@@ -392,7 +392,7 @@ make_reference_type (struct type *type, struct type **typeptr)
   /* FIXME!  Assume the machine has only one representation for references,
      and that it matches the (only) representation for pointers!  */
 
-  TYPE_LENGTH (ntype) = TARGET_PTR_BIT / TARGET_CHAR_BIT;
+  TYPE_LENGTH (ntype) = gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT;
   TYPE_CODE (ntype) = TYPE_CODE_REF;
 
   if (!TYPE_REFERENCE_TYPE (type))     /* Remember it, if don't have one.  */
@@ -1073,7 +1073,7 @@ smash_to_memberptr_type (struct type *type, struct type *domain,
   TYPE_DOMAIN_TYPE (type) = domain;
   /* Assume that a data member pointer is the same size as a normal
      pointer.  */
-  TYPE_LENGTH (type) = TARGET_PTR_BIT / TARGET_CHAR_BIT;
+  TYPE_LENGTH (type) = gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT;
   TYPE_CODE (type) = TYPE_CODE_MEMBERPTR;
 }
 
@@ -3466,20 +3466,27 @@ build_gdbtypes (void)
               gdbarch_long_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
               TYPE_FLAG_UNSIGNED, 
               "unsigned long long", (struct objfile *) NULL);
-  builtin_type_float = build_flt (TARGET_FLOAT_BIT, "float",
-                                 TARGET_FLOAT_FORMAT);
-  builtin_type_double = build_flt (TARGET_DOUBLE_BIT, "double",
-                                  TARGET_DOUBLE_FORMAT);
-  builtin_type_long_double = build_flt (TARGET_LONG_DOUBLE_BIT, "long double",
-                                       TARGET_LONG_DOUBLE_FORMAT);
+
+  builtin_type_float
+    = build_flt (gdbarch_float_bit (current_gdbarch), "float",
+                                   gdbarch_float_format (current_gdbarch));
+  builtin_type_double
+    = build_flt (gdbarch_double_bit (current_gdbarch), "double",
+                                    gdbarch_double_format (current_gdbarch));
+  builtin_type_long_double
+    = build_flt (gdbarch_long_double_bit (current_gdbarch), "long double",
+                                         gdbarch_long_double_format
+                                           (current_gdbarch));
 
   builtin_type_complex =
-    init_type (TYPE_CODE_COMPLEX, 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+    init_type (TYPE_CODE_COMPLEX,
+              2 * gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
               0,
               "complex", (struct objfile *) NULL);
   TYPE_TARGET_TYPE (builtin_type_complex) = builtin_type_float;
   builtin_type_double_complex =
-    init_type (TYPE_CODE_COMPLEX, 2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+    init_type (TYPE_CODE_COMPLEX,
+              2 * gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
               0,
               "double complex", (struct objfile *) NULL);
   TYPE_TARGET_TYPE (builtin_type_double_complex) = builtin_type_double;
@@ -3567,11 +3574,11 @@ Show resolution of opaque struct/class/union types (if set before loading symbol
   builtin_type_void_func_ptr
     = lookup_pointer_type (lookup_function_type (builtin_type_void));
   builtin_type_CORE_ADDR =
-    init_type (TYPE_CODE_INT, TARGET_ADDR_BIT / 8,
+    init_type (TYPE_CODE_INT, gdbarch_addr_bit (current_gdbarch) / 8,
               TYPE_FLAG_UNSIGNED,
               "__CORE_ADDR", (struct objfile *) NULL);
   builtin_type_bfd_vma =
-    init_type (TYPE_CODE_INT, TARGET_BFD_VMA_BIT / 8,
+    init_type (TYPE_CODE_INT, gdbarch_addr_bit (current_gdbarch) / 8,
               TYPE_FLAG_UNSIGNED,
               "__bfd_vma", (struct objfile *) NULL);
 }
@@ -3718,7 +3725,7 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
   builtin_type->builtin_func_ptr
     = lookup_pointer_type (lookup_function_type (builtin_type->builtin_void));
   builtin_type->builtin_core_addr =
-    init_type (TYPE_CODE_INT, TARGET_ADDR_BIT / 8,
+    init_type (TYPE_CODE_INT, gdbarch_addr_bit (current_gdbarch) / 8,
               TYPE_FLAG_UNSIGNED,
               "__CORE_ADDR", (struct objfile *) NULL);
 
This page took 0.024322 seconds and 4 git commands to generate.