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 15C443858028 for ; Sat, 4 Feb 2023 16:23:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 15C443858028 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=1675527783; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oGE2r2M1WtPCQKgufOc8n7Z0J7pjOr+ygWsec1BNls8=; b=FpClyCciQ3rEVCH9xg7o/vMK2ILH7K526GyajQwXjh3+toHWkl9lPCHFGPkJ7J/eO6yX2Y JR3ESM2nCPiunnx2wCk4qSkEgQPEtjtE0fGz60B7szq6grVpJ/SSIHzUAqCcyJjPgODcXV oyCKn98a3a/yDg33bcw7Of7k1+RfDJ8= 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-670-7KmFkBfCMma1j_1AnjMyzw-1; Sat, 04 Feb 2023 11:23:02 -0500 X-MC-Unique: 7KmFkBfCMma1j_1AnjMyzw-1 Received: by mail-qt1-f199.google.com with SMTP id g2-20020ac870c2000000b003b9c8ab53e9so4073827qtp.6 for ; Sat, 04 Feb 2023 08:23:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oGE2r2M1WtPCQKgufOc8n7Z0J7pjOr+ygWsec1BNls8=; b=NMv6vYDKKJV3vXn06wKjBdY8Nd0WL2Xh4CBcjIzhv98LyF3MFEEpkWXFHDyipnr32S Xpav5AqDEI6bseExkexqpvH6nokFIUQTPyi/QRyn48gwp0ZwvloMHdUa5fGsx7/5blsb iOLIoyej1hVKqm9g8RZuP4Dgf8HATiFBxVIqkubl6ET6RpWRIyd4g9JkPQ1xdXnE7gLX PA8ajC4qXRi8V1N7dPqkLkEOJ98DCsWWKahCLu9LvoKpkdqGcG5vfqPC67F9klDXZ16T WVwLAoVCDcR2fxBi8ber8JjYxu0oJ0SMqpXXndL7t/JsxSzERjmxWzTJabwQFH3mJRM0 lUjQ== X-Gm-Message-State: AO0yUKUFsjZcsv10RNQWVZyoNt1RwyWW6Dir7MbvBLmv//B2zPTtQoVk xSQSIo4w+PudRtzSwBXQfBoQF3WIO4RUTN2XN+fW7ABoGFzK9VTL6zZ14eVQ0ik+jMgQQ+1rZYA 1zXx81K0GSGQm7Hl8s7lrqkGYQPqw/OudWvsz9UYCE2hyNx3fIMpcruh+hC7CcWp6UVZkRsbU2g == X-Received: by 2002:a05:622a:11d0:b0:3b9:b9ae:1476 with SMTP id n16-20020a05622a11d000b003b9b9ae1476mr24572192qtk.40.1675527781514; Sat, 04 Feb 2023 08:23:01 -0800 (PST) X-Google-Smtp-Source: AK7set8/ez28dyhfYofKhhXofnLzuDyLha9nhE3mwQIEvXti8FUWvc4OC++xeC4IGStFD7BjUi30OQ== X-Received: by 2002:a05:622a:11d0:b0:3b9:b9ae:1476 with SMTP id n16-20020a05622a11d000b003b9b9ae1476mr24572143qtk.40.1675527780999; Sat, 04 Feb 2023 08:23:00 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id f3-20020ac84703000000b003b2d890752dsm3691127qtp.88.2023.02.04.08.23.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 08:23:00 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: Re: [PATCHv2 2/6] gdb/testsuite: don't try to set non-stop mode on a running target In-Reply-To: References: Date: Sat, 04 Feb 2023 16:22:59 +0000 Message-ID: <87mt5twgbg.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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: Andrew Burgess writes: > 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. Given that the preceding patch[1] appears to be on hold in favour of Pedro's work[2], I've gone ahead and pushed this patch with a slightly updated commit message. This means that when Pedro gets to push his patch, he'll see the gdb.threads/thread-specific-bp.exp suddenly start passing. Thanks, Andrew [1] https://sourceware.org/pipermail/gdb-patches/2023-January/195971.html [2] https://sourceware.org/pipermail/gdb-patches/2022-December/194694.html --- commit 79436bfc5aa71973f154b855f7440ed62ddd9582 Author: Andrew Burgess Date: Thu Nov 24 19:36:23 2022 +0000 gdb/testsuite: don't try to set non-stop mode on a running target 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. 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 still has some failures, this is because of an issue GDB currently has printing "Thread ... exited" messages. This problem should be addressed by this patch: https://sourceware.org/pipermail/gdb-patches/2022-December/194694.html when it is merged. diff --git a/gdb/testsuite/gdb.threads/thread-specific-bp.exp b/gdb/testsuite/gdb.threads/thread-specific-bp.exp index f603b24fa31..f440574d780 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 +}