Re: [PATCH v2 00/47] Windows non-stop mode

Pedro Alves
2025-06-13T10:35:38Z

[-- Attachment #1: Type: text/plain, Size: 1873 bytes --]

On 2025-06-12 20:23, Tom Tromey wrote:
> Pedro> Is the test using scheduler locking (and was previously ignoring the error
> Pedro> that "set scheduler-locking on" currently issues on Windows) ?
>
> Nope. The test is fairly basic. I've appended the two files (the test
> script and the Ada source) , since I don't think there's anything
> particularly proprietary about them. They seem to be pretty old.

Thanks! Indeed. It doesn't look that different from what I've tried, then. I had made the test
use threads just in case it was easier to adapt it that way toward what AdaCore's test was doing,
but I removed all of that now that it's clear it's not necessary, and the result is the same for me.
I've attached the simplified testcase.

You mentioned that you merged my branch into AdaCore's local tree. I wonder if this is some local change
in the AdaCore gdb that might need some adjustment. Is it possible to run that test in AdaCore's testsuite
with a GDB straight based on my branch on top of master, instead of AdaCore's local tree?
Like, the equivalent of:

$ make check RUNTESTFLAGS="GDB=/path/to/pedros/gdb" TESTS="gdb.base/continue-break-command.exp"

>
> Pedro> I ask because that is expected output if you continue with scheduler locking enabled,
> Pedro> and the thread exits. E.g., the new gdb.threads/leader-exit-schedlock.exp testcase added
> Pedro> by the series, has:
>
> Pedro> Maybe some logs like:
> Pedro> set debug infrun
> Pedro> set debugevents on
> Pedro> set debugexceptions on
> Pedro> set debugexec on
> Pedro> would help see what's going on.
>
> I will try to do this soon.

Thank you!

If you end up debugging this, windows_nat_target::any_resumed_thread() is where we
decide whether to report a TARGET_WAITKIND_NO_RESUMED event. Maybe that is returning
true in a situation that it shouldn't, for some reason.

Pedro Alves

[-- Attachment #2: 0001-New-gdb.base-continue-break-command.exp-testcase.patch --]
[-- Type: text/x-patch, Size: 4214 bytes --]

From 581dd502f6898ba38373c2ff302b840b3edfed79 Mon Sep 17 00:00:00 2001
From: Pedro Alves <pedro@palves.net>
Date: Wed, 11 Jun 2025 23:35:57 +0100
Subject: [PATCH] New gdb.base/continue-break-command.exp testcase

Change-Id: Ie57493bb5032f28619db418d9d8068aae2d40b09
---
.../gdb.base/continue-break-command.c | 42 +++++++++++
.../gdb.base/continue-break-command.exp | 75 +++++++++++++++++++
2 files changed, 117 insertions(+)
create mode 100644 gdb/testsuite/gdb.base/continue-break-command.c
create mode 100644 gdb/testsuite/gdb.base/continue-break-command.exp

diff --git a/gdb/testsuite/gdb.base/continue-break-command.c b/gdb/testsuite/gdb.base/continue-break-command.c
new file mode 100644
index 00000000000..585476aa838
--- /dev/null
+++ b/gdb/testsuite/gdb.base/continue-break-command.c
@@ -0,0 +1,42 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+static void
+foo ()
+{
+}
+
+static void
+bar ()
+{
+}
+
+int
+main (void)
+{
+ /* The testcase sets breakpoints on these two, that when hit, are
+ removed by their corresponding breakpoint command. */
+ foo ();
+ bar ();
+
+ /* Call them again to make sure the breakpoints are really
+ deleted. */
+ foo ();
+ bar ();
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/continue-break-command.exp b/gdb/testsuite/gdb.base/continue-break-command.exp
new file mode 100644
index 00000000000..6d77d282d78
--- /dev/null
+++ b/gdb/testsuite/gdb.base/continue-break-command.exp
@@ -0,0 +1,75 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# XXX, some meaninful explanation here.
+
+standard_testfile .c
+
+if { [build_executable "failed to prepare" $testfile $srcfile {debug}] \
+ == -1 } {
+ return
+}
+
+proc test {} {
+ clean_restart $::binfile
+
+ if ![runto_main] {
+ return
+ }
+
+ # Disable "[Thread 14192.0x3618 exited with code 0]" messages.
+ gdb_test_no_output "set print thread-events off"
+
+ gdb_breakpoint "foo" message
+ gdb_test_multiple "commands" "command for foo" {
+ -re "End with" {
+ gdb_test \
+ [multi_line_input \
+ {silent} \
+ {printf "Breakpoint hit #1.\n"} \
+ {clear foo} \
+ {continue} \
+ {end}] \
+ "" \
+ $gdb_test_name
+ }
+ }
+
+ gdb_breakpoint "bar" message
+ gdb_test_multiple "commands" "commands for bar" {
+ -re "End with" {
+ gdb_test \
+ [multi_line_input \
+ {silent} \
+ {printf "Breakpoint hit #2.\n"} \
+ {clear bar} \
+ {continue} \
+ {end}] \
+ "" \
+ $gdb_test_name
+ }
+ }
+
+ gdb_test "info breakpoints" ".*"
+
+ gdb_test_sequence "continue" "" \
+ [list \
+ "Continuing\\." \
+ "^\r\nBreakpoint hit #1\\." \
+ "^\r\nBreakpoint hit #2\\." \
+ "^\r\n$::inferior_exited_re normally"]
+}
+
+test

base-commit: eb6c9310ee4d6cbde509d251fafb54ae45f5a5bf
--
2.49.0