diff options
author | Tom Tromey <tom@tromey.com> | 2021-03-08 07:27:57 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2021-03-08 07:27:57 -0700 |
commit | 50b98adc3ce99a89bf3ca14cf90ff30e905440b5 (patch) | |
tree | 30f11b5e3314f61bdaf6a71ff22a45210a07ab21 /gdb/eval.c | |
parent | ea2d29f7bccc5221c5ad43e3a90464623b5ec807 (diff) | |
download | binutils-50b98adc3ce99a89bf3ca14cf90ff30e905440b5.zip binutils-50b98adc3ce99a89bf3ca14cf90ff30e905440b5.tar.gz binutils-50b98adc3ce99a89bf3ca14cf90ff30e905440b5.tar.bz2 |
Split out eval_op_var_entry_value
This splits OP_VAR_ENTRY_VALUE into a new function for future use.
gdb/ChangeLog
2021-03-08 Tom Tromey <tom@tromey.com>
* eval.c (eval_op_var_entry_value): New function.
(evaluate_subexp_standard): Use it.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r-- | gdb/eval.c | 34 |
1 files changed, 21 insertions, 13 deletions
@@ -1198,6 +1198,26 @@ eval_op_scope (struct type *expect_type, struct expression *exp, return arg1; } +/* Helper function that implements the body of OP_VAR_ENTRY_VALUE. */ + +static struct value * +eval_op_var_entry_value (struct type *expect_type, struct expression *exp, + enum noside noside, symbol *sym) +{ + if (noside == EVAL_SKIP) + return eval_skip_value (exp); + if (noside == EVAL_AVOID_SIDE_EFFECTS) + return value_zero (SYMBOL_TYPE (sym), not_lval); + + if (SYMBOL_COMPUTED_OPS (sym) == NULL + || SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry == NULL) + error (_("Symbol \"%s\" does not have any specific entry value"), + sym->print_name ()); + + struct frame_info *frame = get_selected_frame (NULL); + return SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry (sym, frame); +} + struct value * evaluate_subexp_standard (struct type *expect_type, struct expression *exp, int *pos, @@ -1273,23 +1293,11 @@ evaluate_subexp_standard (struct type *expect_type, case OP_VAR_ENTRY_VALUE: (*pos) += 2; - if (noside == EVAL_SKIP) - return eval_skip_value (exp); { struct symbol *sym = exp->elts[pc + 1].symbol; - struct frame_info *frame; - - if (noside == EVAL_AVOID_SIDE_EFFECTS) - return value_zero (SYMBOL_TYPE (sym), not_lval); - - if (SYMBOL_COMPUTED_OPS (sym) == NULL - || SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry == NULL) - error (_("Symbol \"%s\" does not have any specific entry value"), - sym->print_name ()); - frame = get_selected_frame (NULL); - return SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry (sym, frame); + return eval_op_var_entry_value (expect_type, exp, noside, sym); } case OP_FUNC_STATIC_VAR: |