summaryrefslogtreecommitdiff
path: root/gdb/record-btrace.c
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2015-08-27 16:24:38 +0200
committerMarkus Metzger <markus.t.metzger@intel.com>2015-09-18 14:25:39 +0200
commita6b5be76f94664406def040d79ac8bc4d4aa8bd0 (patch)
tree99c18650842cebe60a97d8e9c2e371915db6d83c /gdb/record-btrace.c
parentec71cc2fc6d319ebe4aebbe65a6a56ea1376200e (diff)
btrace: async
The record btrace target runs synchronous with GDB. That is, GDB steps resumed threads in record btrace's to_wait method. Without GDB calling to_wait, nothing happens 'on the target'. Check for further expected events in to_wait before reporting the current event and mark record btrace's async event handler in async mode. gdb/ * record-btrace.c (record_btrace_maybe_mark_async_event): New. (record_btrace_wait): Call record_btrace_maybe_mark_async_event.
Diffstat (limited to 'gdb/record-btrace.c')
-rw-r--r--gdb/record-btrace.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 0514471a74..764b349cf4 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -2240,6 +2240,29 @@ record_btrace_step_thread (struct thread_info *tp)
typedef struct thread_info * tp_t;
DEF_VEC_P (tp_t);
+/* Announce further events if necessary. */
+
+static void
+record_btrace_maybe_mark_async_event (const VEC (tp_t) *moving,
+ const VEC (tp_t) *no_history)
+{
+ int more_moving, more_no_history;
+
+ more_moving = !VEC_empty (tp_t, moving);
+ more_no_history = !VEC_empty (tp_t, no_history);
+
+ if (!more_moving && !more_no_history)
+ return;
+
+ if (more_moving)
+ DEBUG ("movers pending");
+
+ if (more_no_history)
+ DEBUG ("no-history pending");
+
+ mark_async_event_handler (record_btrace_async_inferior_event_handler);
+}
+
/* The to_wait method of target record-btrace. */
static ptid_t
@@ -2355,6 +2378,10 @@ record_btrace_wait (struct target_ops *ops, ptid_t ptid,
ALL_NON_EXITED_THREADS (tp)
record_btrace_cancel_resume (tp);
+ /* In async mode, we need to announce further events. */
+ if (target_is_async_p ())
+ record_btrace_maybe_mark_async_event (moving, no_history);
+
/* Start record histories anew from the current position. */
record_btrace_clear_histories (&eventing->btrace);