• 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

修订版0ac553107c601cc9c4c340338e0fc7e0ce8375cc (tree)
时间2020-06-19 07:08:14
作者Pedro Alves <palves@redh...>
CommiterPedro Alves

Log Message

Don't write to inferior_ptid in remote.c

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

* remote.c (remote_target::remote_notice_new_inferior): Use
switch_to_thread instead of writing to inferior_ptid directly.
(remote_target::add_current_inferior_and_thread): Use
switch_to_no_thread instead of writing to inferior_ptid directly.
(extended_remote_target::attach): Use switch_to_inferior_no_thread
and switch_to_thread instead of using set_current_inferior or
writing to inferior_ptid directly.

更改概述

差异

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
11 2020-06-18 Pedro Alves <palves@redhat.com>
22
3+ * remote.c (remote_target::remote_notice_new_inferior): Use
4+ switch_to_thread instead of writing to inferior_ptid directly.
5+ (remote_target::add_current_inferior_and_thread): Use
6+ switch_to_no_thread instead of writing to inferior_ptid directly.
7+ (extended_remote_target::attach): Use switch_to_inferior_no_thread
8+ and switch_to_thread instead of using set_current_inferior or
9+ writing to inferior_ptid directly.
10+
11+2020-06-18 Pedro Alves <palves@redhat.com>
12+
313 * tracectf.c (ctf_target_open): Switch to added thread instead of
414 writing to inferior_ptid directly.
515 (ctf_target::close): Use switch_to_no_thread instead of writing to
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -2493,8 +2493,9 @@ remote_target::remote_notice_new_inferior (ptid_t currthread, int executing)
24932493 thread_change_ptid (this, inferior_ptid, currthread);
24942494 else
24952495 {
2496- remote_add_thread (currthread, running, executing);
2497- inferior_ptid = currthread;
2496+ thread_info *thr
2497+ = remote_add_thread (currthread, running, executing);
2498+ switch_to_thread (thr);
24982499 }
24992500 return;
25002501 }
@@ -4346,9 +4347,10 @@ remote_target::add_current_inferior_and_thread (char *wait_status)
43464347 struct remote_state *rs = get_remote_state ();
43474348 bool fake_pid_p = false;
43484349
4349- inferior_ptid = null_ptid;
4350+ switch_to_no_thread ();
43504351
4351- /* Now, if we have thread information, update inferior_ptid. */
4352+ /* Now, if we have thread information, update the current thread's
4353+ ptid. */
43524354 ptid_t curr_ptid = get_current_thread (wait_status);
43534355
43544356 if (curr_ptid != null_ptid)
@@ -5760,7 +5762,7 @@ remote_target::remote_detach_1 (inferior *inf, int from_tty)
57605762 }
57615763 else
57625764 {
5763- inferior_ptid = null_ptid;
5765+ switch_to_no_thread ();
57645766 detach_inferior (current_inferior ());
57655767 }
57665768 }
@@ -5906,33 +5908,33 @@ extended_remote_target::attach (const char *args, int from_tty)
59065908 target_pid_to_str (ptid_t (pid)).c_str ());
59075909 }
59085910
5909- set_current_inferior (remote_add_inferior (false, pid, 1, 0));
5911+ switch_to_inferior_no_thread (remote_add_inferior (false, pid, 1, 0));
59105912
59115913 inferior_ptid = ptid_t (pid);
59125914
59135915 if (target_is_non_stop_p ())
59145916 {
5915- struct thread_info *thread;
5916-
59175917 /* Get list of threads. */
59185918 update_thread_list ();
59195919
5920- thread = first_thread_of_inferior (current_inferior ());
5921- if (thread)
5922- inferior_ptid = thread->ptid;
5923- else
5924- inferior_ptid = ptid_t (pid);
5920+ thread_info *thread = first_thread_of_inferior (current_inferior ());
5921+ if (thread != nullptr)
5922+ switch_to_thread (thread);
59255923
59265924 /* Invalidate our notion of the remote current thread. */
59275925 record_currthread (rs, minus_one_ptid);
59285926 }
59295927 else
59305928 {
5931- /* Now, if we have thread information, update inferior_ptid. */
5932- inferior_ptid = remote_current_thread (inferior_ptid);
5929+ /* Now, if we have thread information, update the main thread's
5930+ ptid. */
5931+ ptid_t curr_ptid = remote_current_thread (ptid_t (pid));
59335932
59345933 /* Add the main thread to the thread list. */
5935- thread_info *thr = add_thread_silent (this, inferior_ptid);
5934+ thread_info *thr = add_thread_silent (this, curr_ptid);
5935+
5936+ switch_to_thread (thr);
5937+
59365938 /* Don't consider the thread stopped until we've processed the
59375939 saved stop reply. */
59385940 set_executing (this, thr->ptid, true);