From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by sourceware.org (Postfix) with ESMTPS id CA6E93858D32 for ; Fri, 29 Sep 2023 17:53:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CA6E93858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3af6cd01323so804988b6e.3 for ; Fri, 29 Sep 2023 10:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696009996; x=1696614796; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=xfx5BIhxT5nqB36zmCcwE3uv85oG+WJYx+dWrfF/HLs=; b=ypdQ2UExVbrsvy9Gr17pcdAjnvwjHl3RTBZGwcOTHR8vI5Msn7qZdBvKtc4jktnlRP vc0qAZGuxQYKKrreqlEV4MQy5kPh99vSZag1cr0sBWlyQKVsiIIjwJoZ2xySRkjnm2Ux tnl8guGQIxOsozNSbSZFYTYGc1+46r6ZjLTjFsIuOVShiJku0a9Vagki7/vnm/Ur49V9 LtcCZGAy3vVic6Hzo+86Fh1H3vdUhf3CX/f2SY4LI/2HFGeAhYgW+p9UmLbhr5mHtKnc AmfJ18bckRQ0FCNUs0i9KSI6X38CGLBLTR8pLYXC7WFfxoXlEzKG6SnQDtAZjx/L8owu 1GIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696009996; x=1696614796; 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=xfx5BIhxT5nqB36zmCcwE3uv85oG+WJYx+dWrfF/HLs=; b=xJumRYiqnF19bEF6ul7h0DVTQMhBX7HsdDhe8exuXk6I9k1tRGob9GuaPZjt3eCKW3 k9Tp1af6f8Mbdn7hcHaJDta1RquhARvISDv6e/BWq09w6D5QfQqK+FR4yBMwUeeLnNor SFSTaOs6/6MiVvPlALXfapdFdxyJQukO2SR9918N4uZbRUx7AhKe3OLmh9vKEPu53xXG HmM4eaJAP/rdQj6wvJdcZ3Np5VPG+7puRY1g1huMTmSOnJpm3Hdcg9zPDA2SVoHoLess MJcl0i15mJMjayotq4znGv4AxAu4SxL3DYBiSZP8UQ7JuReKvK61hsoV2WNMndCowrsI p3/A== X-Gm-Message-State: AOJu0Yxf85Yt4zRhQyzhQpT12K3gifJSlAJ1phhs/dK6qyAPvkBzaZNU MAWBnhpWznUISMRdbPcIKrOIa9TiITksxrW68hw= X-Google-Smtp-Source: AGHT+IHW2cLXJEzYJJozZPA/pHHDX6o4JDEC8iq87c51xKlpF0BAiYrKQiVqEX+32CQ6RFl/5aQw7Q== X-Received: by 2002:aca:220a:0:b0:3ad:c5e7:8e11 with SMTP id b10-20020aca220a000000b003adc5e78e11mr4895031oic.0.1696009996063; Fri, 29 Sep 2023 10:53:16 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:a5c1:6d58:637f:3cd6]) by smtp.gmail.com with ESMTPSA id g14-20020a63374e000000b0058579ef9577sm3205912pgn.79.2023.09.29.10.53.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 10:53:15 -0700 (PDT) From: Thiago Jung Bauermann To: gdb-patches@sourceware.org Subject: [PATCH] process-dies-while-detaching.exp: Exit early if GDB misses sync breakpoint Date: Fri, 29 Sep 2023 14:53:13 -0300 Message-ID: <20230929175313.24845-1-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: I'm seeing a lot of variability in the failures of gdb.threads/process-dies-while-detaching.exp on aarch64-linux. On this platform, a problem yet to be investigated causes GDB to miss the _exit breakpoint. What happens next is random because after missing that breakpoint, GDB is out of sync with the inferior. This causes the tests following that point in the testcase to fail in a random way. In this scenario it's better to exit the testcase early to avoid random results in the testsuite. We are relying on gdb_continue_to_breakpoint to return the result of gdb_test_multiple. This is already the case because in Tcl the return value of a function is the return value of the last command it runs. But change gdb_continue_to_breakpoint to explicitly return this value, to make it clear this is the intended behaviour. Tested on aarch64-linux. --- .../gdb.threads/process-dies-while-detaching.exp | 10 +++++----- gdb/testsuite/lib/gdb.exp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp b/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp index bbbe82df30cd..c7d43d7dddcc 100644 --- a/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp +++ b/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp @@ -127,7 +127,7 @@ proc detach_and_expect_exit {inf_output_re test} { proc continue_to_exit_bp {} { gdb_breakpoint "_exit" temporary - gdb_continue_to_breakpoint "_exit" ".*_exit.*" + return [gdb_continue_to_breakpoint "_exit" ".*_exit.*"] } # If testing single-process, simply detach from the process. @@ -226,7 +226,7 @@ proc test_detach {multi_process cmd} { } # Run to _exit in the child. - continue_to_exit_bp + return_if_fail [continue_to_exit_bp] do_detach $multi_process $cmd "normal" } @@ -265,13 +265,13 @@ proc test_detach_watch {wp multi_process cmd} { # them out, and handle the case of the thread disappearing # while doing that (on targets that need to detach from each # thread individually). - continue_to_exit_bp + return_if_fail [continue_to_exit_bp] } else { # Force software watchpoints. gdb_test_no_output "set can-use-hw-watchpoints 0" # As above, but flip order, other wise things take too long. - continue_to_exit_bp + return_if_fail [continue_to_exit_bp] gdb_test "watch globalvar" "Watchpoint $decimal: globalvar" if { $multi_process == 0 && $cmd == "continue" } { @@ -304,7 +304,7 @@ proc test_detach_killed_outside {multi_process cmd} { } # Run to _exit in the child. - continue_to_exit_bp + return_if_fail [continue_to_exit_bp] set childpid [get_integer_valueof "mypid" -1] if { $childpid == -1 } { diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 1b9179401c45..dfabc99fe4be 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -822,14 +822,14 @@ proc gdb_continue_to_breakpoint {name {location_pattern .*}} { set full_name "continue to breakpoint: $name" set kfail_pattern "Process record does not support instruction 0xfae64 at.*" - gdb_test_multiple "continue" $full_name { + return [gdb_test_multiple "continue" $full_name { -re "(?:Breakpoint|Temporary breakpoint) .* (at|in) $location_pattern\r\n$gdb_prompt $" { pass $full_name } -re "(?:$kfail_pattern)\r\n$gdb_prompt $" { kfail "gdb/25038" $full_name } - } + }] }