/* 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
- and addresses (CORE_ADDRs) using POINTER_TO_ADDRESS() and
- ADDRESS_TO_POINTER(). */
+ and addresses (CORE_ADDRs) using gdbarch_pointer_to_address and
+ gdbarch_address_to_pointer. */
TYPE_FLAGS (ntype) |= TYPE_FLAG_UNSIGNED;
if (!TYPE_POINTER_TYPE (type)) /* Remember it, if don't have one. */
{
struct type *ntype; /* New type */
struct objfile *objfile;
+ struct type *chain;
ntype = TYPE_REFERENCE_TYPE (type);
{
ntype = *typeptr;
objfile = TYPE_OBJFILE (ntype);
+ chain = TYPE_CHAIN (ntype);
smash_type (ntype);
+ TYPE_CHAIN (ntype) = chain;
TYPE_OBJFILE (ntype) = objfile;
}
/* 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. */
TYPE_REFERENCE_TYPE (type) = ntype;
+ /* Update the length of all the other variants of this type. */
+ chain = TYPE_CHAIN (ntype);
+ while (chain != ntype)
+ {
+ TYPE_LENGTH (chain) = TYPE_LENGTH (ntype);
+ chain = TYPE_CHAIN (chain);
+ }
+
return ntype;
}
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;
}
builtin_type_char =
init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
(TYPE_FLAG_NOSIGN
- | (TARGET_CHAR_SIGNED ? 0 : TYPE_FLAG_UNSIGNED)),
+ | (gdbarch_char_signed (current_gdbarch) ?
+ 0 : TYPE_FLAG_UNSIGNED)),
"char", (struct objfile *) NULL);
builtin_type_true_char =
init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"unsigned char", (struct objfile *) NULL);
builtin_type_short =
- init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
- 0,
- "short", (struct objfile *) NULL);
+ init_type (TYPE_CODE_INT,
+ gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ 0, "short", (struct objfile *) NULL);
builtin_type_unsigned_short =
- init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
- "unsigned short", (struct objfile *) NULL);
+ init_type (TYPE_CODE_INT,
+ gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned short", (struct objfile *) NULL);
builtin_type_int =
- init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
- 0,
- "int", (struct objfile *) NULL);
+ init_type (TYPE_CODE_INT,
+ gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ 0, "int", (struct objfile *) NULL);
builtin_type_unsigned_int =
- init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
- "unsigned int", (struct objfile *) NULL);
+ init_type (TYPE_CODE_INT,
+ gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned int", (struct objfile *) NULL);
builtin_type_long =
- init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
- 0,
- "long", (struct objfile *) NULL);
+ init_type (TYPE_CODE_INT,
+ gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ 0, "long", (struct objfile *) NULL);
builtin_type_unsigned_long =
- init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
- "unsigned long", (struct objfile *) NULL);
+ init_type (TYPE_CODE_INT,
+ gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned long", (struct objfile *) NULL);
builtin_type_long_long =
- init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
- 0,
- "long long", (struct objfile *) NULL);
+ init_type (TYPE_CODE_INT,
+ gdbarch_long_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ 0, "long long", (struct objfile *) NULL);
builtin_type_unsigned_long_long =
- init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
+ init_type (TYPE_CODE_INT,
+ 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;
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);
}
builtin_type->builtin_char =
init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
(TYPE_FLAG_NOSIGN
- | (TARGET_CHAR_SIGNED ? 0 : TYPE_FLAG_UNSIGNED)),
+ | (gdbarch_char_signed (current_gdbarch) ?
+ 0 : TYPE_FLAG_UNSIGNED)),
"char", (struct objfile *) NULL);
builtin_type->builtin_true_char =
init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"unsigned char", (struct objfile *) NULL);
builtin_type->builtin_short =
- init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
- 0,
- "short", (struct objfile *) NULL);
+ init_type
+ (TYPE_CODE_INT, gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ 0, "short", (struct objfile *) NULL);
builtin_type->builtin_unsigned_short =
- init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
- "unsigned short", (struct objfile *) NULL);
+ init_type
+ (TYPE_CODE_INT, gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned short", (struct objfile *) NULL);
builtin_type->builtin_int =
- init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
- 0,
- "int", (struct objfile *) NULL);
+ init_type
+ (TYPE_CODE_INT, gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ 0, "int", (struct objfile *) NULL);
builtin_type->builtin_unsigned_int =
- init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
- "unsigned int", (struct objfile *) NULL);
+ init_type
+ (TYPE_CODE_INT, gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned int", (struct objfile *) NULL);
builtin_type->builtin_long =
- init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
- 0,
- "long", (struct objfile *) NULL);
+ init_type
+ (TYPE_CODE_INT, gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ 0, "long", (struct objfile *) NULL);
builtin_type->builtin_unsigned_long =
- init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
- "unsigned long", (struct objfile *) NULL);
+ init_type
+ (TYPE_CODE_INT, gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned long", (struct objfile *) NULL);
builtin_type->builtin_long_long =
- init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
- 0,
- "long long", (struct objfile *) NULL);
+ init_type (TYPE_CODE_INT,
+ gdbarch_long_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ 0, "long long", (struct objfile *) NULL);
builtin_type->builtin_unsigned_long_long =
- init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
- TYPE_FLAG_UNSIGNED,
- "unsigned long long", (struct objfile *) NULL);
+ init_type (TYPE_CODE_INT,
+ gdbarch_long_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned long long",
+ (struct objfile *) NULL);
builtin_type->builtin_float
= build_flt (gdbarch_float_bit (gdbarch), "float",
gdbarch_float_format (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);