aboutsummaryrefslogtreecommitdiff
path: root/gdb/ax-gdb.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-08 07:27:57 -0700
committerTom Tromey <tom@tromey.com>2021-03-08 07:28:24 -0700
commite82a5afcedd98a2ca9c1915bef2938c77e967959 (patch)
tree3fd2cb49eba253dec29d7ae3ace902c11d831cb2 /gdb/ax-gdb.c
parentd9ad79d8800c18b70e90e9672b5085246e4fd537 (diff)
downloadbinutils-e82a5afcedd98a2ca9c1915bef2938c77e967959.zip
binutils-e82a5afcedd98a2ca9c1915bef2938c77e967959.tar.gz
binutils-e82a5afcedd98a2ca9c1915bef2938c77e967959.tar.bz2
Introduce var_value_operation
This adds class var_value_operation, which implements OP_VAR_VALUE. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class var_value_operation): New. * eval.c (var_value_operation::evaluate) (var_value_operation::evaluate_for_address) (var_value_operation::evaluate_with_coercion) (var_value_operation::evaluate_for_sizeof) (var_value_operation::evaluate_for_cast): New methods. * ax-gdb.c (var_value_operation::do_generate_ax): New method.
Diffstat (limited to 'gdb/ax-gdb.c')
-rw-r--r--gdb/ax-gdb.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index e0970e8..bdf4a6d 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2673,6 +2673,26 @@ unop_cast_type_operation::do_generate_ax (struct expression *exp,
std::get<1> (m_storage)->generate_ax (exp, ax, value, value_type (val));
}
+void
+var_value_operation::do_generate_ax (struct expression *exp,
+ struct agent_expr *ax,
+ struct axs_value *value,
+ struct type *cast_type)
+{
+ gen_var_ref (ax, value, std::get<0> (m_storage));
+
+ if (value->optimized_out)
+ error (_("`%s' has been optimized out, cannot use"),
+ std::get<0> (m_storage)->print_name ());
+
+ if (value->type->code () == TYPE_CODE_ERROR)
+ {
+ if (cast_type == nullptr)
+ error_unknown_type (std::get<0> (m_storage)->print_name ());
+ value->type = cast_type;
+ }
+}
+
}
/* This handles the middle-to-right-side of code generation for binary