+2020-06-18 Pedro Alves <palves@redhat.com>
+
+ * procfs.c (procfs_target::attach): Don't write to inferior_ptid.
+ (procfs_target::detach): Use switch_to_no_thread
+ instead of writing to inferior_ptid directly.
+ (do_attach): Change return type to void. Switch to the added
+ thread.
+ (procfs_target::create_inferior): Switch to the added thread.
+ (procfs_do_thread_registers): Don't write to inferior_ptid.
+
2020-06-18 Pedro Alves <palves@redhat.com>
* infrun.c (generic_mourn_inferior): Use switch_to_thread instead
/* Here are all of the gdb target vector functions and their
friends. */
-static ptid_t do_attach (ptid_t ptid);
+static void do_attach (ptid_t ptid);
static void do_detach ();
static void proc_trace_syscalls_1 (procinfo *pi, int syscallnum,
int entry_or_exit, int mode, int from_tty);
fflush (stdout);
}
- inferior_ptid = do_attach (ptid_t (pid));
+ do_attach (ptid_t (pid));
if (!target_is_pushed (this))
push_target (this);
}
do_detach ();
- inferior_ptid = null_ptid;
+ switch_to_no_thread ();
detach_inferior (inf);
maybe_unpush_target ();
}
-static ptid_t
+static void
do_attach (ptid_t ptid)
{
procinfo *pi;
/* Add it to gdb's thread list. */
ptid = ptid_t (pi->pid, lwpid, 0);
- add_thread (&the_procfs_target, ptid);
-
- return ptid;
+ thread_info *thr = add_thread (&the_procfs_target, ptid);
+ switch_to_thread (thr);
}
static void
/* We have something that executes now. We'll be running through
the shell at this point (if startup-with-shell is true), but the
pid shouldn't change. */
- add_thread_silent (this, ptid_t (pid));
+ thread_info *thr = add_thread_silent (this, ptid_t (pid));
+ switch_to_thread (thr);
procfs_init_inferior (pid);
}
once it is implemented in this platform:
gdbarch_iterate_over_regset_sections(). */
- scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
- inferior_ptid = ptid;
target_fetch_registers (regcache, -1);
fill_gregset (regcache, &gregs, -1);