aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-exp.y
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-10-09 19:41:17 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-10-09 19:41:17 +0000
commit36b11add17bf287b541a107ee64f7e313e77092f (patch)
tree10896f0386763977ee0ed611c252dac694387d88 /gdb/c-exp.y
parent3343315ba7c882c948decb9aaad83e4c048a4527 (diff)
downloadgdb-36b11add17bf287b541a107ee64f7e313e77092f.zip
gdb-36b11add17bf287b541a107ee64f7e313e77092f.tar.gz
gdb-36b11add17bf287b541a107ee64f7e313e77092f.tar.bz2
gdb/
Support @entry in input expressions. * c-exp.y (ENTRY, unknown_cpp_name): New. (exp: UNKNOWN_CPP_NAME): Change to `exp: unknown_cpp_name'. (unknown_cpp_name: UNKNOWN_CPP_NAME, unknown_cpp_name: ENTRY) (variable: name_not_typename '@' ENTRY, name: ENTRY) (name_not_typename: ENTRY): New. (yylex): Recognize ENTRY. * eval.c (evaluate_subexp_standard): Support also OP_VAR_ENTRY_VALUE. * expprint.c (print_subexp_standard, dump_subexp_body_standard): Likewise. * parse.c (operator_length_standard): Likewise. * std-operator.def: New operator OP_VAR_ENTRY_VALUE. gdb/doc/ Support @entry in input expressions. * gdb.texinfo (Variables): Describe @entry names suffix. (Print Settings): Add anchor for `set print entry-values'. gdb/testsuite/ Support @entry in input expressions. * gdb.arch/amd64-entry-value.exp (entry: p i@entry, entry: p j@entry) (entry_stack: p s1@entry, entry_stack: p s2@entry) (entry_stack: p d9@entry, entry_stack: p da@entry, tailcall: p i@entry) (tailcall: p j@entry): New tests. * gdb.cp/koenig.cc (A::entry): New function. (main): Call it. * gdb.cp/koenig.exp (p entry (c)): New test.
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r--gdb/c-exp.y32
1 files changed, 31 insertions, 1 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 94d0737..5cc1e96 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -186,6 +186,7 @@ static struct stoken operator_stoken (const char *);
%token <tsval> STRING
%token <tsval> CHAR
%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */
+%token <ssym> ENTRY
%token <ssym> UNKNOWN_CPP_NAME
%token <voidval> COMPLETE
%token <tsym> TYPENAME
@@ -194,6 +195,9 @@ static struct stoken operator_stoken (const char *);
%type <ssym> name_not_typename
%type <tsym> typename
+/* It is UNKNOWN_CPP_NAME or ENTRY, depending on the context. */
+%type <ssym> unknown_cpp_name
+
/* A NAME_OR_INT is a symbol which is not known in the symbol table,
but which would parse as a valid number in the current input radix.
E.g. "c" when input_radix==16. Depending on the parse, it will be
@@ -392,7 +396,7 @@ exp : exp '('
write_exp_elt_opcode (OP_FUNCALL); }
;
-exp : UNKNOWN_CPP_NAME '('
+exp : unknown_cpp_name '('
{
/* This could potentially be a an argument defined
lookup function (Koenig). */
@@ -415,6 +419,10 @@ exp : UNKNOWN_CPP_NAME '('
}
;
+unknown_cpp_name : UNKNOWN_CPP_NAME
+ | ENTRY
+ ;
+
lcurly : '{'
{ start_arglist (); }
;
@@ -756,6 +764,21 @@ block : block COLONCOLON name
$$ = SYMBOL_BLOCK_VALUE (tem); }
;
+variable: name_not_typename '@' ENTRY
+ { struct symbol *sym = $1.sym;
+
+ if (sym == NULL || !SYMBOL_IS_ARGUMENT (sym)
+ || !symbol_read_needs_frame (sym))
+ error (_("@entry can be used only for function "
+ "parameters, not for \"%s\""),
+ copy_name ($1.stoken));
+
+ write_exp_elt_opcode (OP_VAR_ENTRY_VALUE);
+ write_exp_elt_sym (sym);
+ write_exp_elt_opcode (OP_VAR_ENTRY_VALUE);
+ }
+ ;
+
variable: block COLONCOLON name
{ struct symbol *sym;
sym = lookup_symbol (copy_name ($3), $1,
@@ -1317,11 +1340,13 @@ name : NAME { $$ = $1.stoken; }
| TYPENAME { $$ = $1.stoken; }
| NAME_OR_INT { $$ = $1.stoken; }
| UNKNOWN_CPP_NAME { $$ = $1.stoken; }
+ | ENTRY { $$ = $1.stoken; }
| operator { $$ = $1; }
;
name_not_typename : NAME
| BLOCKNAME
+ | ENTRY
/* These would be useful if name_not_typename was useful, but it is just
a fake for "variable", so these cause reduce/reduce conflicts because
the parser can't tell whether NAME_OR_INT is a name_not_typename (=variable,
@@ -2525,6 +2550,11 @@ yylex (void)
current.token = lex_one_token ();
if (current.token == NAME)
current.token = classify_name (expression_context_block);
+ if ((current.token == NAME || current.token == UNKNOWN_CPP_NAME)
+ && yylval.sval.length == strlen ("entry")
+ && strncmp (yylval.sval.ptr, "entry", strlen ("entry")) == 0)
+ current.token = ENTRY;
+
if (parse_language->la_language != language_cplus
|| (current.token != TYPENAME && current.token != COLONCOLON))
return current.token;