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:23 -0700
commitf6b4232691d79a9e4b54934529f4b34081d79d94 (patch)
tree1e14c60f34970a1c8b8dc04c19ec60622a91bf64 /gdb/ax-gdb.c
parentcbc18219d313984150f25af6cc66c866e1686190 (diff)
downloadbinutils-f6b4232691d79a9e4b54934529f4b34081d79d94.zip
binutils-f6b4232691d79a9e4b54934529f4b34081d79d94.tar.gz
binutils-f6b4232691d79a9e4b54934529f4b34081d79d94.tar.bz2
Introduce op_this_operation
This adds class op_this_operation, which implements OP_THIS. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class op_this_operation): New. * ax-gdb.c (op_this_operation::do_generate_ax): New method.
Diffstat (limited to 'gdb/ax-gdb.c')
-rw-r--r--gdb/ax-gdb.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 6514e40..98edc6c 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2554,6 +2554,31 @@ unop_memval_type_operation::do_generate_ax (struct expression *exp,
value->kind = axs_lvalue_memory;
}
+void
+op_this_operation::do_generate_ax (struct expression *exp,
+ struct agent_expr *ax,
+ struct axs_value *value,
+ struct type *cast_type)
+{
+ struct symbol *sym, *func;
+ const struct block *b;
+ const struct language_defn *lang;
+
+ b = block_for_pc (ax->scope);
+ func = block_linkage_function (b);
+ lang = language_def (func->language ());
+
+ sym = lookup_language_this (lang, b).symbol;
+ if (!sym)
+ error (_("no `%s' found"), lang->name_of_this ());
+
+ gen_var_ref (ax, value, sym);
+
+ if (value->optimized_out)
+ error (_("`%s' has been optimized out, cannot use"),
+ sym->print_name ());
+}
+
}
/* This handles the middle-to-right-side of code generation for binary