aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2013-03-18 16:43:05 +0100
committerMarkus Metzger <markus.t.metzger@intel.com>2014-01-16 13:06:11 +0100
commitea001bdce2a4442eb556c64514c8ec2473f4c4d1 (patch)
treea6ce37546ce38cd0351143becd63b74fdf543a63 /gdb/target.c
parent1f3ef5810cab04310a11d4d561a4f32329dfb002 (diff)
downloadgdb-ea001bdce2a4442eb556c64514c8ec2473f4c4d1.zip
gdb-ea001bdce2a4442eb556c64514c8ec2473f4c4d1.tar.gz
gdb-ea001bdce2a4442eb556c64514c8ec2473f4c4d1.tar.bz2
frame, backtrace: allow targets to supply a frame unwinder
Allow targets to supply their own target-specific frame unwinders; one for normal frames and one for tailcall frames. If a target-specific unwinder is supplied, it will be chosen before any other unwinder. The original patch has been split into this and the next two patches. gdb/ 2013-02-11 Jan Kratochvil <jan.kratochvil@redhat.com> * frame-unwind.c: Include target.h. (frame_unwind_try_unwinder): New function with code from ... (frame_unwind_find_by_frame): ... here. New variable unwinder_from_target, call also target_get_unwinder) (target_get_tailcall_unwinder, and frame_unwind_try_unwinder for it. * target.c (target_get_unwinder, target_get_tailcall_unwinder): New. * target.h (struct target_ops): New fields to_get_unwinder and to_get_tailcall_unwinder. (target_get_unwinder, target_get_tailcall_unwinder): New declarations.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gdb/target.c b/gdb/target.c
index bfb0633..5e84288 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -4471,6 +4471,34 @@ debug_to_prepare_to_store (struct target_ops *self, struct regcache *regcache)
fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n");
}
+/* See target.h. */
+
+const struct frame_unwind *
+target_get_unwinder (void)
+{
+ struct target_ops *t;
+
+ for (t = current_target.beneath; t != NULL; t = t->beneath)
+ if (t->to_get_unwinder != NULL)
+ return t->to_get_unwinder;
+
+ return NULL;
+}
+
+/* See target.h. */
+
+const struct frame_unwind *
+target_get_tailcall_unwinder (void)
+{
+ struct target_ops *t;
+
+ for (t = current_target.beneath; t != NULL; t = t->beneath)
+ if (t->to_get_tailcall_unwinder != NULL)
+ return t->to_get_tailcall_unwinder;
+
+ return NULL;
+}
+
static int
deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len,
int write, struct mem_attrib *attrib,