/* Internal type definitions for GDB.
- Copyright (C) 1992, 1993, 1994, 1996, 1998, 1999
+ Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
#if !defined (GDBTYPES_H)
#define GDBTYPES_H 1
+/* Forward declarations for prototypes. */
+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
/* No sign for this type. In C++, "char", "signed char", and "unsigned
char" are distinct types; so we need an extra flag to indicate the
- absence ofa sign! */
+ absence of a sign! */
#define TYPE_FLAG_NOSIGN (1 << 1)
#define TYPE_FLAG_INCOMPLETE (1 << 8)
+/* Instruction-space delimited type. This is for Harvard architectures
+ which have separate instruction and data address spaces (and perhaps
+ others).
+
+ GDB usually defines a flat address space that is a superset of the
+ architecture's two (or more) address spaces, but this is an extension
+ of the architecture's model.
+
+ If TYPE_FLAG_INST is set, an object of the corresponding type
+ resides in instruction memory, even if its address (in the extended
+ flat address space) does not reflect this.
+
+ Similarly, if TYPE_FLAG_DATA is set, then an object of the
+ corresponding type resides in the data memory space, even if
+ this is not indicated by its (flat address space) address.
+
+ If neither flag is set, the default space for functions / methods
+ is instruction space, and for data objects is data memory. */
+
+#define TYPE_FLAG_CODE_SPACE (1 << 9)
+#define TYPE_FLAG_DATA_SPACE (1 << 10)
+
struct type
{
char *tag_name;
- /* Length of storage for a value of this type. Various places pass
- this to memcpy and such, meaning it must be in units of
- HOST_CHAR_BIT. Various other places expect they can calculate
- addresses by adding it and such, meaning it must be in units of
- TARGET_CHAR_BIT. For some DSP targets, in which HOST_CHAR_BIT
- will (presumably) be 8 and TARGET_CHAR_BIT will be (say) 32, this
- is a problem. One fix would be to make this field in bits
- (requiring that it always be a multiple of HOST_CHAR_BIT and
- TARGET_CHAR_BIT)--the other choice would be to make it
- consistently in units of HOST_CHAR_BIT. */
-
+ /* Length of storage for a value of this type. This is what
+ sizeof(type) would return; use it for address arithmetic,
+ memory reads and writes, etc. This size includes padding. For
+ example, an i386 extended-precision floating point value really
+ only occupies ten bytes, but most ABI's declare its size to be
+ 12 bytes, to preserve alignment. A `struct type' representing
+ such a floating-point type would have a `length' value of 12,
+ even though the last two bytes are unused.
+
+ There's a bit of a host/target mess here, if you're concerned
+ about machines whose bytes aren't eight bits long, or who don't
+ have byte-addressed memory. Various places pass this to memcpy
+ and such, meaning it must be in units of host bytes. Various
+ other places expect they can calculate addresses by adding it
+ and such, meaning it must be in units of target bytes. For
+ some DSP targets, in which HOST_CHAR_BIT will (presumably) be 8
+ and TARGET_CHAR_BIT will be (say) 32, this is a problem.
+
+ One fix would be to make this field in bits (requiring that it
+ always be a multiple of HOST_CHAR_BIT and TARGET_CHAR_BIT) ---
+ the other choice would be to make it consistently in units of
+ HOST_CHAR_BIT. However, this would still fail to address
+ machines based on a ternary or decimal representation. */
unsigned length;
/* FIXME, these should probably be restricted to a Fortran-specific
are chained together in a ring. */
struct type *cv_type;
+ /* Address-space delimited variant chain. This points to a type
+ that differs from this one only in an address-space qualifier
+ attribute. The otherwise-identical address-space delimited
+ types are chained together in a ring. */
+ struct type *as_type;
+
/* Flags about this type. */
int flags;
struct cplus_struct_type *cplus_stuff;
+ /* FLOATFORMAT is for TYPE_CODE_FLT. It is a pointer to the
+ floatformat object that describes the floating-point value
+ that resides within the type. */
+
+ const struct floatformat *floatformat;
}
type_specific;
};
extern const struct cplus_struct_type cplus_struct_default;
-extern void
-allocate_cplus_struct_type PARAMS ((struct type *));
+extern void allocate_cplus_struct_type (struct type *);
#define INIT_CPLUS_SPECIFIC(type) \
(TYPE_CPLUS_SPECIFIC(type)=(struct cplus_struct_type*)&cplus_struct_default)
#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
#define TYPE_CV_TYPE(thistype) (thistype)->cv_type
+#define TYPE_AS_TYPE(thistype) (thistype)->as_type
/* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
so you only have to call check_typedef once. Since allocate_value
#define TYPE_TYPE_SPECIFIC(thistype) (thistype)->type_specific
#define TYPE_ARG_TYPES(thistype) (thistype)->type_specific.arg_types
#define TYPE_CPLUS_SPECIFIC(thistype) (thistype)->type_specific.cplus_stuff
+#define TYPE_FLOATFORMAT(thistype) (thistype)->type_specific.floatformat
#define TYPE_BASECLASS(thistype,index) (thistype)->fields[index].type
#define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
#define TYPE_BASECLASS_NAME(thistype,index) (thistype)->fields[index].name
extern struct type *builtin_type_string;
extern struct type *builtin_type_bool;
-/* Explicit sizes - see <intypes.h> for naming schema */
+/* Address/pointer types: */
+/* (C) Language `pointer to data' type. Some target platforms use an
+ implicitly {sign,zero} -extended 32 bit C language pointer on a 64
+ bit ISA. */
+extern struct type *builtin_type_void_data_ptr;
+
+/* (C) Language `pointer to function returning void' type. Since
+ ANSI, C standards have explicitly said that pointers to functions
+ and pointers to data are not interconvertible --- that is, you
+ can't cast a function pointer to void * and back, and expect to get
+ the same value. However, all function pointer types are
+ interconvertible, so void (*) () can server as a generic function
+ pointer. */
+extern struct type *builtin_type_void_func_ptr;
+
+/* The target CPU's address type. This is the ISA address size. */
+extern struct type *builtin_type_CORE_ADDR;
+/* The symbol table address type. Some object file formats have a 32
+ bit address type even though the TARGET has a 64 bit pointer type
+ (cf MIPS). */
+extern struct type *builtin_type_bfd_vma;
+
+/* Explicit sizes - see C9X <intypes.h> for naming scheme */
extern struct type *builtin_type_int8;
extern struct type *builtin_type_uint8;
extern struct type *builtin_type_int16;
extern struct type *builtin_type_uint32;
extern struct type *builtin_type_int64;
extern struct type *builtin_type_uint64;
+extern struct type *builtin_type_int128;
+extern struct type *builtin_type_uint128;
+
+/* SIMD types. We inherit these names from GCC. */
+extern struct type *builtin_type_v4sf;
+extern struct type *builtin_type_v4si;
+extern struct type *builtin_type_v8qi;
+extern struct type *builtin_type_v4hi;
+extern struct type *builtin_type_v2si;
+
+/* Explicit floating-point formats. See "floatformat.h". */
+extern struct type *builtin_type_ieee_single_big;
+extern struct type *builtin_type_ieee_single_little;
+extern struct type *builtin_type_ieee_double_big;
+extern struct type *builtin_type_ieee_double_little;
+extern struct type *builtin_type_ieee_double_littlebyte_bigword;
+extern struct type *builtin_type_i387_ext;
+extern struct type *builtin_type_m68881_ext;
+extern struct type *builtin_type_i960_ext;
+extern struct type *builtin_type_m88110_ext;
+extern struct type *builtin_type_m88110_harris_ext;
+extern struct type *builtin_type_arm_ext_big;
+extern struct type *builtin_type_arm_ext_littlebyte_bigword;
+extern struct type *builtin_type_ia64_spill_big;
+extern struct type *builtin_type_ia64_spill_little;
+extern struct type *builtin_type_ia64_quad_big;
+extern struct type *builtin_type_ia64_quad_little;
/* We use this for the '/c' print format, because builtin_type_char is
just a one-byte integral type, which languages less laid back than
extern struct type *builtin_type_f_character;
extern struct type *builtin_type_f_integer;
+extern struct type *builtin_type_f_integer_s2;
extern struct type *builtin_type_f_logical;
extern struct type *builtin_type_f_logical_s1;
extern struct type *builtin_type_f_logical_s2;
-extern struct type *builtin_type_f_integer;
-extern struct type *builtin_type_f_integer_s2;
extern struct type *builtin_type_f_real;
extern struct type *builtin_type_f_real_s8;
extern struct type *builtin_type_f_real_s16;
/* Maximum and minimum values of built-in types */
#define MAX_OF_TYPE(t) \
- TYPE_UNSIGNED(t) ? UMAX_OF_SIZE(TYPE_LENGTH(t)) \
- : MAX_OF_SIZE(TYPE_LENGTH(t))
+ (TYPE_UNSIGNED(t) ? UMAX_OF_SIZE(TYPE_LENGTH(t)) \
+ : MAX_OF_SIZE(TYPE_LENGTH(t)))
#define MIN_OF_TYPE(t) \
- TYPE_UNSIGNED(t) ? UMIN_OF_SIZE(TYPE_LENGTH(t)) \
- : MIN_OF_SIZE(TYPE_LENGTH(t))
+ (TYPE_UNSIGNED(t) ? UMIN_OF_SIZE(TYPE_LENGTH(t)) \
+ : MIN_OF_SIZE(TYPE_LENGTH(t)))
/* Allocate space for storing data associated with a particular type.
We ensure that the space is allocated using the same mechanism that
? obstack_alloc (&TYPE_OBJFILE (t) -> type_obstack, size) \
: xmalloc (size))
-extern struct type *
- alloc_type PARAMS ((struct objfile *));
+extern struct type *alloc_type (struct objfile *);
+
+extern struct type *init_type (enum type_code, int, int, char *,
+ struct objfile *);
+
+extern struct type *lookup_reference_type (struct type *);
+
+extern struct type *make_reference_type (struct type *, struct type **);
-extern struct type *
- init_type PARAMS ((enum type_code, int, int, char *, struct objfile *));
+extern struct type *make_cv_type (int, int, struct type *, struct type **);
-extern struct type *
- lookup_reference_type PARAMS ((struct type *));
+extern int address_space_name_to_int (char *);
-extern struct type *
- make_reference_type PARAMS ((struct type *, struct type **));
+extern char *address_space_int_to_name (int);
-extern struct type *
- make_cv_type PARAMS ((int, int, struct type *, struct type **));
+extern struct type *make_type_with_address_space (struct type *type,
+ int space_identifier);
-extern struct type *
- lookup_member_type PARAMS ((struct type *, struct type *));
+extern struct type *lookup_member_type (struct type *, struct type *);
extern void
-smash_to_method_type PARAMS ((struct type *, struct type *, struct type *,
- struct type **));
+smash_to_method_type (struct type *, struct type *, struct type *,
+ struct type **);
extern void
-smash_to_member_type PARAMS ((struct type *, struct type *, struct type *));
+smash_to_member_type (struct type *, struct type *, struct type *);
-extern struct type *
- allocate_stub_method PARAMS ((struct type *));
+extern struct type *allocate_stub_method (struct type *);
-extern char *
- type_name_no_tag PARAMS ((const struct type *));
+extern char *type_name_no_tag (const struct type *);
-extern struct type *
- lookup_struct_elt_type PARAMS ((struct type *, char *, int));
+extern struct type *lookup_struct_elt_type (struct type *, char *, int);
-extern struct type *
- make_pointer_type PARAMS ((struct type *, struct type **));
+extern struct type *make_pointer_type (struct type *, struct type **);
-extern struct type *
- lookup_pointer_type PARAMS ((struct type *));
+extern struct type *lookup_pointer_type (struct type *);
-extern struct type *
- make_function_type PARAMS ((struct type *, struct type **));
+extern struct type *make_function_type (struct type *, struct type **);
-extern struct type *
- lookup_function_type PARAMS ((struct type *));
+extern struct type *lookup_function_type (struct type *);
-extern struct type *
- create_range_type PARAMS ((struct type *, struct type *, int, int));
+extern struct type *create_range_type (struct type *, struct type *, int,
+ int);
-extern struct type *
- create_array_type PARAMS ((struct type *, struct type *, struct type *));
+extern struct type *create_array_type (struct type *, struct type *,
+ struct type *);
-extern struct type *
- create_string_type PARAMS ((struct type *, struct type *));
+extern struct type *create_string_type (struct type *, struct type *);
-extern struct type *create_set_type PARAMS ((struct type *, struct type *));
+extern struct type *create_set_type (struct type *, struct type *);
-extern int chill_varying_type PARAMS ((struct type *));
+extern int chill_varying_type (struct type *);
-extern struct type *
- lookup_unsigned_typename PARAMS ((char *));
+extern struct type *lookup_unsigned_typename (char *);
-extern struct type *
- lookup_signed_typename PARAMS ((char *));
+extern struct type *lookup_signed_typename (char *);
-extern struct type *
- check_typedef PARAMS ((struct type *));
+extern struct type *check_typedef (struct type *);
#define CHECK_TYPEDEF(TYPE) (TYPE) = check_typedef (TYPE)
-extern void
-check_stub_method PARAMS ((struct type *, int, int));
+extern void check_stub_method (struct type *, int, int);
-extern struct type *
- lookup_primitive_typename PARAMS ((char *));
+extern struct type *lookup_primitive_typename (char *);
-extern char *
- gdb_mangle_name PARAMS ((struct type *, int, int));
+extern char *gdb_mangle_name (struct type *, int, int);
-extern struct type *
- builtin_type PARAMS ((char **));
+extern struct type *builtin_type (char **);
-extern struct type *
- lookup_typename PARAMS ((char *, struct block *, int));
+extern struct type *lookup_typename (char *, struct block *, int);
-extern struct type *
- lookup_template_type PARAMS ((char *, struct type *, struct block *));
+extern struct type *lookup_template_type (char *, struct type *,
+ struct block *);
-extern struct type *
- lookup_fundamental_type PARAMS ((struct objfile *, int));
+extern struct type *lookup_fundamental_type (struct objfile *, int);
-extern void
-fill_in_vptr_fieldno PARAMS ((struct type *));
+extern void fill_in_vptr_fieldno (struct type *);
-extern int get_destructor_fn_field PARAMS ((struct type *, int *, int *));
+extern int get_destructor_fn_field (struct type *, int *, int *);
-extern int get_discrete_bounds PARAMS ((struct type *, LONGEST *, LONGEST *));
+extern int get_discrete_bounds (struct type *, LONGEST *, LONGEST *);
-extern int
-is_ancestor PARAMS ((struct type *, struct type *));
+extern int is_ancestor (struct type *, struct type *);
-extern int
-has_vtable PARAMS ((struct type *));
+extern int has_vtable (struct type *);
-extern struct type *
- primary_base_class PARAMS ((struct type *));
+extern struct type *primary_base_class (struct type *);
-extern struct type **
- virtual_base_list PARAMS ((struct type *));
+extern struct type **virtual_base_list (struct type *);
-extern int
-virtual_base_list_length PARAMS ((struct type *));
-extern int
-virtual_base_list_length_skip_primaries PARAMS ((struct type *));
+extern int virtual_base_list_length (struct type *);
+extern int virtual_base_list_length_skip_primaries (struct type *);
-extern int
-virtual_base_index PARAMS ((struct type *, struct type *));
-extern int
-virtual_base_index_skip_primaries PARAMS ((struct type *, struct type *));
+extern int virtual_base_index (struct type *, struct type *);
+extern int virtual_base_index_skip_primaries (struct type *, struct type *);
-extern int
-class_index_in_primary_list PARAMS ((struct type *));
+extern int class_index_in_primary_list (struct type *);
-extern int
-count_virtual_fns PARAMS ((struct type *));
+extern int count_virtual_fns (struct type *);
/* Constants for HP/Taligent ANSI C++ runtime model */
#define POINTER_CONVERSION_BADNESS 2
/* Badness of conversion of pointer to void pointer */
#define VOID_PTR_CONVERSION_BADNESS 2
-/* Badness of convering derived to base class */
+/* Badness of converting derived to base class */
#define BASE_CONVERSION_BADNESS 2
+/* Badness of converting from non-reference to reference */
+#define REFERENCE_CONVERSION_BADNESS 2
/* Non-standard conversions allowed by the debugger */
/* Converting a pointer to an int is usually OK */
#define NS_POINTER_CONVERSION_BADNESS 10
-extern int
-compare_badness PARAMS ((struct badness_vector *, struct badness_vector *));
+extern int compare_badness (struct badness_vector *, struct badness_vector *);
-extern struct badness_vector *
- rank_function PARAMS ((struct type **, int, struct type **, int));
+extern struct badness_vector *rank_function (struct type **, int,
+ struct type **, int);
-extern int
-rank_one_type PARAMS ((struct type *, struct type *));
+extern int rank_one_type (struct type *, struct type *);
-extern void recursive_dump_type PARAMS ((struct type *, int));
+extern void recursive_dump_type (struct type *, int);
/* printcmd.c */
-extern void
-print_scalar_formatted PARAMS ((char *, struct type *, int, int, GDB_FILE *));
-
-extern int can_dereference PARAMS ((struct type *));
-
-extern int is_integral_type PARAMS ((struct type *));
+extern void print_scalar_formatted (char *, struct type *, int, int,
+ struct ui_file *);
-extern void maintenance_print_type PARAMS ((char *, int));
+extern int can_dereference (struct type *);
-/* typeprint.c */
+extern int is_integral_type (struct type *);
-extern void print_type_scalar PARAMS ((struct type *, LONGEST, GDB_FILE *));
+extern void maintenance_print_type (char *, int);
#endif /* GDBTYPES_H */