[binutils-gdb] Don't write to inferior_ptid in go32-nat.c

Pedro Alves palves@sourceware.org
Thu Jun 18 22:27:33 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1ee1a363454d88a87ad2ade7530b2a7fb670021e

commit 1ee1a363454d88a87ad2ade7530b2a7fb670021e
Author: Pedro Alves <palves@redhat.com>
Date:   Thu Jun 18 21:28:33 2020 +0100

    Don't write to inferior_ptid in go32-nat.c
    
    gdb/ChangeLog:
    2020-06-18  Pedro Alves  <palves@redhat.com>
    
            * go32-nat.c (go32_nat_target::create_inferior): Switch to thread
            after creating it, instead of writing to inferior_ptid.  Don't
            write to inferior_ptid.

Diff:
---
 gdb/ChangeLog  | 6 ++++++
 gdb/go32-nat.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index dc15d2df4d9..bc8c37144f3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2020-06-18  Pedro Alves  <palves@redhat.com>
+
+	* go32-nat.c (go32_nat_target::create_inferior): Switch to thread
+	after creating it, instead of writing to inferior_ptid.  Don't
+	write to inferior_ptid.
+
 2020-06-18  Pedro Alves  <palves@redhat.com>
 
 	* fork-child.c (postfork_hook): Don't write to inferior_ptid.
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index d1e508cc780..8ffd28985ab 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -753,14 +753,14 @@ go32_nat_target::create_inferior (const char *exec_file,
   save_npx ();
 #endif
 
-  inferior_ptid = ptid_t (SOME_PID);
   inf = current_inferior ();
   inferior_appeared (inf, SOME_PID);
 
   if (!target_is_pushed (this))
     push_target (this);
 
-  add_thread_silent (inferior_ptid);
+  thread_info *thr = add_thread_silent (ptid_t (SOME_PID));
+  switch_to_thread (thr);
 
   clear_proceed_status (0);
   insert_breakpoints ();


More information about the Gdb-cvs mailing list