GNU Binutils with patches for OS216
リビジョン | 49e3f3e80956fb285529ef204857f55f6e5f3bba (tree) |
---|---|
日時 | 2020-06-04 04:19:11 |
作者 | Pedro Alves <palves@redh...> |
コミッター | Pedro Alves |
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:
yyyy-mm-dd 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.
@@ -393,7 +393,7 @@ nto_procfs_target::update_thread_list () | ||
393 | 393 | |
394 | 394 | prune_threads (); |
395 | 395 | |
396 | - pid = inferior_ptid.pid (); | |
396 | + pid = current_inferior ()->pid; | |
397 | 397 | |
398 | 398 | status.tid = 1; |
399 | 399 |
@@ -712,7 +712,7 @@ nto_procfs_target::attach (const char *args, int from_tty) | ||
712 | 712 | printf_unfiltered ("Attaching to %s\n", |
713 | 713 | target_pid_to_str (ptid_t (pid)).c_str ()); |
714 | 714 | } |
715 | - inferior_ptid = do_attach (ptid_t (pid)); | |
715 | + ptid_t ptid = do_attach (ptid_t (pid)); | |
716 | 716 | inf = current_inferior (); |
717 | 717 | inferior_appeared (inf, pid); |
718 | 718 | inf->attach_flag = 1; |
@@ -720,7 +720,9 @@ nto_procfs_target::attach (const char *args, int from_tty) | ||
720 | 720 | if (!target_is_pushed (ops)) |
721 | 721 | push_target (ops); |
722 | 722 | |
723 | - procfs_update_thread_list (ops); | |
723 | + update_thread_list (); | |
724 | + | |
725 | + switch_to_thread (find_thread_ptid (this, ptid)); | |
724 | 726 | } |
725 | 727 | |
726 | 728 | void |
@@ -1000,19 +1002,16 @@ nto_procfs_target::xfer_partial (enum target_object object, | ||
1000 | 1002 | void |
1001 | 1003 | nto_procfs_target::detach (inferior *inf, int from_tty) |
1002 | 1004 | { |
1003 | - int pid; | |
1004 | - | |
1005 | 1005 | target_announce_detach (); |
1006 | 1006 | |
1007 | 1007 | if (siggnal) |
1008 | - SignalKill (nto_node (), inferior_ptid.pid (), 0, 0, 0, 0); | |
1008 | + SignalKill (nto_node (), inf->pid, 0, 0, 0, 0); | |
1009 | 1009 | |
1010 | 1010 | close (ctl_fd); |
1011 | 1011 | ctl_fd = -1; |
1012 | 1012 | |
1013 | - pid = inferior_ptid.pid (); | |
1014 | - inferior_ptid = null_ptid; | |
1015 | - detach_inferior (pid); | |
1013 | + switch_to_no_thread (); | |
1014 | + detach_inferior (inf->pid); | |
1016 | 1015 | init_thread_list (); |
1017 | 1016 | inf_child_maybe_unpush_target (ops); |
1018 | 1017 | } |
@@ -1132,7 +1131,7 @@ nto_procfs_target::mourn_inferior () | ||
1132 | 1131 | SignalKill (nto_node (), inferior_ptid.pid (), 0, SIGKILL, 0, 0); |
1133 | 1132 | close (ctl_fd); |
1134 | 1133 | } |
1135 | - inferior_ptid = null_ptid; | |
1134 | + switch_to_no_thread (); | |
1136 | 1135 | init_thread_list (); |
1137 | 1136 | inf_child_mourn_inferior (ops); |
1138 | 1137 | } |
@@ -1303,8 +1302,9 @@ nto_procfs_target::create_inferior (const char *exec_file, | ||
1303 | 1302 | if (fds[2] != STDERR_FILENO) |
1304 | 1303 | close (fds[2]); |
1305 | 1304 | |
1306 | - inferior_ptid = do_attach (ptid_t (pid)); | |
1307 | - procfs_update_thread_list (ops); | |
1305 | + ptid_t ptid = do_attach (ptid_t (pid)); | |
1306 | + update_thread_list (); | |
1307 | + switch_to_thread (find_thread_ptid (this, ptid)); | |
1308 | 1308 | |
1309 | 1309 | inf = current_inferior (); |
1310 | 1310 | inferior_appeared (inf, pid); |