From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 7CAE23858C62 for ; Mon, 28 Nov 2022 11:25:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7CAE23858C62 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669634747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AGs35qvSAOThl7MF43+Ta3cyytpoWLxv4inxsHj7Ls4=; b=Sj9he++QMjuMDrD8ahDW5BEQnGPdv3H8w8bsz9Gkppx9r+eLqTp6QNl5p3y++I8NGB4Xcu 6gNqi2ggDLB6CnEIEjN8YEc7/rbZjj5Vkw9qdzQbTqn/admmI9TKkCIY+kfuEPjw4QDKE5 RXIuUhTBYhfZQpFMm4MlfvjZchn2Ak0= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-278-IVgZJ45_Nm6KErH-0kQ33Q-1; Mon, 28 Nov 2022 06:25:46 -0500 X-MC-Unique: IVgZJ45_Nm6KErH-0kQ33Q-1 Received: by mail-wr1-f69.google.com with SMTP id l8-20020adfc788000000b00241ef50e89eso1792096wrg.0 for ; Mon, 28 Nov 2022 03:25:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AGs35qvSAOThl7MF43+Ta3cyytpoWLxv4inxsHj7Ls4=; b=7FTCA/QiMSsZddGiZfTW8mx/rGJ1T5FmoI6TOp299rA+abfgH6q0oA5KfnCr4R5Txr PrIctozwfm4by/KkWLtkt52gJHGVwZPK3WDS28HTt4PDR2ucANJDVY5MqxdicSNauCk2 b1Y6jLzu9cS6HNQcG5g8bO8URjsI7Zq5Vn6lGnCqsv/9dyCOjJhfEH4SL/K0XukJFg/u 316sfVbOiGihHS1/tLetw+cGOX34hW7jAqCBpkvdYGYOoIVjJDijcOntaomfvsFApmej 11CUWxZAxaVObQItZNYEdvRfJIVZa00uFlODMt2IoHKhy2IyvTDdXmAeWFGsVUYSir0m ULeg== X-Gm-Message-State: ANoB5pkBGsTVmN9FwHQuDhTEPwtagZrj1ebQ0Tb0mI8qjeMfjjp5oDAy jC4Ncq4xT8XgVBCU29KR2+yjwk8N8XuOx55ClgRPCkApxIDSv2Mg8T1y8LbMhzMCCNNNLpjpoZS zb6+iArJsFnabEShz/B8pNsluIuPNEgj+OcwOyEKzuvLHXxbtoTo/TfbekHNcNSALEPpaSmZ4+Q == X-Received: by 2002:a5d:414b:0:b0:242:b59:c3c6 with SMTP id c11-20020a5d414b000000b002420b59c3c6mr6929877wrq.91.1669634744473; Mon, 28 Nov 2022 03:25:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf40y/BBKOtcjxs3g+ua0DefT/o4LP7q+lUeB/O7/rMCzApJGL7vKchP9FaX/GAk9/OiBXQrqw== X-Received: by 2002:a5d:414b:0:b0:242:b59:c3c6 with SMTP id c11-20020a5d414b000000b002420b59c3c6mr6929856wrq.91.1669634744162; Mon, 28 Nov 2022 03:25:44 -0800 (PST) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id c12-20020adfed8c000000b00236b2804d79sm10613260wro.2.2022.11.28.03.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 03:25:43 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 2/6] gdb/testsuite: don't try to set non-stop mode on a running target Date: Mon, 28 Nov 2022 11:25:34 +0000 Message-Id: <4483776f267f338e1ddf759fbe47a7917f3e898f.1669634536.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: The test gdb.threads/thread-specific-bp.exp tries to set non-stop mode on a running target, something which the manual makes clear is not allowed. The consequence of this is that the gdb.threads/thread-specific-bp.exp test has one failure when run with the native-extended-gdbserver board. This commit restructures the test a little, we now set the non-stop mode as part of the GDBFLAGS, so the mode will be set before GDB connects to the target. As a consequence I'm able to move the with_test_prefix out of the check_thread_specific_breakpoint proc. The check_thread_specific_breakpoint proc is now called within a loop. After this commit the gdb.threads/thread-specific-bp.exp test has zero failures for me with native-extended-gdbserver, native-gdbserver, and the unix board. --- .../gdb.threads/thread-specific-bp.exp | 138 +++++++++--------- 1 file changed, 67 insertions(+), 71 deletions(-) diff --git a/gdb/testsuite/gdb.threads/thread-specific-bp.exp b/gdb/testsuite/gdb.threads/thread-specific-bp.exp index 863c139d6b2..dc822f37b7b 100644 --- a/gdb/testsuite/gdb.threads/thread-specific-bp.exp +++ b/gdb/testsuite/gdb.threads/thread-specific-bp.exp @@ -24,8 +24,6 @@ if {[gdb_compile_pthreads \ return -1 } -clean_restart ${binfile} - # Extract and return the thread ID of the thread stopped at function # FUNC. @@ -45,86 +43,84 @@ proc get_thread_id {func} { return $thre } -proc check_thread_specific_breakpoint {mode} { - with_test_prefix "$mode" { - global gdb_prompt +proc check_thread_specific_breakpoint {non_stop} { + global gdb_prompt - if ![runto_main] { - return -1 - } + if ![runto_main] { + return -1 + } - set main_thre [get_thread_id "main"] - if { $main_thre < 0 } { - return -1 - } + set main_thre [get_thread_id "main"] + if { $main_thre < 0 } { + return -1 + } - gdb_breakpoint "start" - gdb_continue_to_breakpoint "start" + gdb_breakpoint "start" + gdb_continue_to_breakpoint "start" - set start_thre [get_thread_id "start"] - if { $start_thre < 0 } { - return -1 - } + set start_thre [get_thread_id "start"] + if { $start_thre < 0 } { + return -1 + } - # Set a thread-specific breakpoint at "main". This can't ever - # be hit, but that's OK. - gdb_breakpoint "main thread $start_thre" - gdb_test "info break" ".*breakpoint.*thread $start_thre" "breakpoint set" - - # Set breakpoint at a place only reacheable after the "start" - # thread exits. - gdb_breakpoint "end" - - # Switch back to the main thread, and resume all threads. The - # "start" thread exits, and the main thread reaches "end". - gdb_test "thread $main_thre" \ - "Switching to thread $main_thre.*" \ - "thread $main_thre selected" - - if { $mode == "non-stop" } { - set cmd "continue -a" - } else { - set cmd "continue" - } - set test "continue to end" - set thread_exited 0 - set prompt 0 - gdb_test_multiple "$cmd" $test -lbl { - -re "(^|\r\n)\\\[Thread \[^\r\n\]* exited](?=\r\n)" { - if { $prompt } { - pass $gdb_test_name - } else { - set thread_exited 1 - exp_continue - } + # Set a thread-specific breakpoint at "main". This can't ever + # be hit, but that's OK. + gdb_breakpoint "main thread $start_thre" + gdb_test "info break" ".*breakpoint.*thread $start_thre" "breakpoint set" + + # Set breakpoint at a place only reacheable after the "start" + # thread exits. + gdb_breakpoint "end" + + # Switch back to the main thread, and resume all threads. The + # "start" thread exits, and the main thread reaches "end". + gdb_test "thread $main_thre" \ + "Switching to thread $main_thre.*" \ + "thread $main_thre selected" + + if { $non_stop } { + set cmd "continue -a" + } else { + set cmd "continue" + } + set test "continue to end" + set thread_exited 0 + set prompt 0 + gdb_test_multiple "$cmd" $test -lbl { + -re "(^|\r\n)\\\[Thread \[^\r\n\]* exited](?=\r\n)" { + if { $prompt } { + pass $gdb_test_name + } else { + set thread_exited 1 + exp_continue } - -re "\r\n$gdb_prompt " { - if { $thread_exited } { - pass $gdb_test_name - } else { - set prompt 1 - exp_continue - } + } + -re "\r\n$gdb_prompt " { + if { $thread_exited } { + pass $gdb_test_name + } else { + set prompt 1 + exp_continue } } + } - set test "thread-specific breakpoint was deleted" - gdb_test_multiple "info breakpoint" $test { - -re "thread $start_thre\n$gdb_prompt $" { - fail $test - } - -re "$gdb_prompt $" { - pass $test - } + set test "thread-specific breakpoint was deleted" + gdb_test_multiple "info breakpoint" $test { + -re "thread $start_thre\n$gdb_prompt $" { + fail $test + } + -re "$gdb_prompt $" { + pass $test } } } -# Test all-stop mode. -check_thread_specific_breakpoint "all-stop" - -clean_restart ${binfile} +foreach_with_prefix non_stop {on off} { + save_vars { GDBFLAGS } { + append GDBFLAGS " -ex \"set non-stop $non_stop\"" + clean_restart $binfile + } -# Test non-stop mode. -gdb_test_no_output "set non-stop on" "set non-stop mode" -check_thread_specific_breakpoint "non-stop" + check_thread_specific_breakpoint $non_stop +} -- 2.25.4