]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: turn thread events off in selftests
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 6 Aug 2025 19:28:18 +0000 (15:28 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 27 Aug 2025 19:57:29 +0000 (15:57 -0400)
When running gdb.gdb/selftest.exp on Cygwin, the test eventually times
out on this command:

    (gdb) PASS: gdb.gdb/selftest.exp: printed version as pointer
    continue
    Continuing.
    [New Thread 4804.0x1728]
    [New Thread 4804.0x2f24]
    [New Thread 4804.0x934]
    [New Thread 4804.0x23a8]
    [New Thread 4804.0x2cf4]
    [New Thread 4804.0x1408]
    [New Thread 4804.0x2c90]
    [New Thread 4804.0xc58]
    [New Thread 4804.0x1d40]
    [New Thread 4804.0x1824]
    GNU gdb (GDB) 17.0.50.20250530-git
    Copyright (C) 2024 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Type "show copying" and "show warranty" for details.
    This GDB was configured as "x86_64-pc-cygwin".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <https://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
        <http://www.gnu.org/software/gdb/documentation/>.

    For help, type "help".
    Type "apropos word" to search for commands related to "word".
    (gdb) [New Thread 4804.0x2c64]
    [New Thread 4804.0x23c4]
    [New Thread 4804.0x2814]
    [Thread 4804.0x1200 exited with code 0]
    [Thread 4804.0x293c exited with code 0]
    [Thread 4804.0x2c9c exited with code 0]
    FAIL: gdb.gdb/selftest.exp: xgdb is at prompt (timeout)

The problem is the new thread notification, and the fact that the test
expects the prompt to be the last thing in the buffer.  To avoid the
thread events interfering with the test, disable them, they are not
useful here.

With this patch, gdb.gdb/selftest.exp mostly runs fine on Cygwin, the
only remaining problem appears to be:

    (gdb) PASS: gdb.gdb/selftest.exp: send ^C to child process
    signal SIGINT
    Continuing with signal SIGINT.
    PASS: gdb.gdb/selftest.exp: send SIGINT signal to child process, top GDB message
    FAIL: gdb.gdb/selftest.exp: send SIGINT signal to child process, bottom GDB message (timeout)

Change-Id: I0b1df0503c1961c042c8de559b4d223c5d3cb95c
Reviewed-By: Keith Seitz <keiths@redhat.com>
gdb/testsuite/lib/selftest-support.exp

index a8a33c81ab9f37efa7504e82ab16960985a19388..0ab10f2e180a5e02f23859077c4e3659ac81f8de 100644 (file)
@@ -119,6 +119,10 @@ proc _selftest_setup { } {
        return -2
     }
 
+    # Debugging on Windows shows random threads starting and exiting,
+    # interfering with the tests.  Disable them, since they are not useful here.
+    gdb_test_no_output "set print thread-events off"
+
     # run yourself
 
     set description "run until breakpoint at $function"