summaryrefslogtreecommitdiff
path: root/gdb/tracefile-tfile.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2020-06-18 21:28:23 +0100
committerPedro Alves <palves@redhat.com>2020-06-18 23:06:57 +0100
commit087e161b3cd9a8626dc05ce1bdb8dfaf353a71b1 (patch)
tree3b10111c34758633b1742444a93c1102503bd842 /gdb/tracefile-tfile.c
parent7fb43e53d57d5d1c47fad8a2dece7b90d20b3fd3 (diff)
downloadbinutils-gdb-087e161b3cd9a8626dc05ce1bdb8dfaf353a71b1.tar.gz
Don't write to inferior_ptid in tracefile-tfile.c
gdb/ChangeLog: 2020-06-18 Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_target_open): Don't write to inferior_ptid directly, instead switch to added thread. (tfile_target::close): Use switch_to_no_thread instead of writing to inferior_ptid directly.
Diffstat (limited to 'gdb/tracefile-tfile.c')
-rw-r--r--gdb/tracefile-tfile.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index ea191774751..fd7bab822a1 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -556,8 +556,9 @@ tfile_target_open (const char *arg, int from_tty)
}
inferior_appeared (current_inferior (), TFILE_PID);
- inferior_ptid = ptid_t (TFILE_PID);
- add_thread_silent (&tfile_ops, inferior_ptid);
+
+ thread_info *thr = add_thread_silent (&tfile_ops, ptid_t (TFILE_PID));
+ switch_to_thread (thr);
if (ts->traceframe_count <= 0)
warning (_("No traceframes present in this file."));
@@ -618,7 +619,7 @@ tfile_target::close ()
{
gdb_assert (trace_fd != -1);
- inferior_ptid = null_ptid; /* Avoid confusion from thread stuff. */
+ switch_to_no_thread (); /* Avoid confusion from thread stuff. */
exit_inferior_silent (current_inferior ());
::close (trace_fd);