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:28:34 -0700 |
commit | 3f4a0053d9699d19a0251cd8c87871c65994e8e1 (patch) | |
tree | 34aa44b40bab445276fcc9f688bd64edc579e166 /gdb/ada-lang.c | |
parent | 99a3b1e77b6bd5fdca5874d3276ab9499308bc08 (diff) | |
download | gdb-3f4a0053d9699d19a0251cd8c87871c65994e8e1.zip gdb-3f4a0053d9699d19a0251cd8c87871c65994e8e1.tar.gz gdb-3f4a0053d9699d19a0251cd8c87871c65994e8e1.tar.bz2 |
Introduce ada_var_msym_value_operation
This adds class ada_var_msym_value_operation, which implements
OP_VAR_MSYM_VALUE for Ada.
gdb/ChangeLog
2021-03-08 Tom Tromey <tom@tromey.com>
* ada-lang.c (ada_var_msym_value_operation::evaluate_for_cast):
New method.
* ada-exp.h (class ada_var_msym_value_operation): New.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index ee8e8e1..eb21748 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -10554,6 +10554,31 @@ ada_unop_atr_operation::evaluate (struct type *expect_type, } value * +ada_var_msym_value_operation::evaluate_for_cast (struct type *expect_type, + struct expression *exp, + enum noside noside) +{ + if (noside == EVAL_AVOID_SIDE_EFFECTS) + return value_zero (expect_type, not_lval); + + value *val = evaluate_var_msym_value (noside, + std::get<1> (m_storage), + std::get<0> (m_storage)); + + val = ada_value_cast (expect_type, val); + + /* Follow the Ada language semantics that do not allow taking + an address of the result of a cast (view conversion in Ada). */ + if (VALUE_LVAL (val) == lval_memory) + { + if (value_lazy (val)) + value_fetch_lazy (val); + VALUE_LVAL (val) = not_lval; + } + return val; +} + +value * ada_var_value_operation::evaluate_for_cast (struct type *expect_type, struct expression *exp, enum noside noside) |