From patchwork Wed Apr 3 01:37:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 32140 Received: (qmail 27363 invoked by alias); 3 Apr 2019 01:38:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 27238 invoked by uid 89); 3 Apr 2019 01:38:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=commented, COMPLETE, recognition, Third X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.100) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 03 Apr 2019 01:38:10 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway32.websitewelcome.com (Postfix) with ESMTP id DFB28138F6D for ; Tue, 2 Apr 2019 20:38:08 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id BUquh8Fl2dnCeBUquhxkzN; Tue, 02 Apr 2019 20:38:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Z6kJOe3UCutbm+1qyrhw3fWtwlUDkLG0v9IAMo+TEeI=; b=lR1r2aQqXZkMcrk0pcv1NE47rq f24AUs44Iv92bCWV+5fYEihH8O3a2h7Sry9mBfED02674naPXSQCyOr4tOUp9dQ2WOxq8Ztmvu+6W gnA5p6OZBHFhN70tpvmDBCh3W; Received: from 174-29-37-56.hlrn.qwest.net ([174.29.37.56]:34720 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1hBUqu-002Gj6-KS; Tue, 02 Apr 2019 20:38:08 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 06/13] Move expression_context_* globals to parser_state Date: Tue, 2 Apr 2019 19:37:58 -0600 Message-Id: <20190403013805.11978-7-tom@tromey.com> In-Reply-To: <20190403013805.11978-1-tom@tromey.com> References: <20190403013805.11978-1-tom@tromey.com> This moves the expression_context_block and expression_context_pc globals to be members of parser_state and updates the parsers. 2019-04-02 Tom Tromey * 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) : Add parameters. Initialize new members. : 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. --- gdb/ChangeLog | 23 ++++++++++++++++++++ gdb/ada-exp.y | 7 ++++--- gdb/c-exp.y | 53 ++++++++++++++++++++++++++++------------------- gdb/d-exp.y | 11 +++++----- gdb/f-exp.y | 2 +- gdb/go-exp.y | 6 +++--- gdb/m2-exp.y | 27 ++++++++++++++---------- gdb/p-exp.y | 26 ++++++++++++++--------- gdb/parse.c | 12 +++++------ gdb/parser-defs.h | 29 +++++++++++++++----------- gdb/rust-exp.y | 21 +++++++++++-------- 11 files changed, 136 insertions(+), 81 deletions(-) diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index f1c587a9d74..0cf85c52dd0 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -1203,7 +1203,7 @@ write_var_or_type (struct parser_state *par_state, int name_len; if (block == NULL) - block = expression_context_block; + block = par_state->expression_context_block; encoded_name = ada_encode (name0.ptr); name_len = strlen (encoded_name); @@ -1343,7 +1343,7 @@ write_var_or_type (struct parser_state *par_state, if (!have_full_symbols () && !have_partial_symbols () && block == NULL) error (_("No symbol table is loaded. Use the \"file\" command.")); - if (block == expression_context_block) + if (block == par_state->expression_context_block) error (_("No definition of \"%s\" in current context."), name0.ptr); else error (_("No definition of \"%s\" in specified context."), name0.ptr); @@ -1376,7 +1376,8 @@ write_name_assoc (struct parser_state *par_state, struct stoken name) if (strchr (name.ptr, '.') == NULL) { std::vector syms; - int nsyms = ada_lookup_symbol_list (name.ptr, expression_context_block, + int nsyms = ada_lookup_symbol_list (name.ptr, + par_state->expression_context_block, VAR_DOMAIN, &syms); if (nsyms != 1 || SYMBOL_CLASS (syms[0].symbol) == LOC_TYPEDEF) diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 34e80bfd0bf..e6d6c208f15 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -559,8 +559,8 @@ exp : UNKNOWN_CPP_NAME '(' /* This could potentially be a an argument defined lookup function (Koenig). */ write_exp_elt_opcode (pstate, OP_ADL_FUNC); - write_exp_elt_block (pstate, - expression_context_block); + write_exp_elt_block + (pstate, pstate->expression_context_block); write_exp_elt_sym (pstate, NULL); /* Placeholder. */ write_exp_string (pstate, $1.stoken); @@ -1400,8 +1400,10 @@ typebase NULL, 0); } | STRUCT name - { $$ = lookup_struct (copy_name ($2), - expression_context_block); } + { $$ + = lookup_struct (copy_name ($2), + pstate->expression_context_block); + } | STRUCT COMPLETE { mark_completion_tag (TYPE_CODE_STRUCT, "", 0); @@ -1414,8 +1416,9 @@ typebase $$ = NULL; } | CLASS name - { $$ = lookup_struct (copy_name ($2), - expression_context_block); } + { $$ = lookup_struct + (copy_name ($2), pstate->expression_context_block); + } | CLASS COMPLETE { mark_completion_tag (TYPE_CODE_STRUCT, "", 0); @@ -1428,8 +1431,10 @@ typebase $$ = NULL; } | UNION name - { $$ = lookup_union (copy_name ($2), - expression_context_block); } + { $$ + = lookup_union (copy_name ($2), + pstate->expression_context_block); + } | UNION COMPLETE { mark_completion_tag (TYPE_CODE_UNION, "", 0); @@ -1443,7 +1448,8 @@ typebase } | ENUM name { $$ = lookup_enum (copy_name ($2), - expression_context_block); } + pstate->expression_context_block); + } | ENUM COMPLETE { mark_completion_tag (TYPE_CODE_ENUM, "", 0); @@ -1475,8 +1481,9 @@ typebase reduced; template recognition happens by lookahead in the token processing code in yylex. */ | TEMPLATE name '<' type '>' - { $$ = lookup_template_type(copy_name($2), $4, - expression_context_block); + { $$ = lookup_template_type + (copy_name($2), $4, + pstate->expression_context_block); } | const_or_volatile_or_space_identifier_noopt typebase { $$ = follow_types ($2); } @@ -1733,10 +1740,11 @@ name_not_typename : NAME struct field_of_this_result is_a_field_of_this; $$.stoken = $1; - $$.sym = lookup_symbol ($1.ptr, - expression_context_block, - VAR_DOMAIN, - &is_a_field_of_this); + $$.sym + = lookup_symbol ($1.ptr, + pstate->expression_context_block, + VAR_DOMAIN, + &is_a_field_of_this); $$.is_a_field_of_this = is_a_field_of_this.type != NULL; } @@ -2869,7 +2877,8 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name) { struct field_of_this_result is_a_field_of_this; - if (lookup_symbol (copy, expression_context_block, + if (lookup_symbol (copy, + pstate->expression_context_block, VAR_DOMAIN, (par_state->language ()->la_language == language_cplus ? &is_a_field_of_this @@ -3007,7 +3016,8 @@ classify_name (struct parser_state *par_state, const struct block *block, struct symbol *sym; yylval.theclass.theclass = Class; - sym = lookup_struct_typedef (copy, expression_context_block, 1); + sym = lookup_struct_typedef (copy, + par_state->expression_context_block, 1); if (sym) yylval.theclass.type = SYMBOL_TYPE (sym); return CLASSNAME; @@ -3145,7 +3155,7 @@ yylex (void) name-like token. */ current.token = lex_one_token (pstate, &is_quoted_name); if (current.token == NAME) - current.token = classify_name (pstate, expression_context_block, + current.token = classify_name (pstate, pstate->expression_context_block, is_quoted_name, last_lex_was_structop); if (pstate->language ()->la_language != language_cplus || (current.token != TYPENAME && current.token != COLONCOLON @@ -3191,7 +3201,7 @@ yylex (void) else { gdb_assert (current.token == TYPENAME); - search_block = expression_context_block; + search_block = pstate->expression_context_block; obstack_grow (&name_obstack, current.value.sval.ptr, current.value.sval.length); context_type = current.value.tsym.type; @@ -3288,8 +3298,9 @@ c_parse (struct parser_state *par_state) gdb::unique_xmalloc_ptr macro_scope; - if (expression_context_block) - macro_scope = sal_macro_scope (find_pc_line (expression_context_pc, 0)); + if (par_state->expression_context_block) + macro_scope + = sal_macro_scope (find_pc_line (par_state->expression_context_pc, 0)); else macro_scope = default_macro_scope (); if (! macro_scope) diff --git a/gdb/d-exp.y b/gdb/d-exp.y index 50c8325d46a..a701c2541d3 100644 --- a/gdb/d-exp.y +++ b/gdb/d-exp.y @@ -416,8 +416,8 @@ PrimaryExpression: struct block_symbol sym; /* Handle VAR, which could be local or global. */ - sym = lookup_symbol (copy, expression_context_block, VAR_DOMAIN, - &is_a_field_of_this); + sym = lookup_symbol (copy, pstate->expression_context_block, + VAR_DOMAIN, &is_a_field_of_this); if (sym.symbol && SYMBOL_CLASS (sym.symbol) != LOC_TYPEDEF) { if (symbol_read_needs_frame (sym.symbol)) @@ -1458,7 +1458,7 @@ yylex (void) if (current.token == IDENTIFIER) { yylval = current.value; - current.token = classify_name (pstate, expression_context_block); + current.token = classify_name (pstate, pstate->expression_context_block); current.value = yylval; } @@ -1489,7 +1489,8 @@ yylex (void) yylval.sval.ptr = (char *) obstack_base (&name_obstack); yylval.sval.length = obstack_object_size (&name_obstack); - current.token = classify_name (pstate, expression_context_block); + current.token = classify_name (pstate, + pstate->expression_context_block); current.value = yylval; /* We keep going until we find a TYPENAME. */ @@ -1526,7 +1527,7 @@ yylex (void) else { gdb_assert (current.token == TYPENAME); - search_block = expression_context_block; + search_block = pstate->expression_context_block; obstack_grow (&name_obstack, current.value.sval.ptr, current.value.sval.length); context_type = current.value.tsym.type; diff --git a/gdb/f-exp.y b/gdb/f-exp.y index ca407786080..5670136b2a6 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -1274,7 +1274,7 @@ yylex (void) way we can refer to it unconditionally below. */ memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this)); - result = lookup_symbol (tmp, expression_context_block, + result = lookup_symbol (tmp, pstate->expression_context_block, lookup_domains[i], pstate->language ()->la_language == language_cplus diff --git a/gdb/go-exp.y b/gdb/go-exp.y index 3f564cf6d90..d112a73f21a 100644 --- a/gdb/go-exp.y +++ b/gdb/go-exp.y @@ -1528,14 +1528,14 @@ yylex (void) return classify_unsafe_function (name2.value.sval); } - if (package_name_p (copy, expression_context_block)) + if (package_name_p (copy, pstate->expression_context_block)) { popping = 1; yylval.sval = build_packaged_name (current.value.sval.ptr, current.value.sval.length, name2.value.sval.ptr, name2.value.sval.length); - return classify_packaged_name (expression_context_block); + return classify_packaged_name (pstate->expression_context_block); } } @@ -1549,7 +1549,7 @@ yylex (void) popping = 1; yylval = current.value; - return classify_name (pstate, expression_context_block); + return classify_name (pstate, pstate->expression_context_block); } int diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index 611981fd9c2..c1418c751f1 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -508,7 +508,7 @@ block : fblock fblock : BLOCKNAME { struct symbol *sym = lookup_symbol (copy_name ($1), - expression_context_block, + pstate->expression_context_block, VAR_DOMAIN, 0).symbol; $$ = sym;} ; @@ -561,10 +561,11 @@ variable: NAME { struct block_symbol sym; struct field_of_this_result is_a_field_of_this; - sym = lookup_symbol (copy_name ($1), - expression_context_block, - VAR_DOMAIN, - &is_a_field_of_this); + sym + = lookup_symbol (copy_name ($1), + pstate->expression_context_block, + VAR_DOMAIN, + &is_a_field_of_this); if (sym.symbol) { @@ -596,10 +597,13 @@ variable: NAME type : TYPENAME - { $$ = lookup_typename (pstate->language (), - pstate->gdbarch (), - copy_name ($1), - expression_context_block, 0); } + { $$ + = lookup_typename (pstate->language (), + pstate->gdbarch (), + copy_name ($1), + pstate->expression_context_block, + 0); + } ; @@ -965,12 +969,13 @@ yylex (void) if (lookup_symtab (tmp)) return BLOCKNAME; - sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN, 0).symbol; + sym = lookup_symbol (tmp, 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), - expression_context_block, 1)) + pstate->expression_context_block, 1)) return TYPENAME; if(sym) diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 79b2979f6a7..dbccf358d5c 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -784,11 +784,15 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */ | TYPENAME { $$ = $1.type; } | STRUCT name - { $$ = lookup_struct (copy_name ($2), - expression_context_block); } + { $$ + = lookup_struct (copy_name ($2), + pstate->expression_context_block); + } | CLASS name - { $$ = lookup_struct (copy_name ($2), - expression_context_block); } + { $$ + = lookup_struct (copy_name ($2), + pstate->expression_context_block); + } /* "const" and "volatile" are curently ignored. A type qualifier after the type is handled in the ptype rule. I think these could be too. */ @@ -1463,7 +1467,7 @@ yylex (void) inserted in FPC stabs debug info. */ static const char this_name[] = "this"; - if (lookup_symbol (this_name, expression_context_block, + if (lookup_symbol (this_name, pstate->expression_context_block, VAR_DOMAIN, NULL).symbol) { free (uptokstart); @@ -1513,7 +1517,7 @@ yylex (void) if (is_a_field) sym = NULL; else - sym = lookup_symbol (tmp, expression_context_block, + sym = lookup_symbol (tmp, pstate->expression_context_block, VAR_DOMAIN, &is_a_field_of_this).symbol; /* second chance uppercased (as Free Pascal does). */ if (!sym && is_a_field_of_this.type == NULL && !is_a_field) @@ -1528,7 +1532,7 @@ yylex (void) if (is_a_field) sym = NULL; else - sym = lookup_symbol (tmp, expression_context_block, + sym = lookup_symbol (tmp, pstate->expression_context_block, VAR_DOMAIN, &is_a_field_of_this).symbol; } /* Third chance Capitalized (as GPC does). */ @@ -1550,7 +1554,7 @@ yylex (void) if (is_a_field) sym = NULL; else - sym = lookup_symbol (tmp, expression_context_block, + sym = lookup_symbol (tmp, pstate->expression_context_block, VAR_DOMAIN, &is_a_field_of_this).symbol; } @@ -1645,8 +1649,10 @@ yylex (void) tmp1 += 2; memcpy (tmp1, namestart, p - namestart); tmp1[p - namestart] = '\0'; - cur_sym = lookup_symbol (ncopy, expression_context_block, - VAR_DOMAIN, NULL).symbol; + cur_sym + = lookup_symbol (ncopy, + pstate->expression_context_block, + VAR_DOMAIN, NULL).symbol; if (cur_sym) { if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF) diff --git a/gdb/parse.c b/gdb/parse.c index c4c35176915..d76aeb1d853 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); diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index 5bc9d253d48..f895a552879 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -86,24 +86,29 @@ struct parser_state : public expr_builder And GDBARCH is the gdbarch to use during parsing. */ parser_state (const struct language_defn *lang, - struct gdbarch *gdbarch) - : expr_builder (lang, gdbarch) + struct gdbarch *gdbarch, + const struct block *context_block, + CORE_ADDR context_pc) + : expr_builder (lang, gdbarch), + expression_context_block (context_block), + expression_context_pc (context_pc) { } DISABLE_COPY_AND_ASSIGN (parser_state); -}; -/* If this is nonzero, this block is used as the lexical context - for symbol names. */ + /* If this is nonzero, this block is used as the lexical context for + symbol names. */ -extern const struct block *expression_context_block; + const struct block * const expression_context_block; -/* If expression_context_block is non-zero, then this is the PC within - the block that we want to evaluate expressions at. When debugging - C or C++ code, we use this to find the exact line we're at, and - then look up the macro definitions active at that point. */ -extern CORE_ADDR expression_context_pc; + /* If expression_context_block is non-zero, then this is the PC + within the block that we want to evaluate expressions at. When + debugging C or C++ code, we use this to find the exact line we're + at, and then look up the macro definitions active at that + point. */ + const CORE_ADDR expression_context_pc; +}; /* When parsing expressions we track the innermost block that was referenced. */ @@ -283,7 +288,7 @@ extern void write_exp_elt_objfile (struct expr_builder *, extern void write_exp_msymbol (struct expr_builder *, struct bound_minimal_symbol); -extern void write_dollar_variable (struct expr_builder *, struct stoken str); +extern void write_dollar_variable (struct parser_state *, struct stoken str); extern void mark_struct_expression (struct expr_builder *); diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y index 9b6ca199436..1b7e33e6172 100644 --- a/gdb/rust-exp.y +++ b/gdb/rust-exp.y @@ -1033,7 +1033,7 @@ rust_parser::concat3 (const char *s1, const char *s2, const char *s3) const struct rust_op * rust_parser::crate_name (const struct rust_op *name) { - std::string crate = rust_crate_for_block (expression_context_block); + std::string crate = rust_crate_for_block (pstate->expression_context_block); struct stoken result; gdb_assert (name->opcode == OP_VAR_VALUE); @@ -1053,7 +1053,7 @@ rust_parser::crate_name (const struct rust_op *name) const struct rust_op * rust_parser::super_name (const struct rust_op *ident, unsigned int n_supers) { - const char *scope = block_scope (expression_context_block); + const char *scope = block_scope (pstate->expression_context_block); int offset; gdb_assert (ident->opcode == OP_VAR_VALUE); @@ -2045,7 +2045,7 @@ rust_parser::convert_ast_to_type (const struct rust_op *operation) { const char *varname = convert_name (operation); - result = rust_lookup_type (varname, expression_context_block); + result = rust_lookup_type (varname, pstate->expression_context_block); if (result == NULL) error (_("No typed name '%s' in current context"), varname); return result; @@ -2118,7 +2118,7 @@ rust_parser::convert_ast_to_type (const struct rust_op *operation) /* We don't allow creating new tuple types (yet), but we do allow looking up existing tuple types. */ - result = rust_lookup_type (name, expression_context_block); + result = rust_lookup_type (name, pstate->expression_context_block); if (result == NULL) error (_("could not find tuple type '%s'"), name); } @@ -2311,7 +2311,8 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation, struct type *type; const char *varname = convert_name (operation->left.op); - type = rust_lookup_type (varname, expression_context_block); + type = rust_lookup_type (varname, + pstate->expression_context_block); if (type != NULL) { /* This is actually a tuple struct expression, not a @@ -2372,7 +2373,7 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation, } varname = convert_name (operation); - sym = rust_lookup_symbol (varname, expression_context_block, + sym = rust_lookup_symbol (varname, pstate->expression_context_block, VAR_DOMAIN); if (sym.symbol != NULL && SYMBOL_CLASS (sym.symbol) != LOC_TYPEDEF) { @@ -2391,7 +2392,8 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation, type = SYMBOL_TYPE (sym.symbol); } if (type == NULL) - type = rust_lookup_type (varname, expression_context_block); + type = rust_lookup_type (varname, + pstate->expression_context_block); if (type == NULL) error (_("No symbol '%s' in current context"), varname); @@ -2449,7 +2451,7 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation, } name = convert_name (operation->left.op); - type = rust_lookup_type (name, expression_context_block); + type = rust_lookup_type (name, pstate->expression_context_block); if (type == NULL) error (_("Could not find type '%s'"), operation->left.sval.ptr); @@ -2707,7 +2709,8 @@ rust_lex_tests (void) int i; // Set up dummy "parser", so that rust_type works. - struct parser_state ps (&rust_language_defn, target_gdbarch ()); + struct parser_state ps (&rust_language_defn, target_gdbarch (), + nullptr, 0); rust_parser parser (&ps); rust_lex_test_one (&parser, "", 0);