summaryrefslogtreecommitdiff
path: root/gdb/record-btrace.c
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2016-11-30 11:05:38 +0100
committerMarkus Metzger <markus.t.metzger@intel.com>2017-02-01 14:37:07 +0100
commitcd4007e43421a2f974f51574b6e2b52b9b1a7a50 (patch)
treeaf9f62f65a58aa8966041b743d645248778dd457 /gdb/record-btrace.c
parentcf77c34ea71c27c3cb6dd31c9448249276e8a8a6 (diff)
btrace: allow recording to be started (and stopped) for running threads
When recording is started for a running thread, GDB was able to start tracing but then failed to read registers to insert the initial entry for the current PC. We don't really need that initial entry if we don't know where exactly we started recording. Skip that step to allow recording to be started while threads are running. If we do run into errors, we need to undo the tracing enable to not leak this thread. The operation did not complete so our caller won't clean up this thread. For the BTRACE_FORMAT_PT btrace format, we don't need that initial entry since it will be recorded in the trace. We can omit the call to btrace_add_pc. gdb/ * btrace.c (btrace_enable): Do not call btrace_add_pc for BTRACE_FORMAT_PT or if can_access_registers_ptid returns false. (btrace_fetch): Assert can_access_registers_ptid. * record-btrace.c (require_btrace_thread, record_btrace_info): Call validate_registers_access. testsuite/ * gdb.btrace/enable-running.c: New. * gdb.btrace/enable-running.exp: New.
Diffstat (limited to 'gdb/record-btrace.c')
-rw-r--r--gdb/record-btrace.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 8896241d88..ee0d22c375 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -117,6 +117,8 @@ require_btrace_thread (void)
if (tp == NULL)
error (_("No thread."));
+ validate_registers_access ();
+
btrace_fetch (tp);
if (btrace_is_empty (tp))
@@ -417,6 +419,8 @@ record_btrace_info (struct target_ops *self)
if (tp == NULL)
error (_("No thread."));
+ validate_registers_access ();
+
btinfo = &tp->btrace;
conf = btrace_conf (btinfo);