aboutsummaryrefslogtreecommitdiff
path: root/gdb/target-delegates.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2014-01-16 13:00:07 -0700
committerTom Tromey <tromey@redhat.com>2014-02-19 07:48:49 -0700
commitac01945bf17f3699de5493da23f14ea92549617a (patch)
tree3571a0ad55eb48e0d07f9fd2b5e04f55a3162716 /gdb/target-delegates.c
parent8476dc92e4d8f8e8ebcdbaf0080b70876dfcfb27 (diff)
downloadgdb-ac01945bf17f3699de5493da23f14ea92549617a.zip
gdb-ac01945bf17f3699de5493da23f14ea92549617a.tar.gz
gdb-ac01945bf17f3699de5493da23f14ea92549617a.tar.bz2
convert to_get_unwinder and to_get_tailcall_unwinder to methods
This converts to_get_unwinder and to_get_tailcall_unwinder to methods and arranges for them to use the new delegation scheme. This just lets us avoid having a differing style (neither new-style nor INHERIT) of delegation in the tree. 2014-02-19 Tom Tromey <tromey@redhat.com> * target.c (target_get_unwinder): Rewrite. (target_get_tailcall_unwinder): Rewrite. * record-btrace.c (record_btrace_to_get_unwinder): New function. (record_btrace_to_get_tailcall_unwinder): New function. (init_record_btrace_ops): Update. * target.h (struct target_ops) <to_get_unwinder, to_get_tailcall_unwinder>: Now function pointers. Use TARGET_DEFAULT_RETURN.
Diffstat (limited to 'gdb/target-delegates.c')
-rw-r--r--gdb/target-delegates.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 04824f2..5b27b59 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -1572,6 +1572,32 @@ tdefault_augmented_libraries_svr4_read (struct target_ops *self)
return 0;
}
+static const struct frame_unwind *
+delegate_get_unwinder (struct target_ops *self)
+{
+ self = self->beneath;
+ return self->to_get_unwinder (self);
+}
+
+static const struct frame_unwind *
+tdefault_get_unwinder (struct target_ops *self)
+{
+ return NULL;
+}
+
+static const struct frame_unwind *
+delegate_get_tailcall_unwinder (struct target_ops *self)
+{
+ self = self->beneath;
+ return self->to_get_tailcall_unwinder (self);
+}
+
+static const struct frame_unwind *
+tdefault_get_tailcall_unwinder (struct target_ops *self)
+{
+ return NULL;
+}
+
static CORE_ADDR
delegate_decr_pc_after_break (struct target_ops *self, struct gdbarch *arg1)
{
@@ -1844,6 +1870,10 @@ install_delegators (struct target_ops *ops)
ops->to_call_history_range = delegate_call_history_range;
if (ops->to_augmented_libraries_svr4_read == NULL)
ops->to_augmented_libraries_svr4_read = delegate_augmented_libraries_svr4_read;
+ if (ops->to_get_unwinder == NULL)
+ ops->to_get_unwinder = delegate_get_unwinder;
+ if (ops->to_get_tailcall_unwinder == NULL)
+ ops->to_get_tailcall_unwinder = delegate_get_tailcall_unwinder;
if (ops->to_decr_pc_after_break == NULL)
ops->to_decr_pc_after_break = delegate_decr_pc_after_break;
}
@@ -1982,5 +2012,7 @@ install_dummy_methods (struct target_ops *ops)
ops->to_call_history_from = tdefault_call_history_from;
ops->to_call_history_range = tdefault_call_history_range;
ops->to_augmented_libraries_svr4_read = tdefault_augmented_libraries_svr4_read;
+ ops->to_get_unwinder = tdefault_get_unwinder;
+ ops->to_get_tailcall_unwinder = tdefault_get_tailcall_unwinder;
ops->to_decr_pc_after_break = default_target_decr_pc_after_break;
}