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:16 -0700
commit55bdbff857f80da9e3464968f1ada2be3484fcf9 (patch)
tree64222256f769da20623e489abd09751792736747 /gdb/ax-gdb.c
parent247d935b83da28edeb0894f5425190d92a2e786a (diff)
downloadgdb-55bdbff857f80da9e3464968f1ada2be3484fcf9.zip
gdb-55bdbff857f80da9e3464968f1ada2be3484fcf9.tar.gz
gdb-55bdbff857f80da9e3464968f1ada2be3484fcf9.tar.bz2
Introduce register_operation
This adds class register_operation, which implements OP_REGISTER. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class register_operation): New. * eval.c (eval_op_register): No longer static. * ax-gdb.c (register_operation::do_generate_ax): New method.
Diffstat (limited to 'gdb/ax-gdb.c')
-rw-r--r--gdb/ax-gdb.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 6028170..5ffe5a0 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2341,6 +2341,30 @@ var_msym_value_operation::do_generate_ax (struct expression *exp,
}
}
+void
+register_operation::do_generate_ax (struct expression *exp,
+ struct agent_expr *ax,
+ struct axs_value *value,
+ struct type *cast_type)
+{
+ const char *name = std::get<0> (m_storage).c_str ();
+ int len = std::get<0> (m_storage).size ();
+ int reg;
+
+ reg = user_reg_map_name_to_regnum (ax->gdbarch, name, len);
+ if (reg == -1)
+ internal_error (__FILE__, __LINE__,
+ _("Register $%s not available"), name);
+ /* No support for tracing user registers yet. */
+ if (reg >= gdbarch_num_cooked_regs (ax->gdbarch))
+ error (_("'%s' is a user-register; "
+ "GDB cannot yet trace user-register contents."),
+ name);
+ value->kind = axs_lvalue_register;
+ value->u.reg = reg;
+ value->type = register_type (ax->gdbarch, reg);
+}
+
}
/* This handles the middle-to-right-side of code generation for binary