summaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authormmetzger <mmetzger>2013-03-11 08:16:58 +0000
committermmetzger <mmetzger>2013-03-11 08:16:58 +0000
commitdbaf4ca0d5082430bed1b81b0a068f5f5c663af1 (patch)
tree202de3153e12adfd0c345afdd9523ac9a0942d70 /gdb/target.c
parentcaac1820ce47e1fb4fc0a850d90235ed2de9021c (diff)
downloadgdb-dbaf4ca0d5082430bed1b81b0a068f5f5c663af1.tar.gz
Add branch trace information to struct thread_info.
Add functions to enable, disable, clear, and fetch a thread's branch trace. gdb/ * target.h: Include btrace.h. (struct target_ops) <to_supports_btrace, to_enable_btrace, to_disable_btrace, to_teardown_btrace, to_read_btrace>: New. * target.c (target_supports_btrace): New function. (target_enable_btrace): New function. (target_disable_btrace): New function. (target_teardown_btrace): New function. (target_read_btrace): New function. * btrace.h: New file. * btrace.c: New file. * Makefile.in: Add btrace.c. * gdbthread.h: Include btrace.h. (struct thread_info): Add btrace field. * thread.c: Include btrace.h. (clear_thread_inferior_resources): Call target_teardown_btrace. * common/btrace-common.h: New file.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 0b4f39d45c4..524caec7122 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -4153,6 +4153,79 @@ target_ranged_break_num_registers (void)
return -1;
}
+/* See target.h. */
+
+int
+target_supports_btrace (void)
+{
+ struct target_ops *t;
+
+ for (t = current_target.beneath; t != NULL; t = t->beneath)
+ if (t->to_supports_btrace != NULL)
+ return t->to_supports_btrace ();
+
+ return 0;
+}
+
+/* See target.h. */
+
+struct btrace_target_info *
+target_enable_btrace (ptid_t ptid)
+{
+ struct target_ops *t;
+
+ for (t = current_target.beneath; t != NULL; t = t->beneath)
+ if (t->to_enable_btrace != NULL)
+ return t->to_enable_btrace (ptid);
+
+ tcomplain ();
+ return NULL;
+}
+
+/* See target.h. */
+
+void
+target_disable_btrace (struct btrace_target_info *btinfo)
+{
+ struct target_ops *t;
+
+ for (t = current_target.beneath; t != NULL; t = t->beneath)
+ if (t->to_disable_btrace != NULL)
+ return t->to_disable_btrace (btinfo);
+
+ tcomplain ();
+}
+
+/* See target.h. */
+
+void
+target_teardown_btrace (struct btrace_target_info *btinfo)
+{
+ struct target_ops *t;
+
+ for (t = current_target.beneath; t != NULL; t = t->beneath)
+ if (t->to_teardown_btrace != NULL)
+ return t->to_teardown_btrace (btinfo);
+
+ tcomplain ();
+}
+
+/* See target.h. */
+
+VEC (btrace_block_s) *
+target_read_btrace (struct btrace_target_info *btinfo,
+ enum btrace_read_type type)
+{
+ struct target_ops *t;
+
+ for (t = current_target.beneath; t != NULL; t = t->beneath)
+ if (t->to_read_btrace != NULL)
+ return t->to_read_btrace (btinfo, type);
+
+ tcomplain ();
+ return NULL;
+}
+
static void
debug_to_prepare_to_store (struct regcache *regcache)
{