/* YACC grammar for Modula-2 expressions, for GDB.
- Copyright (C) 1986-2019 Free Software Foundation, Inc.
+ Copyright (C) 1986-2020 Free Software Foundation, Inc.
Generated from expread.y (now c-exp.y) and contributed by the Department
of Computer Science at the State University of New York at Buffalo, 1991.
/* This function just saves the number of arguments
that follow in the list. It is *not* specific to
function types */
- { start_arglist(); }
+ { pstate->start_arglist(); }
non_empty_arglist ']' %prec DOT
{ write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT);
write_exp_elt_longcst (pstate,
- (LONGEST) end_arglist());
+ pstate->end_arglist());
write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT); }
;
exp : exp '('
/* This is to save the value of arglist_len
being accumulated by an outer function call. */
- { start_arglist (); }
+ { pstate->start_arglist (); }
arglist ')' %prec DOT
{ write_exp_elt_opcode (pstate, OP_FUNCALL);
write_exp_elt_longcst (pstate,
- (LONGEST) end_arglist ());
+ pstate->end_arglist ());
write_exp_elt_opcode (pstate, OP_FUNCALL); }
;
;
arglist : exp
- { arglist_len = 1; }
+ { pstate->arglist_len = 1; }
;
arglist : arglist ',' exp %prec ABOVE_COMMA
- { arglist_len++; }
+ { pstate->arglist_len++; }
;
non_empty_arglist
: exp
- { arglist_len = 1; }
+ { pstate->arglist_len = 1; }
;
non_empty_arglist
: non_empty_arglist ',' exp %prec ABOVE_COMMA
- { arglist_len++; }
+ { pstate->arglist_len++; }
;
/* GDB construct */
fblock : BLOCKNAME
{ struct symbol *sym
- = lookup_symbol (copy_name ($1),
+ = lookup_symbol (copy_name ($1).c_str (),
pstate->expression_context_block,
VAR_DOMAIN, 0).symbol;
$$ = sym;}
/* GDB scope operator */
fblock : block COLONCOLON BLOCKNAME
{ struct symbol *tem
- = lookup_symbol (copy_name ($3), $1,
+ = lookup_symbol (copy_name ($3).c_str (), $1,
VAR_DOMAIN, 0).symbol;
if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
error (_("No function \"%s\" in specified context."),
- copy_name ($3));
+ copy_name ($3).c_str ());
$$ = tem;
}
;
/* GDB scope operator */
variable: block COLONCOLON NAME
{ struct block_symbol sym
- = lookup_symbol (copy_name ($3), $1,
+ = lookup_symbol (copy_name ($3).c_str (), $1,
VAR_DOMAIN, 0);
if (sym.symbol == 0)
error (_("No symbol \"%s\" in specified context."),
- copy_name ($3));
+ copy_name ($3).c_str ());
if (symbol_read_needs_frame (sym.symbol))
- innermost_block.update (sym);
+ pstate->block_tracker->update (sym);
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
write_exp_elt_block (pstate, sym.block);
struct field_of_this_result is_a_field_of_this;
sym
- = lookup_symbol (copy_name ($1),
+ = lookup_symbol (copy_name ($1).c_str (),
pstate->expression_context_block,
VAR_DOMAIN,
&is_a_field_of_this);
if (sym.symbol)
{
if (symbol_read_needs_frame (sym.symbol))
- innermost_block.update (sym);
+ pstate->block_tracker->update (sym);
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
write_exp_elt_block (pstate, sym.block);
else
{
struct bound_minimal_symbol msymbol;
- char *arg = copy_name ($1);
+ std::string arg = copy_name ($1);
msymbol =
- lookup_bound_minimal_symbol (arg);
+ lookup_bound_minimal_symbol (arg.c_str ());
if (msymbol.minsym != NULL)
write_exp_msymbol (pstate, msymbol);
else if (!have_full_symbols () && !have_partial_symbols ())
error (_("No symbol table is loaded. Use the \"symbol-file\" command."));
else
error (_("No symbol \"%s\" in current context."),
- copy_name ($1));
+ arg.c_str ());
}
}
;
: TYPENAME
{ $$
= lookup_typename (pstate->language (),
- pstate->gdbarch (),
- copy_name ($1),
+ copy_name ($1).c_str (),
pstate->expression_context_block,
0);
}
currently as names of types; NAME for other symbols.
The caller is not constrained to care about the distinction. */
{
-
-
- char *tmp = copy_name (yylval.sval);
+ std::string tmp = copy_name (yylval.sval);
struct symbol *sym;
- if (lookup_symtab (tmp))
+ if (lookup_symtab (tmp.c_str ()))
return BLOCKNAME;
- sym = lookup_symbol (tmp, pstate->expression_context_block,
+ sym = lookup_symbol (tmp.c_str (), pstate->expression_context_block,
VAR_DOMAIN, 0).symbol;
if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
return BLOCKNAME;
- if (lookup_typename (pstate->language (), pstate->gdbarch (),
- copy_name (yylval.sval),
- pstate->expression_context_block, 1))
+ if (lookup_typename (pstate->language (),
+ tmp.c_str (), pstate->expression_context_block, 1))
return TYPENAME;
if(sym)