• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修订版975f8708de015fb2b813edbf8b714f4777c57a41 (tree)
时间2020-06-19 07:11:23
作者Pedro Alves <palves@redh...>
CommiterPedro Alves

Log Message

Don't write to inferior_ptid in gnu-nat.c

Untested.

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* gnu-nat.c (gnu_nat_target::create_inferior): Switch to the added
thread.
(gnu_nat_target::attach): Don't write to inferior_ptid directly.
Instead use switch_to_thread.
(gnu_nat_target::detach): Use switch_to_no_thread
instead of writing to inferior_ptid directly. Used passed-in
inferior instead of looking up the inferior by pid.

更改概述

差异

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
11 2020-06-18 Pedro Alves <palves@redhat.com>
22
3+ * gnu-nat.c (gnu_nat_target::create_inferior): Switch to the added
4+ thread.
5+ (gnu_nat_target::attach): Don't write to inferior_ptid directly.
6+ Instead use switch_to_thread.
7+ (gnu_nat_target::detach): Use switch_to_no_thread
8+ instead of writing to inferior_ptid directly. Used passed-in
9+ inferior instead of looking up the inferior by pid.
10+
11+2020-06-18 Pedro Alves <palves@redhat.com>
12+
313 * go32-nat.c (go32_nat_target::create_inferior): Don't write to
414 inferior_ptid.
515
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2121,7 +2121,8 @@ gnu_nat_target::create_inferior (const char *exec_file,
21212121 /* We have something that executes now. We'll be running through
21222122 the shell at this point (if startup-with-shell is true), but the
21232123 pid shouldn't change. */
2124- add_thread_silent (this, ptid_t (pid));
2124+ thread_info *thr = add_thread_silent (this, ptid_t (pid));
2125+ switch_to_thread (thr);
21252126
21262127 /* Attach to the now stopped child, which is actually a shell... */
21272128 inf_debug (inf, "attaching to child: %d", pid);
@@ -2196,7 +2197,9 @@ gnu_nat_target::attach (const char *args, int from_tty)
21962197
21972198 inf_update_procs (inf);
21982199
2199- inferior_ptid = ptid_t (pid, inf_pick_first_thread (), 0);
2200+ thread_info *thr
2201+ = find_thread_ptid (this, ptid_t (pid, inf_pick_first_thread ()));
2202+ switch_to_thread (thr);
22002203
22012204 /* We have to initialize the terminal settings now, since the code
22022205 below might try to restore them. */
@@ -2225,8 +2228,6 @@ gnu_nat_target::attach (const char *args, int from_tty)
22252228 void
22262229 gnu_nat_target::detach (inferior *inf, int from_tty)
22272230 {
2228- int pid;
2229-
22302231 if (from_tty)
22312232 {
22322233 const char *exec_file = get_exec_file (0);
@@ -2238,12 +2239,10 @@ gnu_nat_target::detach (inferior *inf, int from_tty)
22382239 printf_unfiltered ("Detaching from pid %d\n", gnu_current_inf->pid);
22392240 }
22402241
2241- pid = gnu_current_inf->pid;
2242-
22432242 inf_detach (gnu_current_inf);
22442243
2245- inferior_ptid = null_ptid;
2246- detach_inferior (find_inferior_pid (this, pid));
2244+ switch_to_no_thread ();
2245+ detach_inferior (inf);
22472246
22482247 maybe_unpush_target ();
22492248 }