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

* remote-sim.c (gdbsim_target::create_inferior): Switch to thread
after creating it, instead of writing to inferior_ptid.
(gdbsim_target_open): Use switch_to_no_thread instead of writing
to inferior_ptid directly.
(gdbsim_target::wait): Don't write to inferior_ptid.

gdb/ChangeLog
gdb/remote-sim.c

index 334c227574be6d1328990cda368e8166f54cfb69..2d99bf3f22306542b23a413d769960298175c916 100644 (file)
@@ -1,3 +1,11 @@
+2020-06-18  Pedro Alves  <palves@redhat.com>
+
+       * remote-sim.c (gdbsim_target::create_inferior): Switch to thread
+       after creating it, instead of writing to inferior_ptid.
+       (gdbsim_target_open): Use switch_to_no_thread instead of writing
+       to inferior_ptid directly.
+       (gdbsim_target::wait): Don't write to inferior_ptid.
+
 2020-06-18  Pedro Alves  <palves@redhat.com>
 
        * remote.c (remote_target::remote_notice_new_inferior): Use
index 347dfd70131b03888bc9dd4faa6092063645d47e..9af6486bca8f4861261259724d1367be5c34674d 100644 (file)
@@ -653,9 +653,10 @@ gdbsim_target::create_inferior (const char *exec_file,
       != SIM_RC_OK)
     error (_("Unable to create sim inferior."));
 
-  inferior_ptid = sim_data->remote_sim_ptid;
-  inferior_appeared (current_inferior (), inferior_ptid.pid ());
-  add_thread_silent (this, inferior_ptid);
+  inferior_appeared (current_inferior (),
+                    sim_data->remote_sim_ptid.pid ());
+  thread_info *thr = add_thread_silent (this, sim_data->remote_sim_ptid);
+  switch_to_thread (thr);
 
   insert_breakpoints ();       /* Needed to get correct instruction
                                   in cache.  */
@@ -761,7 +762,7 @@ gdbsim_target_open (const char *args, int from_tty)
 
   /* There's nothing running after "target sim" or "load"; not until
      "run".  */
-  inferior_ptid = null_ptid;
+  switch_to_no_thread ();
 
   gdbsim_is_open = 1;
 }
@@ -945,7 +946,6 @@ gdbsim_target::wait (ptid_t ptid, struct target_waitstatus *status, int options)
       if (sim_data == NULL)
        error (_("Unable to wait for pid %d.  Inferior not found."),
               ptid.pid ());
-      inferior_ptid = ptid;
     }
 
   if (remote_debug)