diff options
author | Michael Snyder <msnyder@vmware.com> | 2001-11-15 01:55:59 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2001-11-15 01:55:59 +0000 |
commit | 47663de5984a7cf5eff8c8780cdf093aa9629a64 (patch) | |
tree | b868003a2f140dfddb88e63e9574324cdbcd1663 /gdb/c-exp.y | |
parent | 73d074b4e2c7e9a3954d0b08f048ebccd6c3e671 (diff) | |
download | gdb-47663de5984a7cf5eff8c8780cdf093aa9629a64.zip gdb-47663de5984a7cf5eff8c8780cdf093aa9629a64.tar.gz gdb-47663de5984a7cf5eff8c8780cdf093aa9629a64.tar.bz2 |
2001-11-14 Michael Snyder <msnyder@redhat.com>
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.
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r-- | gdb/c-exp.y | 57 |
1 files changed, 41 insertions, 16 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 6605751..3d2d1aa 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -718,24 +718,28 @@ variable: name_not_typename } ; +space_identifier : '@' NAME + { push_type_address_space (copy_name ($2.stoken)); + push_type (tp_space_identifier); + } + ; -ptype : typebase - | ptype const_or_volatile abs_decl const_or_volatile - { $$ = follow_types ($1); } +const_or_volatile: const_or_volatile_noopt + | ; -const_and_volatile: CONST_KEYWORD VOLATILE_KEYWORD - | VOLATILE_KEYWORD CONST_KEYWORD + +cv_with_space_id : const_or_volatile space_identifier const_or_volatile ; -const_or_volatile_noopt: const_and_volatile - { push_type (tp_const); push_type (tp_volatile);} - | CONST_KEYWORD - { push_type (tp_const);} - | VOLATILE_KEYWORD - { push_type (tp_volatile); } + +const_or_volatile_or_space_identifier_noopt: cv_with_space_id + | const_or_volatile_noopt ; -const_or_volatile: const_or_volatile_noopt - | + +const_or_volatile_or_space_identifier: + const_or_volatile_or_space_identifier_noopt + | ; + abs_decl: '*' { push_type (tp_pointer); $$ = 0; } | '*' abs_decl @@ -852,8 +856,10 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */ { $$ = lookup_template_type(copy_name($2), $4, expression_context_block); } - | const_or_volatile_noopt typebase { $$ = follow_types ($2); } - | typebase const_or_volatile_noopt { $$ = follow_types ($1); } + | const_or_volatile_or_space_identifier_noopt typebase + { $$ = follow_types ($2); } + | typebase const_or_volatile_or_space_identifier_noopt + { $$ = follow_types ($1); } ; typename: TYPENAME @@ -890,6 +896,25 @@ nonempty_typelist } ; +ptype : typebase + | ptype const_or_volatile_or_space_identifier abs_decl const_or_volatile_or_space_identifier + { $$ = follow_types ($1); } + ; + +const_and_volatile: CONST_KEYWORD VOLATILE_KEYWORD + | VOLATILE_KEYWORD CONST_KEYWORD + ; + +const_or_volatile_noopt: const_and_volatile + { push_type (tp_const); + push_type (tp_volatile); + } + | CONST_KEYWORD + { push_type (tp_const); } + | VOLATILE_KEYWORD + { push_type (tp_volatile); } + ; + name : NAME { $$ = $1.stoken; } | BLOCKNAME { $$ = $1.stoken; } | TYPENAME { $$ = $1.stoken; } @@ -1683,7 +1708,7 @@ yylex () return TYPENAME; } if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0) - return TYPENAME; + return TYPENAME; /* Input names that aren't symbols but ARE valid hex numbers, when the input radix permits them, can be names or numbers |