]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Don't write to inferior_ptid in tracectf.c
authorPedro Alves <palves@redhat.com>
Thu, 18 Jun 2020 20:28:24 +0000 (21:28 +0100)
committerPedro Alves <palves@redhat.com>
Thu, 18 Jun 2020 22:07:35 +0000 (23:07 +0100)
gdb/ChangeLog:
2020-06-18  Pedro Alves  <palves@redhat.com>

* tracectf.c (ctf_target_open): Switch to added thread instead of
writing to inferior_ptid directly.
(ctf_target::close): Use switch_to_no_thread instead of writing to
inferior_ptid directly.

gdb/ChangeLog
gdb/tracectf.c

index 4454a58ca67c90874d90a60a55005ea71e7fc43a..b02a57624194b275c7f7f2fc9a5ec8033fbd3f56 100644 (file)
@@ -1,3 +1,10 @@
+2020-06-18  Pedro Alves  <palves@redhat.com>
+
+       * tracectf.c (ctf_target_open): Switch to added thread instead of
+       writing to inferior_ptid directly.
+       (ctf_target::close): Use switch_to_no_thread instead of writing to
+       inferior_ptid directly.
+
 2020-06-18  Pedro Alves  <palves@redhat.com>
 
        * tracefile-tfile.c (tfile_target_open): Don't write to
index 1c7003c2c9a9707cde84672dc8fdd131d36dffdd..2c9a7495bfad0c1b48850e27a835424b4c51be91 100644 (file)
@@ -1168,8 +1168,9 @@ ctf_target_open (const char *dirname, int from_tty)
   push_target (&ctf_ops);
 
   inferior_appeared (current_inferior (), CTF_PID);
-  inferior_ptid = ptid_t (CTF_PID);
-  add_thread_silent (&ctf_ops, inferior_ptid);
+
+  thread_info *thr = add_thread_silent (&ctf_ops, ptid_t (CTF_PID));
+  switch_to_thread (thr);
 
   merge_uploaded_trace_state_variables (&uploaded_tsvs);
   merge_uploaded_tracepoints (&uploaded_tps);
@@ -1187,7 +1188,7 @@ ctf_target::close ()
   xfree (trace_dirname);
   trace_dirname = NULL;
 
-  inferior_ptid = null_ptid;   /* Avoid confusion from thread stuff.  */
+  switch_to_no_thread ();      /* Avoid confusion from thread stuff.  */
   exit_inferior_silent (current_inferior ());
 
   trace_reset_local_state ();