mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-01 05:55:23 +08:00
Don't write to inferior_ptid in nto-procfs.c
A best effort patch, which fixes some bit rot and removes some inferior_ptid references -- this port clearly hasn't been built in a long while. gdb/ChangeLog: 2020-06-18 Pedro Alves <palves@redhat.com> * nto-procfs.c (nto_procfs_target::update_thread_list): Avoid inferior_ptid. (nto_procfs_target::attach): Avoid inferior_ptid. Switch to thread. (nto_procfs_target::detach): Avoid referencing inferior_ptid. Use switch_to_no_thread instead of writing to inferior_ptid directly. (nto_procfs_target::mourn_inferior): Use switch_to_no_thread instead of writing to inferior_ptid directly. (nto_procfs_target::create_inferior): Avoid inferior_ptid. Switch to thread.
This commit is contained in:
parent
191f02e593
commit
ebe84f23d2
@ -1,3 +1,17 @@
|
|||||||
|
2020-06-18 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
|
* nto-procfs.c (nto_procfs_target::update_thread_list): Avoid
|
||||||
|
inferior_ptid.
|
||||||
|
(nto_procfs_target::attach): Avoid inferior_ptid. Switch to
|
||||||
|
thread.
|
||||||
|
(nto_procfs_target::detach): Avoid referencing
|
||||||
|
inferior_ptid. Use switch_to_no_thread instead of writing to
|
||||||
|
inferior_ptid directly.
|
||||||
|
(nto_procfs_target::mourn_inferior): Use switch_to_no_thread
|
||||||
|
instead of writing to inferior_ptid directly.
|
||||||
|
(nto_procfs_target::create_inferior): Avoid inferior_ptid. Switch
|
||||||
|
to thread.
|
||||||
|
|
||||||
2020-06-18 Pedro Alves <palves@redhat.com>
|
2020-06-18 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
* remote-sim.c (gdbsim_target::create_inferior): Switch to thread
|
* remote-sim.c (gdbsim_target::create_inferior): Switch to thread
|
||||||
|
@ -393,7 +393,7 @@ nto_procfs_target::update_thread_list ()
|
|||||||
|
|
||||||
prune_threads ();
|
prune_threads ();
|
||||||
|
|
||||||
pid = inferior_ptid.pid ();
|
pid = current_inferior ()->pid;
|
||||||
|
|
||||||
status.tid = 1;
|
status.tid = 1;
|
||||||
|
|
||||||
@ -712,7 +712,7 @@ nto_procfs_target::attach (const char *args, int from_tty)
|
|||||||
printf_unfiltered ("Attaching to %s\n",
|
printf_unfiltered ("Attaching to %s\n",
|
||||||
target_pid_to_str (ptid_t (pid)).c_str ());
|
target_pid_to_str (ptid_t (pid)).c_str ());
|
||||||
}
|
}
|
||||||
inferior_ptid = do_attach (ptid_t (pid));
|
ptid_t ptid = do_attach (ptid_t (pid));
|
||||||
inf = current_inferior ();
|
inf = current_inferior ();
|
||||||
inferior_appeared (inf, pid);
|
inferior_appeared (inf, pid);
|
||||||
inf->attach_flag = 1;
|
inf->attach_flag = 1;
|
||||||
@ -720,7 +720,9 @@ nto_procfs_target::attach (const char *args, int from_tty)
|
|||||||
if (!target_is_pushed (ops))
|
if (!target_is_pushed (ops))
|
||||||
push_target (ops);
|
push_target (ops);
|
||||||
|
|
||||||
procfs_update_thread_list (ops);
|
update_thread_list ();
|
||||||
|
|
||||||
|
switch_to_thread (find_thread_ptid (this, ptid));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1000,19 +1002,16 @@ nto_procfs_target::xfer_partial (enum target_object object,
|
|||||||
void
|
void
|
||||||
nto_procfs_target::detach (inferior *inf, int from_tty)
|
nto_procfs_target::detach (inferior *inf, int from_tty)
|
||||||
{
|
{
|
||||||
int pid;
|
|
||||||
|
|
||||||
target_announce_detach ();
|
target_announce_detach ();
|
||||||
|
|
||||||
if (siggnal)
|
if (siggnal)
|
||||||
SignalKill (nto_node (), inferior_ptid.pid (), 0, 0, 0, 0);
|
SignalKill (nto_node (), inf->pid, 0, 0, 0, 0);
|
||||||
|
|
||||||
close (ctl_fd);
|
close (ctl_fd);
|
||||||
ctl_fd = -1;
|
ctl_fd = -1;
|
||||||
|
|
||||||
pid = inferior_ptid.pid ();
|
switch_to_no_thread ();
|
||||||
inferior_ptid = null_ptid;
|
detach_inferior (inf->pid);
|
||||||
detach_inferior (pid);
|
|
||||||
init_thread_list ();
|
init_thread_list ();
|
||||||
inf_child_maybe_unpush_target (ops);
|
inf_child_maybe_unpush_target (ops);
|
||||||
}
|
}
|
||||||
@ -1132,7 +1131,7 @@ nto_procfs_target::mourn_inferior ()
|
|||||||
SignalKill (nto_node (), inferior_ptid.pid (), 0, SIGKILL, 0, 0);
|
SignalKill (nto_node (), inferior_ptid.pid (), 0, SIGKILL, 0, 0);
|
||||||
close (ctl_fd);
|
close (ctl_fd);
|
||||||
}
|
}
|
||||||
inferior_ptid = null_ptid;
|
switch_to_no_thread ();
|
||||||
init_thread_list ();
|
init_thread_list ();
|
||||||
inf_child_mourn_inferior (ops);
|
inf_child_mourn_inferior (ops);
|
||||||
}
|
}
|
||||||
@ -1303,8 +1302,9 @@ nto_procfs_target::create_inferior (const char *exec_file,
|
|||||||
if (fds[2] != STDERR_FILENO)
|
if (fds[2] != STDERR_FILENO)
|
||||||
close (fds[2]);
|
close (fds[2]);
|
||||||
|
|
||||||
inferior_ptid = do_attach (ptid_t (pid));
|
ptid_t ptid = do_attach (ptid_t (pid));
|
||||||
procfs_update_thread_list (ops);
|
update_thread_list ();
|
||||||
|
switch_to_thread (find_thread_ptid (this, ptid));
|
||||||
|
|
||||||
inf = current_inferior ();
|
inf = current_inferior ();
|
||||||
inferior_appeared (inf, pid);
|
inferior_appeared (inf, pid);
|
||||||
|
Loading…
Reference in New Issue
Block a user