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.129.124]) by sourceware.org (Postfix) with ESMTPS id 8080F3858C33 for ; Fri, 20 Jan 2023 09:46:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8080F3858C33 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=1674208009; 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=v9tx9u2f1K7uWsGZG6GWFhihjolhzYYh2KV73+RcHQY=; b=it2BCaX/J+vXTQc/wiuTgWcRb0IBwa2so8EF5VXV3UR16kT9G5AyKf9uouQLAv8Mz0oiRh I4wSkbMNuDsbGuVN1atDfYbQ2kTmVlxyY056ZGZKStDXsFhJNb36PQ/HUycuJMi4xTCLMV OcaUuDkUM8dcuwoPeCWY5xj7ZLwo+KE= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-151-_KkOROaZPeW3SEwmK44Lfw-1; Fri, 20 Jan 2023 04:46:40 -0500 X-MC-Unique: _KkOROaZPeW3SEwmK44Lfw-1 Received: by mail-qt1-f199.google.com with SMTP id q26-20020ac8735a000000b003b63165d87cso2180311qtp.11 for ; Fri, 20 Jan 2023 01:46:39 -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=v9tx9u2f1K7uWsGZG6GWFhihjolhzYYh2KV73+RcHQY=; b=kln6xl51m5pKEtMWo+NQBKWasqz6FR/DrS27JfLhhi3fSYtQAUQZpojmxHx4awbVko RzOpUnBr6i89YWEHOo07WakdQcgO6QwFsIgfoZLvR97MA3P3V7Wa8fUurL5DWM2aYqbH 5U+DhWoM25hBKj9zieK/TbsLWDVm5RMfPHvxBIeSyYxwusf1qwAr0SkzIWNFZbUimmUs AiNHfzAU1YAn/MVT0RwkCyJEIg4lUJ2mxftBs7CtBZ4uM0ryF3vgaY7nx66gFHsiQ/+h vFXVG1zW1MMnocUl4f1uGwGCDKLXceGLCBFC+upCdIjZs3R2xDvFv3+uxdfHKllC9TK6 UkWw== X-Gm-Message-State: AFqh2krN9LLy6L89aKsDUClB90kq2XqGs1L7+FWeR3i3Djmf3N5DV29A eWakWAH1yp7tUMvvWAA0vc/RDahXS0hquugwPs23yOhf/XJLNBTPosspmZG24yEsc6exa+LH4XT nlH+vsb24xmCDeK4BW709J0MO1OLQ9ttUuH35OYOgFfnuCE3aP4I4PnqhmpEsnkkDbaz3irHw/w == X-Received: by 2002:ac8:6f09:0:b0:3a7:e271:fc05 with SMTP id bs9-20020ac86f09000000b003a7e271fc05mr23130222qtb.3.1674207999356; Fri, 20 Jan 2023 01:46:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXuhiirYVsYpyirqakkaQLiKpog6o/AZ61rVEbpwMadnA/VzcJRo+QjAxcvFjcHDtMVGtFoK8A== X-Received: by 2002:ac8:6f09:0:b0:3a7:e271:fc05 with SMTP id bs9-20020ac86f09000000b003a7e271fc05mr23130202qtb.3.1674207998976; Fri, 20 Jan 2023 01:46:38 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id j25-20020ac874d9000000b003b0b903720esm13180478qtr.13.2023.01.20.01.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 01:46:38 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 2/6] gdb/testsuite: don't try to set non-stop mode on a running target Date: Fri, 20 Jan 2023 09:46:25 +0000 Message-Id: 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.8 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 f603b24fa31..d33b4f47258 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