]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix windows_nat_target::fake_create_process ptid
authorPedro Alves <pedro@palves.net>
Fri, 22 Mar 2024 19:28:55 +0000 (19:28 +0000)
committerPedro Alves <pedro@palves.net>
Mon, 25 Mar 2024 19:29:53 +0000 (19:29 +0000)
While working on Windows non-stop mode, I managed to introduce a bug
that led to fake_create_process being called.  That then resulted in
GDB crashes later on, because fake_create_process added a thread with
an incorrect ptid for this target.  It is putting dwThreadId in the
tid field of the ptid instead of on the lwp field.  This is fixed by
this patch.

Change-Id: Iaee5d2deaa57c501f7e6909f8ac242af9b183215

gdb/windows-nat.c

index ee38b985efa748cc5c67513333c0294ae3e983c4..b123a66ef0f922ed39f573600e76d7e5e0084068 100644 (file)
@@ -1371,8 +1371,8 @@ windows_nat_target::fake_create_process ()
       throw_winerror_with_name (_("OpenProcess call failed"), err);
       /*  We can not debug anything in that case.  */
     }
-  add_thread (ptid_t (windows_process.current_event.dwProcessId, 0,
-                             windows_process.current_event.dwThreadId),
+  add_thread (ptid_t (windows_process.current_event.dwProcessId,
+                     windows_process.current_event.dwThreadId, 0),
                      windows_process.current_event.u.CreateThread.hThread,
                      windows_process.current_event.u.CreateThread.lpThreadLocalBase,
                      true /* main_thread_p */);