From 47663de5984a7cf5eff8c8780cdf093aa9629a64 Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Thu, 15 Nov 2001 01:55:59 +0000 Subject: 2001-11-14 Michael Snyder Add address space identifiers to expression language for types. * c-exp.y (space_identifier, cv_with_space_id, const_or_volatile_or_space_identifier_noopt, const_or_volatile_or_space_identifier): New terminals. (ptype): Accept const_or_volatile_or_space_identifier. (typebase): Accept const_or_volatile_or_space_identifier. * c-typeprint.c (c_type_print_cv_qualifier): Rename to c_type_print_modifier. Handle address space modified types. * gdbtypes.h (TYPE_FLAG_CODE_SPACE, TYPE_FLAG_DATA_SPACE): New type flags. (struct type): Add new field as_type for addr-space qualified types. (TYPE_AS_TYPE): New macro, retrieves the chain of types that are identical to this one except for address-space qualification. * gdbtypes.c (alloc_type): Initialize new field 'as_type'. (address_space_name_to_int): New function. (address_space_int_to_name): New function. (make_type_with_address_space): New function. (make_cv_type): Handle as_type field of new struct type object. * parse.c (check_type_stack_depth): New function. (push_type_address_space): New function. (follow_types): Handle types with address-space qualifier. * parser-defs.h (enum type_pieces): Add enum tp_space_identifier. --- gdb/gdbtypes.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'gdb/gdbtypes.h') diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 686983c..3bc8131 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -206,6 +206,28 @@ enum type_code #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 { @@ -310,6 +332,12 @@ struct type 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; @@ -689,6 +717,7 @@ extern void allocate_cplus_struct_type (struct type *); #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 @@ -1008,6 +1037,13 @@ extern struct type *make_reference_type (struct type *, struct type **); extern struct type *make_cv_type (int, int, struct type *, struct type **); +extern int address_space_name_to_int (char *); + +extern char *address_space_int_to_name (int); + +extern struct type *make_type_with_address_space (struct type *type, + int space_identifier); + extern struct type *lookup_member_type (struct type *, struct type *); extern void -- cgit v1.1