forked from Imagelibrary/binutils-gdb
Move innermost_block_tracker global to parse_state
This changes the parsing API so that callers that are interested in tracking the innermost block must instantiate an innermost_block_tracker and pass it in. Then, a pointer to this object is stored in the parser_state. 2019-04-04 Tom Tromey <tom@tromey.com> * varobj.c (varobj_create): Update. * rust-exp.y (struct rust_parser) <update_innermost_block, lookup_symbol>: New methods. (rust_parser::update_innermost_block, rust_parser::lookup_symbol): Rename. (rust_parser::rust_lookup_type) (rust_parser::convert_ast_to_expression, rust_lex_tests): Update. * printcmd.c (display_command, do_one_display): Update. * parser-defs.h (struct parser_state) <parser_state>: Add "tracker" parameter. (block_tracker): New member. (class innermost_block_tracker) <innermost_block_tracker>: Add "types" parameter. <reset>: Remove method. (innermost_block): Don't declare. (null_post_parser): Update. * parse.c (innermost_block): Remove global. (write_dollar_variable): Update. (parse_exp_1, parse_exp_in_context): Add "tracker" parameter. Remove "tracker_types" parameter. (parse_expression): Add "tracker" parameter. (parse_expression_for_completion): Update. (null_post_parser): Add "tracker" parameter. * p-exp.y: Update rules. * m2-exp.y: Update rules. * language.h (struct language_defn) <la_post_parser>: Add "tracker" parameter. * go-exp.y: Update rules. * f-exp.y: Update rules. * expression.h (parse_expression, parse_exp_1): Add "tracker" parameter. * d-exp.y: Update rules. * c-exp.y: Update rules. * breakpoint.c (set_breakpoint_condition): Create an innermost_block_tracker. (watch_command_1): Likewise. * ada-lang.c (resolve): Add "tracker" parameter. (resolve_subexp): Likewise. * ada-exp.y (write_var_from_sym): Update.
This commit is contained in:
@@ -880,11 +880,12 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp,
|
||||
{
|
||||
struct watchpoint *w = (struct watchpoint *) b;
|
||||
|
||||
innermost_block_tracker tracker;
|
||||
arg = exp;
|
||||
w->cond_exp = parse_exp_1 (&arg, 0, 0, 0);
|
||||
w->cond_exp = parse_exp_1 (&arg, 0, 0, 0, &tracker);
|
||||
if (*arg)
|
||||
error (_("Junk at end of expression"));
|
||||
w->cond_exp_valid_block = innermost_block.block ();
|
||||
w->cond_exp_valid_block = tracker.block ();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -10603,7 +10604,8 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
|
||||
ARG. */
|
||||
std::string expression (arg, exp_end - arg);
|
||||
exp_start = arg = expression.c_str ();
|
||||
expression_up exp = parse_exp_1 (&arg, 0, 0, 0);
|
||||
innermost_block_tracker tracker;
|
||||
expression_up exp = parse_exp_1 (&arg, 0, 0, 0, &tracker);
|
||||
exp_end = arg;
|
||||
/* Remove trailing whitespace from the expression before saving it.
|
||||
This makes the eventual display of the expression string a bit
|
||||
@@ -10622,7 +10624,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
|
||||
error (_("Cannot watch constant value `%.*s'."), len, exp_start);
|
||||
}
|
||||
|
||||
exp_valid_block = innermost_block.block ();
|
||||
exp_valid_block = tracker.block ();
|
||||
struct value *mark = value_mark ();
|
||||
struct value *val_as_value = nullptr;
|
||||
fetch_subexp_value (exp.get (), &pc, &val_as_value, &result, NULL,
|
||||
@@ -10663,11 +10665,12 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
|
||||
if (toklen >= 1 && strncmp (tok, "if", toklen) == 0)
|
||||
{
|
||||
tok = cond_start = end_tok + 1;
|
||||
parse_exp_1 (&tok, 0, 0, 0);
|
||||
innermost_block_tracker if_tracker;
|
||||
parse_exp_1 (&tok, 0, 0, 0, &if_tracker);
|
||||
|
||||
/* The watchpoint expression may not be local, but the condition
|
||||
may still be. E.g.: `watch global if local > 0'. */
|
||||
cond_exp_valid_block = innermost_block.block ();
|
||||
cond_exp_valid_block = if_tracker.block ();
|
||||
|
||||
cond_end = tok;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user