[PATCH 23/28] Don't write to inferior_ptid in remote-sim.c
Pedro Alves
palves@redhat.com
Tue Apr 14 17:54:29 GMT 2020
gdb/ChangeLog:
yyyy-mm-dd 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::wait): Don't write to inferior_ptid.
---
gdb/remote-sim.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index da1ee96519..9af6486bca 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -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. */
@@ -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)
--
2.14.5
More information about the Gdb-patches
mailing list