Don't write to inferior_ptid in tracefile-tfile.c
authorPedro Alves <palves@redhat.com>
Thu, 18 Jun 2020 20:28:23 +0000 (21:28 +0100)
committerPedro Alves <palves@redhat.com>
Thu, 18 Jun 2020 22:06:57 +0000 (23:06 +0100)
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.

gdb/ChangeLog
gdb/tracefile-tfile.c

index 2a082f277b83b8b80af74777225cffd36076667c..4454a58ca67c90874d90a60a55005ea71e7fc43a 100644 (file)
@@ -1,3 +1,10 @@
+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.
+
 2020-06-18  Pedro Alves  <palves@redhat.com>
 
        * procfs.c (procfs_target::attach): Don't write to inferior_ptid.
index ea19177475179f741289353995d82cf858a78e48..fd7bab822a1223f3929044c705a35b0a6ee3b58b 100644 (file)
@@ -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);
This page took 0.032497 seconds and 4 git commands to generate.