Message ID | 20240507234233.371123-1-pedro@palves.net |
---|---|
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AF3033849AEA for <patchwork@sourceware.org>; Tue, 7 May 2024 23:44:01 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by sourceware.org (Postfix) with ESMTPS id 9A849384AB45 for <gdb-patches@sourceware.org>; Tue, 7 May 2024 23:42:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9A849384AB45 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9A849384AB45 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715125359; cv=none; b=ENEn/bRPK0tNczJxSWmu+nTlD6yZ/odLpczSYtLTV8AHm6hicS3PseTGyIF7ftAVm586yulvVE/iDUJwtI77hIDybzTkmX2nB03pBFnvFH+5Hr1tefPQlPih/KmZ0XiioSX0dvbeA95DIEiCJFmy9aGMc6ki0wekRBmaoisSoJk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715125359; c=relaxed/simple; bh=GCa8zoVlReGOJi9f1eSMmsl39FIqWBhfTWK3GVNhGDU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=tmrNoWTxycPasgG0FxEp6Om3VSwzDuiQPXk2niixj7skbw057MZRf5yVP78LgG5clxie8u5TfP2UjLiLMpMQM9S0ZCW7pltnuWi9HtQs0uWZDA/rp21iXgVgBXiyO/Xs94PO37fNWF8on7MFgxl5o73WnzM5BA7GnhnzJCdRuDI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-41b79451153so30196905e9.2 for <gdb-patches@sourceware.org>; Tue, 07 May 2024 16:42:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715125356; x=1715730156; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GjMsCijY5qg09DIkt25Q4aFQozUWu0Cg0KSZA/WIb3k=; b=fh5gkAwZCFa3cjzDJRPotJIhE+kPLNQU6990nghrcBTQzunlMLnWrUmMuafpw4Wud3 hAv8LPRz72ka5HwqGpsaORmA6tksMF6gy8aaHiU1R+uBg+X7B1iuKKJnOExjo/RiLRi2 E5EMyINK1bm7LyB0RhcSo5atztPqPr7WFi+wzOArV7CnxAZZoaSxxVNQPA/WdtjhoB4T x2JlX3iKfJGaom9OZwZwfzF20JUK5qy7KNif1JKYt4sZjyIvpeUYfJiFnSHEZWQ8FItH icgPkG4PkKjdsYiX09T8283i+ajeW1TWzUUWvm3BuV2qjLYuq5qjHTSwmJOsRMYBE9cy zIjg== X-Gm-Message-State: AOJu0Yx4k6Uj5D2lqOnoRlBACQIcnRlje5EUuAMzwaU2jv+/f8k9WkZD DAMppG4PeIF53+koTtZ6G2fYcyTUze9s5IowKx2ICf4ND6p1/H3rQMtP8Fyh X-Google-Smtp-Source: AGHT+IHpRmnXDydHSrIWy71CHajQUGS83cIGjbG4bknt2c+jKROYCCFqGUPyOdwVbormefA87jQQXw== X-Received: by 2002:a05:6000:e01:b0:34c:71f2:acea with SMTP id ffacd0b85a97d-34fca243a14mr857725f8f.20.1715125356052; Tue, 07 May 2024 16:42:36 -0700 (PDT) Received: from localhost ([2001:8a0:f908:4900:2dd1:1a0d:2b75:dc42]) by smtp.gmail.com with UTF8SMTPSA id h18-20020a056000001200b0034c78001f6asm13888080wrx.109.2024.05.07.16.42.35 for <gdb-patches@sourceware.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 May 2024 16:42:35 -0700 (PDT) From: Pedro Alves <pedro@palves.net> To: gdb-patches@sourceware.org Subject: [PATCH 00/34] Windows non-stop mode Date: Wed, 8 May 2024 00:41:59 +0100 Message-ID: <20240507234233.371123-1-pedro@palves.net> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org |
Series |
Windows non-stop mode
|
|
Message
Pedro Alves
May 7, 2024, 11:41 p.m. UTC
This series adds non-stop mode support to the Windows native backend, on Windows 10 and above. Earlier Windows version lack the necessary feature, so those keep working in all-stop mode, only. After the series, the Windows target backend defaults to working in non-stop mode (as in, "maint set target-non-stop"), even if user-visible mode is all-stop ("set non-stop off"). This is the same as the Linux backend. I've been testing this on Cygwin native with the GDB testsuite as I've been developing this. Running the testsuite on Cygwin is a pain, and many testcases run into cascading timeouts still, and some even hang the test run forever until you kill them manually. I've got another series of patches to improve such tests and skip others, and that's what I've been testing with. I've also tested the series with the windows-nat backend forced to all-stop mode, but admittedly not after the last rebase (as it's so painful), yet. Pedro Alves (34): Windows gdb: Dead code in windows_nat_target::do_initial_windows_stuff Windows gdb: Eliminate global current_process.dr[8] global Windows gdb+gdbserver: New find_thread, replaces thread_rec(DONT_INVALIDATE_CONTEXT) Windows gdb: handle_output_debug_string return type Windows gdb: Eliminate reload_context Windows gdb+gdbserver: Eliminate thread_rec(INVALIDATE_CONTEXT) calls Windows gdb+gdbserver: Eliminate DONT_SUSPEND Windows gdb+gdbserver: Eliminate windows_process_info::thread_rec Windows gdb: Simplify windows_nat_target::wait Windows gdb+gdbserver: Move suspending thread to when returning event Windows gdb: Introduce continue_last_debug_event_main_thread Windows gdb: Introduce windows_continue_flags Windows gdb: Factor code out of windows_nat_target::windows_continue Windows gdb: Pending stop and current_event Windows gdb+gdbserver: Elim desired_stop_thread_id / rework pending_stops Windows gdb+gdbserver: Introduce get_last_debug_event_ptid Windows gdb: Can't pass signal to thread other than last stopped thread Windows gdbserver: Fix scheduler-locking Windows gdb: Enable "set scheduler-locking on" Windows gdbserver: Eliminate soft-interrupt mechanism Windows gdb+gdbserver: Make current_event per-thread state Windows gdb+gdbserver: Make last_sig per-thread state Windows gdb+gdbserver: Make siginfo_er per-thread state Add backpointer from windows_thread_info to windows_process_info Windows gdb+gdbserver: Share $_siginfo reading code Windows gdb+gdbserver: Eliminate struct pending_stop Windows gdb: Change serial_event management Windows gdb: cygwin_set_dr => windows_set_dr, etc. windows_per_inferior::continue_one_thread, unify WoW64/non-WoW64 paths windows-nat.c: Avoid writing debug registers if watchpoint hit pending Windows gdb+gdbserver: Check whether DBG_REPLY_LATER is available Windows gdb: Add non-stop support Windows gdb: Watchpoints while running (internal vs external stops) Mention Windows non-stop support in NEWS gdb/NEWS | 3 + gdb/nat/windows-nat.c | 207 +++-- gdb/nat/windows-nat.h | 219 +++--- gdb/windows-nat.c | 1616 ++++++++++++++++++++++++++++------------ gdbserver/win32-low.cc | 401 +++++----- gdbserver/win32-low.h | 19 +- 6 files changed, 1621 insertions(+), 844 deletions(-) base-commit: d68f983f88c7469befddcf221228070990cf25e1
Comments
>>>>> "Pedro" == Pedro Alves <pedro@palves.net> writes:
Pedro> This series adds non-stop mode support to the Windows native backend,
Pedro> on Windows 10 and above. Earlier Windows version lack the necessary
Pedro> feature, so those keep working in all-stop mode, only.
Pedro> After the series, the Windows target backend defaults to working in
Pedro> non-stop mode (as in, "maint set target-non-stop"), even if
Pedro> user-visible mode is all-stop ("set non-stop off"). This is the same
Pedro> as the Linux backend.
Thanks for doing this. This implements a pretty big subset of my
windows-nat wish-list.
I reviewed the easy subset of the patches. I'll do some more later.
I'd suggest not landing the more major changes until after GDB 15.
It seems pretty close to the release to add a big change like this.
Pedro> I've been testing this on Cygwin native with the GDB testsuite as I've
Pedro> been developing this. Running the testsuite on Cygwin is a pain, and
Pedro> many testcases run into cascading timeouts still, and some even hang
Pedro> the test run forever until you kill them manually.
At some point I'll apply the patches and run them through the AdaCore
test suite.
Tom
Tom> At some point I'll apply the patches and run them through the AdaCore Tom> test suite. I did this today and I found a few failures. Now, one thing to note is that I did this by merging your branch into the AdaCore branch; and AdaCore carries a few local changes. In particular AdaCore still has the "random thread switch" change that I submitted a long time ago -- and one of the problems seems to be related to that. Without really debugging I don't know if that's a problem in the series or with the local changes. Anyway, there are some other problems as well. For instance: (gdb) start Temporary breakpoint 1 at 0x140001aab: file p.adb, line 4. Starting program: C:\Users\itmgr\sandbox\x86_64-windows64\gdb_version-head_test\tmp\tes t\gdb-TS-f539jxg_\J225-024__attach_detach_task\p.exe Thread 1 hit Temporary breakpoint 1, p () at p.adb:4 4 Barrier : Integer := 0; PASSED:J225-024__attach_detach_task:start (gdb) detach Detaching from program: C:\Users\itmgr\sandbox\x86_64-windows64\gdb_version-head_test\t mp\test\gdb-TS-f539jxg_\J225-024__attach_detach_task\p.exe, process 4272 [Inferior 1 (process 4272) detached] PASSED:J225-024__attach_detach_task:detach (gdb) attach 4272 Can't attach to process 4272 (error 87): The parameter is incorrect. Here the test detaches and then re-attaches -- but attach fails. Another test runs gdb without a symbol file and then does an attach. The expected output (happens with gdb head) is: (gdb) attach 2328 Attaching to process 2328 Reading symbols from C:\Users\itmgr\sandbox\x86_64-windows64\gdb_version-head_test\tmp\ test\gdb-TS-bgt06sfm\N203-009__attach_no_exe\foo_n203_009.EXE... However with the branch, gdb doesn't try to read the symbols and instead mentions some system dll: (gdb) attach 1276 Attaching to process 1276 0x00007ff8b9b50274 in ntdll!ZwDelayExecution () from C:\Windows\SYSTEM32\ntdll.dll There was also a timeout when detaching. The inferior being run is fairly ordinary -- nothing special, just a spot to set a breakpoint: (gdb) tbreak break_me Temporary breakpoint 1 at 0x140001ca4: file pck.adb, line 37. PASSED:CA30-017__detach:tbreak break_me (gdb) run Starting program: C:\Users\itmgr\sandbox\x86_64-windows64\gdb_version-head_test\tmp\test\gdb-TS-f539jxg_\CA30-017__detach\foo.exe Thread 1 hit Temporary breakpoint 1, pck.break_me () at pck.adb:37 37 null; PASSED:CA30-017__detach:runto 'break_me' (gdb) detach TIMEOUT:CA30-017__detach:detach (timeout) [killing GDB (pid = N/A (already dead?))] FWIW I ran the tests before and after the series, on the same machine, so there shouldn't be any machine configuration issues or anything like that. hope this helps, Tom
Thank you very much! I will try to reproduce the issues and see if I can fix them. To understand whether non-stop or all-stop modes were being used in the tests used below -- was this with a Windows >= 10 machine or older Windows? Pedro Alves On 2024-05-15 18:35, Tom Tromey wrote: > Tom> At some point I'll apply the patches and run them through the AdaCore > Tom> test suite. > > I did this today and I found a few failures. > > Now, one thing to note is that I did this by merging your branch into > the AdaCore branch; and AdaCore carries a few local changes. > > In particular AdaCore still has the "random thread switch" change that I > submitted a long time ago -- and one of the problems seems to be related > to that. Without really debugging I don't know if that's a problem in > the series or with the local changes. > > Anyway, there are some other problems as well. For instance: > > (gdb) start > Temporary breakpoint 1 at 0x140001aab: file p.adb, line 4. > Starting program: C:\Users\itmgr\sandbox\x86_64-windows64\gdb_version-head_test\tmp\tes > t\gdb-TS-f539jxg_\J225-024__attach_detach_task\p.exe > > Thread 1 hit Temporary breakpoint 1, p () at p.adb:4 > 4 Barrier : Integer := 0; > PASSED:J225-024__attach_detach_task:start > (gdb) detach > Detaching from program: C:\Users\itmgr\sandbox\x86_64-windows64\gdb_version-head_test\t > mp\test\gdb-TS-f539jxg_\J225-024__attach_detach_task\p.exe, process 4272 > [Inferior 1 (process 4272) detached] > PASSED:J225-024__attach_detach_task:detach > (gdb) attach 4272 > Can't attach to process 4272 (error 87): The parameter is incorrect. > > Here the test detaches and then re-attaches -- but attach fails. > > > Another test runs gdb without a symbol file and then does an attach. > The expected output (happens with gdb head) is: > > (gdb) attach 2328 > Attaching to process 2328 > Reading symbols from C:\Users\itmgr\sandbox\x86_64-windows64\gdb_version-head_test\tmp\ > test\gdb-TS-bgt06sfm\N203-009__attach_no_exe\foo_n203_009.EXE... > > However with the branch, gdb doesn't try to read the symbols and instead > mentions some system dll: > > (gdb) attach 1276 > Attaching to process 1276 > 0x00007ff8b9b50274 in ntdll!ZwDelayExecution () > from C:\Windows\SYSTEM32\ntdll.dll > > > There was also a timeout when detaching. The inferior being run is > fairly ordinary -- nothing special, just a spot to set a breakpoint: > > (gdb) tbreak break_me > Temporary breakpoint 1 at 0x140001ca4: file pck.adb, line 37. > PASSED:CA30-017__detach:tbreak break_me > (gdb) run > Starting program: C:\Users\itmgr\sandbox\x86_64-windows64\gdb_version-head_test\tmp\test\gdb-TS-f539jxg_\CA30-017__detach\foo.exe > > Thread 1 hit Temporary breakpoint 1, pck.break_me () at pck.adb:37 > 37 null; > PASSED:CA30-017__detach:runto 'break_me' > (gdb) detach > TIMEOUT:CA30-017__detach:detach (timeout) > [killing GDB (pid = N/A (already dead?))] > > > > FWIW I ran the tests before and after the series, on the same machine, > so there shouldn't be any machine configuration issues or anything like > that. > > hope this helps, > Tom >
>>>>> "Pedro" == Pedro Alves <pedro@palves.net> writes:
Pedro> Thank you very much! I will try to reproduce the issues and see if I can fix them.
Pedro> To understand whether non-stop or all-stop modes were being used in
Pedro> the tests used below -- was this with a Windows >= 10 machine or older Windows?
I think it is a "Windows 2019" machine, which searching tells me is
based on Windows 10. I'm not sure I have access to anything older.
Tom