diff options
author | Tom Tromey <tom@tromey.com> | 2019-03-24 11:20:05 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-04-04 19:55:10 -0600 |
commit | 1e58a4a4db997cf09315c22f3da725d1da7f9ee7 (patch) | |
tree | 5166626dc2cad5a02581b158edaa245045922ab9 /gdb/parse.c | |
parent | 37eedb39824dc26c82a92b5515a352d7de0c9b5b (diff) | |
download | fsf-binutils-gdb-1e58a4a4db997cf09315c22f3da725d1da7f9ee7.zip fsf-binutils-gdb-1e58a4a4db997cf09315c22f3da725d1da7f9ee7.tar.gz fsf-binutils-gdb-1e58a4a4db997cf09315c22f3da725d1da7f9ee7.tar.bz2 |
Move expression_context_* globals to parser_state
This moves the expression_context_block and expression_context_pc
globals to be members of parser_state and updates the parsers.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* rust-exp.y (rust_parser::crate_name, rust_parser::super_name)
(rust_parser::convert_ast_to_type)
(rust_parser::convert_ast_to_expression, rust_lex_tests): Update.
* parser-defs.h (struct parser_state) <parser_state>: Add
parameters. Initialize new members.
<expression_context_block, expression_context_pc>: New members.
* parse.c (expression_context_block, expression_context_pc):
Remove globals.
(parse_exp_in_context): Update.
* p-exp.y: Update all rules.
(yylex): Update.
* m2-exp.y: Update all rules.
(yylex): Update.
* go-exp.y (yylex): Update.
* f-exp.y (yylex): Update.
* d-exp.y: Update all rules.
(yylex): Update.
* c-exp.y: Update all rules.
(lex_one_token, classify_name, yylex, c_parse): Update.
* ada-exp.y (write_var_or_type, write_name_assoc): Update.
Diffstat (limited to 'gdb/parse.c')
-rw-r--r-- | gdb/parse.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/parse.c b/gdb/parse.c index c4c3517..d76aeb1 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -66,8 +66,6 @@ const struct exp_descriptor exp_descriptor_standard = }; /* Global variables declared in parser-defs.h (and commented there). */ -const struct block *expression_context_block; -CORE_ADDR expression_context_pc; innermost_block_tracker innermost_block; int arglist_len; static struct type_stack type_stack; @@ -593,7 +591,7 @@ mark_completion_tag (enum type_code tag, const char *ptr, int length) value in the value history, I.e. $$1 */ void -write_dollar_variable (struct expr_builder *ps, struct stoken str) +write_dollar_variable (struct parser_state *ps, struct stoken str) { struct block_symbol sym; struct bound_minimal_symbol msym; @@ -683,7 +681,7 @@ handle_register: str.ptr++; write_exp_string (ps, str); write_exp_elt_opcode (ps, OP_REGISTER); - innermost_block.update (expression_context_block, + innermost_block.update (ps->expression_context_block, INNERMOST_BLOCK_FOR_REGISTERS); return; } @@ -1135,7 +1133,8 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc, scoped_restore save_funcall_chain = make_scoped_restore (&funcall_chain, &funcalls); - expression_context_block = block; + const struct block *expression_context_block = block; + CORE_ADDR expression_context_pc = 0; /* If no context specified, try using the current frame, if any. */ if (!expression_context_block) @@ -1189,7 +1188,8 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc, and others called from *.y) ensure CURRENT_LANGUAGE gets restored to the value matching SELECTED_FRAME as set by get_current_arch. */ - parser_state ps (lang, get_current_arch ()); + parser_state ps (lang, get_current_arch (), expression_context_block, + expression_context_pc); scoped_restore_current_language lang_saver; set_language (lang->la_language); |