From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id D9t6MNsZQ2jicwMAWB0awg (envelope-from ) for ; Fri, 06 Jun 2025 12:39:55 -0400 Received: by simark.ca (Postfix, from userid 112) id B14021E11C; Fri, 6 Jun 2025 12:39:55 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.0 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5035C1E0C2 for ; Fri, 6 Jun 2025 12:39:54 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E0F16385AC36 for ; Fri, 6 Jun 2025 16:39:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E0F16385AC36 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by sourceware.org (Postfix) with ESMTPS id 531083857B84 for ; Fri, 6 Jun 2025 16:39:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 531083857B84 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 531083857B84 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1749227957; cv=none; b=p7eWt49qlLQqGa6HrCvgMxgXK6FNKm6wwYbPpxnusj11VOXWzlavrFTbIjUg0j21p2UtukyVXsqs9Q2szFgyWHguZgIO3BgAXmpVipdP5aiV+TXascbd9gdEvk4GmbOfK4fZT38CK7b9f7JE1KHNkP8273ALXjifzHSLohNiLnM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1749227957; c=relaxed/simple; bh=IfSZ/LBqRm7LL8WKrxaXveD0dgg5/Eef3MHwK+f3MYs=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=l3cvMXvOITTFP9QfT0rOAoWwT9DrSgtnDr3OCxicLMCaqqa8Em9PnvYIU+LBe2IJksKM4Q1hVEnHx6WUfIfMR6M0qpxjN1Qyr9bXCftjI0jEwVMD5/8brP711lkKUJQQE0vAEyCJ0ew+G5tUE/kV3XXwOtL5cS36m/wiGUS/xBA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 531083857B84 Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-442ea341570so15732815e9.1 for ; Fri, 06 Jun 2025 09:39:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749227956; x=1749832756; 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=fLE2YIIbJxq/zykPfn/RpwoJTFks6keitUn32cZcVIY=; b=nBEON/AB0EtGwYQ+EPbsjG7hnk4np0qWmcUIinXNOVO/8xj/iX7GeMwUPxnPJMOL3/ QI16Fa9FPCGbly0tZ94HA6WmU3WE7VjR1vF4YGFOUlSawpJhDgxHTuvfvldb8/C5Hx+m WYh8n0K+bL7ejWB547dbRaFJ7zBr+QmYXesghxfYi3MXnpsJMij9SWy3d0p8BtSvth6p O4ujSH5+gnBH6D+SwvdzuUgtwx2kWNqI48wHE+T5u9FKVZC9CE1uBIq8Bv97sXbRJeSw S2hBWLDYLKltkmTLOgRgdzBDsQmGf7muLOCH94dMIinH68/YPbUeEnHR+pagpGtiRVE8 9jrg== X-Gm-Message-State: AOJu0Yy699/zcOzTZlpdAenSp1/Oo/dTMftdyDnLaRz592d7HqWn16q0 Dwef1IA6/O4rdIQeykn0Iq7fc+9XpZC3Z7Hx1vc8FFEZjKIKeqnxhFAQE4IxUf39 X-Gm-Gg: ASbGncu8XyZjdLIb2ahi0yx/1DXNQFVotlT2kU1Kjky3AyOSBJayV9BMV2Cii7mOiF8 aEcM5pEJb3jyuTU+gnBwSqReGazVbZ+oPqj2nRIDzgovC5mTgIZoBovGn/dxdwHq8FnXfd1XL+g Y5gLjCAp/HuaPHX767tJ9AQVT/DHnbp94Ikrxgu1lOuekD3UM6dnogbAgKLnSmvP4UHGDIzCQR0 26+ACh17o6iqfOuMlrIYS3fXMloCjuHh69rYswoV/P1PXkmiZwaF0MlenX7ILbjoEsuc6ZSqvFm xsWiRG0pyjdnASskFcXwjHBErZOcAsLCLM/ab0X7mwQoulbX0pHEhcGTH0pH X-Google-Smtp-Source: AGHT+IFRUmxxOEI6w3ozJLt7Hri2R/5JQHqrLo13yvhsFeUojqvbpeweSDPEQ+jQvEN+5p0eXw+kGg== X-Received: by 2002:a05:600c:5288:b0:450:d3b9:4b96 with SMTP id 5b1f17b1804b1-452013916bbmr46763805e9.13.1749227955368; Fri, 06 Jun 2025 09:39:15 -0700 (PDT) Received: from localhost ([2001:8a0:facf:2b00:77f6:647:8d2f:f905]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-45213754973sm29862975e9.35.2025.06.06.09.39.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Jun 2025 09:39:14 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH] gdb testsuite: Introduce allow_multi_inferior_tests and use it throughout Date: Fri, 6 Jun 2025 17:39:08 +0100 Message-ID: <20250606163908.964592-1-pedro@palves.net> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org The Windows port does not support multi-process debugging. Testcases that want to exercise multi-process currently FAIL and some hit cascading timeouts. Add a new allow_multi_inferior_tests procedure, meant to be used with require, and sprinkle it throughout testcases as needed. Change-Id: I4a10d8f04f9fa10f4b751f140ad0a6d31fbd9dfb --- .../gdb.base/kill-detach-inferiors-cmd.exp | 1 + .../run-control-while-bg-execution.exp | 5 ++ gdb/testsuite/gdb.btrace/multi-inferior.exp | 2 + .../gdb.mi/interrupt-thread-group.exp | 2 +- .../gdb.mi/user-selected-context-sync.exp | 2 + .../gdb.multi/attach-while-running.exp | 1 + .../gdb.multi/bp-thread-specific.exp | 2 + .../gdb.multi/dummy-frame-restore.exp | 2 + gdb/testsuite/gdb.multi/multi-arch.exp | 2 + gdb/testsuite/gdb.multi/multi-attach.exp | 2 + gdb/testsuite/gdb.multi/multi-exit.exp | 2 + gdb/testsuite/gdb.multi/multi-kill.exp | 2 + gdb/testsuite/gdb.multi/multi-re-run.exp | 2 + gdb/testsuite/gdb.multi/multi-target.exp.tcl | 4 + .../gdb.multi/multi-term-settings.exp | 2 + .../gdb.multi/start-inferior-specific.exp | 2 + gdb/testsuite/gdb.multi/stop-all-on-exit.exp | 2 + gdb/testsuite/gdb.multi/tids-gid-reset.exp | 2 + gdb/testsuite/gdb.multi/tids.exp | 3 + gdb/testsuite/gdb.multi/watchpoint-multi.exp | 2 + .../access-mem-running-thread-exit.exp | 88 ++++++++++--------- .../gdb.threads/detach-step-over.exp | 2 + gdb/testsuite/gdb.threads/threadapply.exp | 6 +- .../gdb.threads/vfork-multi-inferior.exp | 2 + gdb/testsuite/lib/gdb.exp | 18 ++++ 25 files changed, 115 insertions(+), 45 deletions(-) diff --git a/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.exp b/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.exp index ef4bb88a217..57ec3303529 100644 --- a/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.exp +++ b/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.exp @@ -19,6 +19,7 @@ # commands. require can_spawn_for_attach +require allow_multi_inferior_tests standard_testfile set executable $testfile diff --git a/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp b/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp index 22913ca97d8..eaee0101a90 100644 --- a/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp +++ b/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp @@ -49,6 +49,11 @@ if {[build_executable "failed to prepare" $testfile $srcfile]} { # - run: use the run command # - attach: start a process outside of GDB and attach it proc do_test { action1 action2 } { + + if {$action1 == "add" && ![allow_multi_inferior_tests]} { + return + } + save_vars { ::GDBFLAGS } { append ::GDBFLAGS " -ex \"maintenance set target-non-stop on\"" clean_restart $::binfile diff --git a/gdb/testsuite/gdb.btrace/multi-inferior.exp b/gdb/testsuite/gdb.btrace/multi-inferior.exp index ed2acb2520d..d87a94160a7 100644 --- a/gdb/testsuite/gdb.btrace/multi-inferior.exp +++ b/gdb/testsuite/gdb.btrace/multi-inferior.exp @@ -24,6 +24,8 @@ require allow_btrace_tests +require allow_multi_inferior_tests + require !use_gdb_stub standard_testfile diff --git a/gdb/testsuite/gdb.mi/interrupt-thread-group.exp b/gdb/testsuite/gdb.mi/interrupt-thread-group.exp index ff35109716c..869fb1cb287 100644 --- a/gdb/testsuite/gdb.mi/interrupt-thread-group.exp +++ b/gdb/testsuite/gdb.mi/interrupt-thread-group.exp @@ -54,7 +54,7 @@ mi_send_resuming_command "exec-continue --thread-group i1" \ # We can't run a second inferior on stub targets. We can still test with one # inferior and ensure that the command has the desired effect. -set use_second_inferior [expr {![use_gdb_stub]}] +set use_second_inferior [expr {![use_gdb_stub] && [allow_multi_inferior_tests]}] if { $use_second_inferior } { mi_gdb_test "-add-inferior" \ diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp index ec22538d30b..f85e108ab19 100644 --- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp +++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp @@ -40,6 +40,8 @@ standard_testfile # gdbserver modes are supported. require !use_gdb_stub +require allow_multi_inferior_tests + set compile_options "debug pthreads" if {[build_executable $testfile.exp $testfile ${srcfile} ${compile_options}] == -1} { untested "failed to compile" diff --git a/gdb/testsuite/gdb.multi/attach-while-running.exp b/gdb/testsuite/gdb.multi/attach-while-running.exp index 061b30db20c..723ebb2e4ee 100644 --- a/gdb/testsuite/gdb.multi/attach-while-running.exp +++ b/gdb/testsuite/gdb.multi/attach-while-running.exp @@ -37,6 +37,7 @@ standard_testfile require can_spawn_for_attach +require allow_multi_inferior_tests if { [build_executable "failed to prepare" ${testfile} ${srcfile}] } { return diff --git a/gdb/testsuite/gdb.multi/bp-thread-specific.exp b/gdb/testsuite/gdb.multi/bp-thread-specific.exp index 32b76022573..3fe4c2090c9 100644 --- a/gdb/testsuite/gdb.multi/bp-thread-specific.exp +++ b/gdb/testsuite/gdb.multi/bp-thread-specific.exp @@ -19,6 +19,8 @@ # Also check that the correct thread-ids are used in the saved # breakpoints file. +require allow_multi_inferior_tests + # The plain remote target can't do multiple inferiors. require !use_gdb_stub diff --git a/gdb/testsuite/gdb.multi/dummy-frame-restore.exp b/gdb/testsuite/gdb.multi/dummy-frame-restore.exp index 1a9d4135cc6..4119e3f1ef2 100644 --- a/gdb/testsuite/gdb.multi/dummy-frame-restore.exp +++ b/gdb/testsuite/gdb.multi/dummy-frame-restore.exp @@ -19,6 +19,8 @@ set executable ${testfile} # The plain remote target can't do multiple inferiors. require !use_gdb_stub +require allow_multi_inferior_tests + if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} { return -1 } diff --git a/gdb/testsuite/gdb.multi/multi-arch.exp b/gdb/testsuite/gdb.multi/multi-arch.exp index d0ae5110550..1d41ba5c0ae 100644 --- a/gdb/testsuite/gdb.multi/multi-arch.exp +++ b/gdb/testsuite/gdb.multi/multi-arch.exp @@ -18,6 +18,8 @@ set testfile "multi-arch" +require allow_multi_inferior_tests + # The plain remote target can't do multiple inferiors. require !use_gdb_stub diff --git a/gdb/testsuite/gdb.multi/multi-attach.exp b/gdb/testsuite/gdb.multi/multi-attach.exp index 2d702eec405..210c8ca6b53 100644 --- a/gdb/testsuite/gdb.multi/multi-attach.exp +++ b/gdb/testsuite/gdb.multi/multi-attach.exp @@ -17,6 +17,8 @@ # Test attaching to multiple threaded programs. +require allow_multi_inferior_tests + standard_testfile require can_spawn_for_attach diff --git a/gdb/testsuite/gdb.multi/multi-exit.exp b/gdb/testsuite/gdb.multi/multi-exit.exp index 71236c19e2f..8393067e532 100644 --- a/gdb/testsuite/gdb.multi/multi-exit.exp +++ b/gdb/testsuite/gdb.multi/multi-exit.exp @@ -24,6 +24,8 @@ standard_testfile +require allow_multi_inferior_tests + require !use_gdb_stub if {[build_executable "failed to prepare" $testfile $srcfile]} { diff --git a/gdb/testsuite/gdb.multi/multi-kill.exp b/gdb/testsuite/gdb.multi/multi-kill.exp index 48a253445fe..7d66ab0152a 100644 --- a/gdb/testsuite/gdb.multi/multi-kill.exp +++ b/gdb/testsuite/gdb.multi/multi-kill.exp @@ -24,6 +24,8 @@ standard_testfile +require allow_multi_inferior_tests + require !use_gdb_stub if {[build_executable "failed to prepare" $testfile $srcfile {debug}]} { diff --git a/gdb/testsuite/gdb.multi/multi-re-run.exp b/gdb/testsuite/gdb.multi/multi-re-run.exp index 002de57fa76..4caadeafde5 100644 --- a/gdb/testsuite/gdb.multi/multi-re-run.exp +++ b/gdb/testsuite/gdb.multi/multi-re-run.exp @@ -20,6 +20,8 @@ # misbehave, including failing to load libthread_db.so. See PR # gdb/25410. +require allow_multi_inferior_tests + # Build two executables, with different symbols. set exec1 "multi-re-run-1" diff --git a/gdb/testsuite/gdb.multi/multi-target.exp.tcl b/gdb/testsuite/gdb.multi/multi-target.exp.tcl index 8c24602adee..dc88ca4b2e6 100644 --- a/gdb/testsuite/gdb.multi/multi-target.exp.tcl +++ b/gdb/testsuite/gdb.multi/multi-target.exp.tcl @@ -175,6 +175,10 @@ proc multi_target_prepare {} { return 0 } + if {![allow_multi_inferior_tests]} { + return 0 + } + # The plain remote target can't do multiple inferiors. if {[target_info gdb_protocol] != ""} { return 0 diff --git a/gdb/testsuite/gdb.multi/multi-term-settings.exp b/gdb/testsuite/gdb.multi/multi-term-settings.exp index 2f8b3b819d3..38322be5c44 100644 --- a/gdb/testsuite/gdb.multi/multi-term-settings.exp +++ b/gdb/testsuite/gdb.multi/multi-term-settings.exp @@ -25,6 +25,8 @@ standard_testfile +require allow_multi_inferior_tests + require can_spawn_for_attach if [build_executable "failed to prepare" $testfile $srcfile {debug}] { diff --git a/gdb/testsuite/gdb.multi/start-inferior-specific.exp b/gdb/testsuite/gdb.multi/start-inferior-specific.exp index 819c1c3d2ea..74f984cccd4 100644 --- a/gdb/testsuite/gdb.multi/start-inferior-specific.exp +++ b/gdb/testsuite/gdb.multi/start-inferior-specific.exp @@ -25,6 +25,8 @@ standard_testfile .c -other.c +require allow_multi_inferior_tests + require !use_gdb_stub set srcfile_other ${srcfile2} diff --git a/gdb/testsuite/gdb.multi/stop-all-on-exit.exp b/gdb/testsuite/gdb.multi/stop-all-on-exit.exp index b4ff09c72e7..47071f390ad 100644 --- a/gdb/testsuite/gdb.multi/stop-all-on-exit.exp +++ b/gdb/testsuite/gdb.multi/stop-all-on-exit.exp @@ -18,6 +18,8 @@ # Test that in all-stop mode with multiple inferiors, GDB stops all # threads upon receiving an exit event from one of the inferiors. +require allow_multi_inferior_tests + # This is a test specific for a native target, where we use the # "-exec" argument to "add-inferior" and we explicitly don't do # "maint set target-non-stop on". diff --git a/gdb/testsuite/gdb.multi/tids-gid-reset.exp b/gdb/testsuite/gdb.multi/tids-gid-reset.exp index 6cc27eb1996..1785ac28494 100644 --- a/gdb/testsuite/gdb.multi/tids-gid-reset.exp +++ b/gdb/testsuite/gdb.multi/tids-gid-reset.exp @@ -54,6 +54,8 @@ with_test_prefix "single-inferior" { # non-extended gdbserver is not supported. require !use_gdb_stub +require allow_multi_inferior_tests + # Test with multiple inferiors. This time, since we restart inferior # 1 while inferior 2 still has threads, then the new thread 1.1 should # end up with GID == 3, since we won't be able to reset the global diff --git a/gdb/testsuite/gdb.multi/tids.exp b/gdb/testsuite/gdb.multi/tids.exp index dab6275dc03..436a38a985c 100644 --- a/gdb/testsuite/gdb.multi/tids.exp +++ b/gdb/testsuite/gdb.multi/tids.exp @@ -124,6 +124,9 @@ with_test_prefix "single inferior" { gdb_test "print \$_inferior_thread_count" " = 1" } +# The rest of the tests require running multiple inferiors. +require allow_multi_inferior_tests + # "info threads" while there are multiple inferiors should show # qualified thread IDs. with_test_prefix "two inferiors" { diff --git a/gdb/testsuite/gdb.multi/watchpoint-multi.exp b/gdb/testsuite/gdb.multi/watchpoint-multi.exp index f4486899d73..b0c873112c8 100644 --- a/gdb/testsuite/gdb.multi/watchpoint-multi.exp +++ b/gdb/testsuite/gdb.multi/watchpoint-multi.exp @@ -16,6 +16,8 @@ standard_testfile set executable ${testfile} +require allow_multi_inferior_tests + # Multiple inferiors are needed, therefore both native and extended gdbserver # modes are supported. Only non-extended gdbserver is not supported. require !use_gdb_stub diff --git a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp index b41e3b23bd2..a7dc470aaad 100644 --- a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp +++ b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp @@ -74,42 +74,44 @@ proc test { non_stop } { delete_breakpoints # Start the second inferior. - with_test_prefix "second inferior" { - # With stub targets that do reload on run, if we let the new - # inferior share inferior 1's connection, runto would - # fail because GDB is already connected to something, like - # e.g. with --target_board=native-gdbserver: - # - # (gdb) kill - # ... - # (gdb) target remote localhost:2348 - # Already connected to a remote target. Disconnect? (y or n) - # - # Instead, start the inferior with no connection, and let - # gdb_load/runto spawn a new remote connection/gdbserver. - # - # OTOH, with extended-remote, we must let the new inferior - # reuse the current connection, so that runto below can - # issue the "run" command, and have the inferior run on the - # remote target. If we forced no connection, then "run" would - # either fail if "set auto-connect-native-target" is on, like - # the native-extended-gdbserver board enforces, or it would - # run the inferior on the native target, which isn't what is - # being tested. - # - # Since it's reload_on_run targets that need special care, we - # default to reusing the connection on most targets. - if [target_info exists gdb,do_reload_on_run] { - gdb_test "add-inferior -no-connection" "New inferior 2.*" - } else { - gdb_test "add-inferior" "New inferior 2.*" - } - gdb_test "inferior 2" "Switching to inferior 2 .*" - - gdb_load $binfile - - if ![runto setup_done] { - return -1 + if {[allow_multi_inferior_tests]} { + with_test_prefix "second inferior" { + # With stub targets that do reload on run, if we let the new + # inferior share inferior 1's connection, runto would + # fail because GDB is already connected to something, like + # e.g. with --target_board=native-gdbserver: + # + # (gdb) kill + # ... + # (gdb) target remote localhost:2348 + # Already connected to a remote target. Disconnect? (y or n) + # + # Instead, start the inferior with no connection, and let + # gdb_load/runto spawn a new remote connection/gdbserver. + # + # OTOH, with extended-remote, we must let the new inferior + # reuse the current connection, so that runto below can + # issue the "run" command, and have the inferior run on the + # remote target. If we forced no connection, then "run" would + # either fail if "set auto-connect-native-target" is on, like + # the native-extended-gdbserver board enforces, or it would + # run the inferior on the native target, which isn't what is + # being tested. + # + # Since it's reload_on_run targets that need special care, we + # default to reusing the connection on most targets. + if [target_info exists gdb,do_reload_on_run] { + gdb_test "add-inferior -no-connection" "New inferior 2.*" + } else { + gdb_test "add-inferior" "New inferior 2.*" + } + gdb_test "inferior 2" "Switching to inferior 2 .*" + + gdb_load $binfile + + if ![runto setup_done] { + return -1 + } } } @@ -158,13 +160,15 @@ proc test { non_stop } { verbose -log "xxxxx: iteration $iter" gdb_test -nopass "info threads" - if {$inf == 1} { - set inf 2 - } else { - set inf 1 - } + if {[allow_multi_inferior_tests]} { + if {$inf == 1} { + set inf 2 + } else { + set inf 1 + } - my_gdb_test "inferior $inf" ".*" "inferior $inf" + my_gdb_test "inferior $inf" ".*" "inferior $inf" + } my_gdb_test "print global_var = 555" " = 555" \ "write to global_var" diff --git a/gdb/testsuite/gdb.threads/detach-step-over.exp b/gdb/testsuite/gdb.threads/detach-step-over.exp index e48b83cd77f..8a1cb292c3d 100644 --- a/gdb/testsuite/gdb.threads/detach-step-over.exp +++ b/gdb/testsuite/gdb.threads/detach-step-over.exp @@ -50,6 +50,8 @@ require can_spawn_for_attach +require allow_multi_inferior_tests + standard_testfile set bp_lineno [gdb_get_line_number "Set breakpoint here"] diff --git a/gdb/testsuite/gdb.threads/threadapply.exp b/gdb/testsuite/gdb.threads/threadapply.exp index c53db7963af..9110617b7e1 100644 --- a/gdb/testsuite/gdb.threads/threadapply.exp +++ b/gdb/testsuite/gdb.threads/threadapply.exp @@ -224,6 +224,8 @@ proc kill_and_remove_inferior {thread_set} { # Test both "all" and a thread list, because those are implemented as # different commands in GDB. -foreach_with_prefix thread_set {"all" "1.1"} { - kill_and_remove_inferior $thread_set +if {[allow_multi_inferior_tests]} { + foreach_with_prefix thread_set {"all" "1.1"} { + kill_and_remove_inferior $thread_set + } } diff --git a/gdb/testsuite/gdb.threads/vfork-multi-inferior.exp b/gdb/testsuite/gdb.threads/vfork-multi-inferior.exp index d552039a400..1f87427755d 100644 --- a/gdb/testsuite/gdb.threads/vfork-multi-inferior.exp +++ b/gdb/testsuite/gdb.threads/vfork-multi-inferior.exp @@ -27,6 +27,8 @@ require allow_fork_tests +require allow_multi_inferior_tests + require !use_gdb_stub standard_testfile .c -sleep.c diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 014012dcf90..0f4a1a07cf0 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5111,6 +5111,24 @@ proc allow_fork_tests {} { return 1 } +# Return whether we allow running testcases that want to debug +# multiple inferiors with the same target. Not all targets support +# this. Note that some tests add a second inferior but never start +# it. Those tests should not be skipped due to this proc returning +# false. + +proc allow_multi_inferior_tests {} { + if {[istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"]} { + return 0 + } + + if {[use_gdb_stub]} { + return 0 + } + + return 1 +} + # Return a 1 if we should run tests that require hardware breakpoints proc allow_hw_breakpoint_tests {} { base-commit: e9770f7889e72297a179b5596894f4bbdb105224 -- 2.49.0