From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1551) id 2E25E3858D38; Mon, 25 Mar 2024 19:35:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E25E3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1711395331; bh=eXA0ev3OoK7ckjq+xrJYWjewvLqLL0yB6DCuCydhLzs=; h=From:To:Subject:Date:From; b=k/sfkY1gl/jhjPm5tmTKDFw2N3oyyepEFEHELGia/yUvpVDPF3VnISwNvoent2oiT IzTiDnj8nmvlnyZYucnzBSRyMltjSG3xKlm2lX2fi7ckOzB5EMXIs0T5clGpdL7nFn 0bpkvgK52+xVlQMQVzRerUFiQ+/6je+IeH2pMghk= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Pedro Alves To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix windows_nat_target::fake_create_process ptid X-Act-Checkin: binutils-gdb X-Git-Author: Pedro Alves X-Git-Refname: refs/heads/master X-Git-Oldrev: f9ee45c3a95ac37cf1c3f4ac6be34b9a53e306f4 X-Git-Newrev: ccf3148e3133f016a8e1484e85e5e4d8c271c4f0 Message-Id: <20240325193531.2E25E3858D38@sourceware.org> Date: Mon, 25 Mar 2024 19:35:31 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dccf3148e3133= f016a8e1484e85e5e4d8c271c4f0 commit ccf3148e3133f016a8e1484e85e5e4d8c271c4f0 Author: Pedro Alves Date: Fri Mar 22 19:28:55 2024 +0000 Fix windows_nat_target::fake_create_process ptid =20 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. =20 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 */);