aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r--gdb/gdbarch.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index e1766d3..ee41d50 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -317,6 +317,9 @@ struct gdbarch
gdbarch_core_info_proc_ftype *core_info_proc;
gdbarch_iterate_over_objfiles_in_search_order_ftype *iterate_over_objfiles_in_search_order;
struct ravenscar_arch_ops * ravenscar_ops;
+ gdbarch_insn_is_call_ftype *insn_is_call;
+ gdbarch_insn_is_ret_ftype *insn_is_ret;
+ gdbarch_insn_is_jump_ftype *insn_is_jump;
};
@@ -490,6 +493,9 @@ struct gdbarch startup_gdbarch =
0, /* core_info_proc */
default_iterate_over_objfiles_in_search_order, /* iterate_over_objfiles_in_search_order */
NULL, /* ravenscar_ops */
+ default_insn_is_call, /* insn_is_call */
+ default_insn_is_ret, /* insn_is_ret */
+ default_insn_is_jump, /* insn_is_jump */
/* startup_gdbarch() */
};
@@ -581,6 +587,9 @@ gdbarch_alloc (const struct gdbarch_info *info,
gdbarch->gen_return_address = default_gen_return_address;
gdbarch->iterate_over_objfiles_in_search_order = default_iterate_over_objfiles_in_search_order;
gdbarch->ravenscar_ops = NULL;
+ gdbarch->insn_is_call = default_insn_is_call;
+ gdbarch->insn_is_ret = default_insn_is_ret;
+ gdbarch->insn_is_jump = default_insn_is_jump;
/* gdbarch_alloc() */
return gdbarch;
@@ -795,6 +804,9 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of core_info_proc, has predicate. */
/* Skip verify of iterate_over_objfiles_in_search_order, invalid_p == 0 */
/* Skip verify of ravenscar_ops, invalid_p == 0 */
+ /* Skip verify of insn_is_call, invalid_p == 0 */
+ /* Skip verify of insn_is_ret, invalid_p == 0 */
+ /* Skip verify of insn_is_jump, invalid_p == 0 */
buf = ui_file_xstrdup (log, &length);
make_cleanup (xfree, buf);
if (length > 0)
@@ -1128,6 +1140,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: inner_than = <%s>\n",
host_address_to_string (gdbarch->inner_than));
fprintf_unfiltered (file,
+ "gdbarch_dump: insn_is_call = <%s>\n",
+ host_address_to_string (gdbarch->insn_is_call));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: insn_is_jump = <%s>\n",
+ host_address_to_string (gdbarch->insn_is_jump));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: insn_is_ret = <%s>\n",
+ host_address_to_string (gdbarch->insn_is_ret));
+ fprintf_unfiltered (file,
"gdbarch_dump: int_bit = %s\n",
plongest (gdbarch->int_bit));
fprintf_unfiltered (file,
@@ -4451,6 +4472,57 @@ set_gdbarch_ravenscar_ops (struct gdbarch *gdbarch,
gdbarch->ravenscar_ops = ravenscar_ops;
}
+int
+gdbarch_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->insn_is_call != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_insn_is_call called\n");
+ return gdbarch->insn_is_call (gdbarch, addr);
+}
+
+void
+set_gdbarch_insn_is_call (struct gdbarch *gdbarch,
+ gdbarch_insn_is_call_ftype insn_is_call)
+{
+ gdbarch->insn_is_call = insn_is_call;
+}
+
+int
+gdbarch_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->insn_is_ret != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_insn_is_ret called\n");
+ return gdbarch->insn_is_ret (gdbarch, addr);
+}
+
+void
+set_gdbarch_insn_is_ret (struct gdbarch *gdbarch,
+ gdbarch_insn_is_ret_ftype insn_is_ret)
+{
+ gdbarch->insn_is_ret = insn_is_ret;
+}
+
+int
+gdbarch_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->insn_is_jump != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_insn_is_jump called\n");
+ return gdbarch->insn_is_jump (gdbarch, addr);
+}
+
+void
+set_gdbarch_insn_is_jump (struct gdbarch *gdbarch,
+ gdbarch_insn_is_jump_ftype insn_is_jump)
+{
+ gdbarch->insn_is_jump = insn_is_jump;
+}
+
/* Keep a registry of per-architecture data-pointers required by GDB
modules. */