public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pedro Alves <palves@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Fix windows_nat_target::fake_create_process ptid
Date: Mon, 25 Mar 2024 19:35:31 +0000 (GMT)	[thread overview]
Message-ID: <20240325193531.2E25E3858D38@sourceware.org> (raw)

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

commit ccf3148e3133f016a8e1484e85e5e4d8c271c4f0
Author: Pedro Alves <pedro@palves.net>
Date:   Fri Mar 22 19:28:55 2024 +0000

    Fix windows_nat_target::fake_create_process ptid
    
    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

Diff:
---
 gdb/windows-nat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index ee38b985efa..b123a66ef0f 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -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 */);

                 reply	other threads:[~2024-03-25 19:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240325193531.2E25E3858D38@sourceware.org \
    --to=palves@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).