+2020-12-11 Tom Tromey <tom@tromey.com>
+
+ * p-exp.y (intvar): Remove global.
+ (DOLLAR_VARIABLE): Change type.
+ (start): Update.
+ (exp): Call write_dollar_variable here...
+ (yylex): ... not here.
+ * m2-exp.y (DOLLAR_VARIABLE): Change type.
+ (variable): Call write_dollar_variable here...
+ (yylex): ... not here.
+ * f-exp.y (DOLLAR_VARIABLE): Change type.
+ (exp): Call write_dollar_variable here...
+ (yylex): ... not here.
+
2020-12-11 Tom Tromey <tom@tromey.com>
* varobj.c (varobj_create): Update.
%token SINGLE DOUBLE PRECISION
%token <lval> CHARACTER
-%token <voidval> DOLLAR_VARIABLE
+%token <sval> DOLLAR_VARIABLE
%token <opcode> ASSIGN_MODIFY
%token <opcode> UNOP_INTRINSIC BINOP_INTRINSIC
;
exp : DOLLAR_VARIABLE
+ { write_dollar_variable (pstate, $1); }
;
exp : SIZEOF '(' type ')' %prec UNARY
yylval.sval.length = namelen;
if (*tokstart == '$')
- {
- write_dollar_variable (pstate, yylval.sval);
- return DOLLAR_VARIABLE;
- }
-
+ return DOLLAR_VARIABLE;
+
/* Use token-type TYPENAME for symbols that happen to be defined
currently as names of types; NAME for other symbols.
The caller is not constrained to care about the distinction. */
/* The GDB scope operator */
%token COLONCOLON
-%token <voidval> DOLLAR_VARIABLE
+%token <sval> DOLLAR_VARIABLE
/* M2 tokens */
%left ','
/* GDB internal ($foo) variable */
variable: DOLLAR_VARIABLE
+ { write_dollar_variable (pstate, $1); }
;
/* GDB scope operator */
yylval.sval.length = namelen;
if (*tokstart == '$')
- {
- write_dollar_variable (pstate, yylval.sval);
- return DOLLAR_VARIABLE;
- }
+ return DOLLAR_VARIABLE;
/* Use token-type BLOCKNAME for symbols that happen to be defined as
functions. If this is not so, then ...
const char *, int, int, YYSTYPE *);
static struct type *current_type;
-static struct internalvar *intvar;
static int leftdiv_is_integer;
static void push_current_type (void);
static void pop_current_type (void);
/* Special type cases, put in to allow the parser to distinguish different
legal basetypes. */
-%token <voidval> DOLLAR_VARIABLE
+%token <sval> DOLLAR_VARIABLE
/* Object pascal */
%%
start : { current_type = NULL;
- intvar = NULL;
search_field = 0;
leftdiv_is_integer = 0;
}
;
exp : DOLLAR_VARIABLE
- /* Already written by write_dollar_variable.
- Handle current_type. */
- { if (intvar) {
- struct value * val, * mark;
-
- mark = value_mark ();
- val = value_of_internalvar (pstate->gdbarch (),
- intvar);
- current_type = value_type (val);
- value_release_to_mark (mark);
- }
+ {
+ write_dollar_variable (pstate, $1);
+
+ /* $ is the normal prefix for pascal
+ hexadecimal values but this conflicts
+ with the GDB use for debugger variables
+ so in expression to enter hexadecimal
+ values we still need to use C syntax with
+ 0xff */
+ std::string tmp ($1.ptr, $1.length);
+ /* Handle current_type. */
+ struct internalvar *intvar
+ = lookup_only_internalvar (tmp.c_str () + 1);
+ if (intvar != nullptr)
+ {
+ scoped_value_mark mark;
+
+ value *val
+ = value_of_internalvar (pstate->gdbarch (),
+ intvar);
+ current_type = value_type (val);
+ }
}
;
if (*tokstart == '$')
{
- char *tmp;
-
- /* $ is the normal prefix for pascal hexadecimal values
- but this conflicts with the GDB use for debugger variables
- so in expression to enter hexadecimal values
- we still need to use C syntax with 0xff */
- write_dollar_variable (pstate, yylval.sval);
- tmp = (char *) alloca (namelen + 1);
- memcpy (tmp, tokstart, namelen);
- tmp[namelen] = '\0';
- intvar = lookup_only_internalvar (tmp + 1);
free (uptokstart);
return DOLLAR_VARIABLE;
}