From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8GaOFXbGO2G/OwAAWB0awg (envelope-from ) for ; Fri, 10 Sep 2021 16:56:22 -0400 Received: by simark.ca (Postfix, from userid 112) id 557A81EE24; Fri, 10 Sep 2021 16:56:22 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 6E8591EE20 for ; Fri, 10 Sep 2021 16:56:21 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2759D385AC1A for ; Fri, 10 Sep 2021 20:56:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2759D385AC1A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1631307381; bh=czrwMI22LfnGcC1JF9JR4keBD790QWAzOs/CSr6Eo3M=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=RyZVmH8HZuCCQ30ddm0tYfELji8MUzIwhfej2BqOWYJSdr2BBto9Hnu6EssT6YvbL OwnGxE0EdAhYiyhLvQSpiiG1Zj12TFpSSOxqo5Y2FUA7PuLrGj40Lx3FtheTtJvjwM wazbd9U5D1EYLp/l+1oFqy0VP3ubZPJvmovn92hw= Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 6A3223858D29 for ; Fri, 10 Sep 2021 20:54:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6A3223858D29 X-ASG-Debug-ID: 1631307245-0c856e0387270b60001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id ryPbrSEhDhOBtqJW (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 10 Sep 2021 16:54:05 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from epycamd.internal.efficios.com (173-246-27-5.qc.cable.ebox.net [173.246.27.5]) by smtp.ebox.ca (Postfix) with ESMTP id E939C441D67; Fri, 10 Sep 2021 16:54:04 -0400 (EDT) X-Barracuda-RBL-IP: 173.246.27.5 X-Barracuda-Effective-Source-IP: 173-246-27-5.qc.cable.ebox.net[173.246.27.5] X-Barracuda-Apparent-Source-IP: 173.246.27.5 To: gdb-patches@sourceware.org Subject: [PATCH 5/6] gdb.base/foll-fork.exp: use foreach_with_prefix to handle prefixes Date: Fri, 10 Sep 2021 16:54:01 -0400 X-ASG-Orig-Subj: [PATCH 5/6] gdb.base/foll-fork.exp: use foreach_with_prefix to handle prefixes Message-Id: <20210910205402.3853607-5-simon.marchi@efficios.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210910205402.3853607-1-simon.marchi@efficios.com> References: <20210910205402.3853607-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1631307245 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 8564 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.92507 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Cc: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" No behavior change in the test expected, other than in the test names. Change-Id: I111137483858ab0f23138439f2930009779a2b3d --- gdb/testsuite/gdb.base/foll-fork.exp | 165 +++++++++++++-------------- 1 file changed, 81 insertions(+), 84 deletions(-) diff --git a/gdb/testsuite/gdb.base/foll-fork.exp b/gdb/testsuite/gdb.base/foll-fork.exp index 3b90bb2e785..3a0cc2fe456 100644 --- a/gdb/testsuite/gdb.base/foll-fork.exp +++ b/gdb/testsuite/gdb.base/foll-fork.exp @@ -79,109 +79,106 @@ proc_with_prefix test_follow_fork { follow-fork-mode detach-on-fork cmd } { global srcfile global testfile - with_test_prefix "follow ${follow-fork-mode}, detach ${detach-on-fork}, command \"$cmd\"" { - - # Start a new debugger session each time so defaults are legitimate. - if { ![setup] } { - return - } + # Start a new debugger session each time so defaults are legitimate. + if { ![setup] } { + return + } - # The "Detaching..." and "Attaching..." messages may be hidden by - # default. - gdb_test_no_output "set verbose" + # The "Detaching..." and "Attaching..." messages may be hidden by + # default. + gdb_test_no_output "set verbose" - # Set follow-fork-mode if we aren't using the default. - if {${follow-fork-mode} == "default"} { - set follow-fork-mode "parent" - } else { - gdb_test_no_output "set follow-fork ${follow-fork-mode}" - } + # Set follow-fork-mode if we aren't using the default. + if {${follow-fork-mode} == "default"} { + set follow-fork-mode "parent" + } else { + gdb_test_no_output "set follow-fork ${follow-fork-mode}" + } - gdb_test "show follow-fork" \ - "Debugger response to a program call of fork or vfork is \"${follow-fork-mode}\"." + gdb_test "show follow-fork" \ + "Debugger response to a program call of fork or vfork is \"${follow-fork-mode}\"." - # Set detach-on-fork mode if we aren't using the default. - if {${detach-on-fork} == "default"} { - set detach-on-fork "on" - } else { - gdb_test_no_output "set detach-on-fork ${detach-on-fork}" - } + # Set detach-on-fork mode if we aren't using the default. + if {${detach-on-fork} == "default"} { + set detach-on-fork "on" + } else { + gdb_test_no_output "set detach-on-fork ${detach-on-fork}" + } - gdb_test "show detach-on-fork" \ - "Whether gdb will detach.* fork is ${detach-on-fork}." + gdb_test "show detach-on-fork" \ + "Whether gdb will detach.* fork is ${detach-on-fork}." - # Set a breakpoint after the fork if we aren't single-stepping - # past the fork. - if {$cmd == "continue"} { - set bp_after_fork [gdb_get_line_number "set breakpoint here"] - gdb_test "break ${srcfile}:$bp_after_fork" \ - "Breakpoint.*, line $bp_after_fork.*" \ - "set breakpoint after fork" - } + # Set a breakpoint after the fork if we aren't single-stepping + # past the fork. + if {$cmd == "continue"} { + set bp_after_fork [gdb_get_line_number "set breakpoint here"] + gdb_test "break ${srcfile}:$bp_after_fork" \ + "Breakpoint.*, line $bp_after_fork.*" \ + "set breakpoint after fork" + } - # Set up the output we expect to see after we run. - set expected_re "" - if {${follow-fork-mode} == "child"} { - set expected_re "\\\[Attaching after.* fork to.*" - if {${detach-on-fork} == "on"} { - append expected_re "\\\[Detaching after fork from .*" - } - append expected_re "set breakpoint here.*" - } elseif {${follow-fork-mode} == "parent" && ${detach-on-fork} == "on"} { - set expected_re "\\\[Detaching after fork from .*set breakpoint here.*" - } else { - set expected_re ".*set breakpoint here.*" + # Set up the output we expect to see after we run. + set expected_re "" + if {${follow-fork-mode} == "child"} { + set expected_re "\\\[Attaching after.* fork to.*" + if {${detach-on-fork} == "on"} { + append expected_re "\\\[Detaching after fork from .*" } + append expected_re "set breakpoint here.*" + } elseif {${follow-fork-mode} == "parent" && ${detach-on-fork} == "on"} { + set expected_re "\\\[Detaching after fork from .*set breakpoint here.*" + } else { + set expected_re ".*set breakpoint here.*" + } - # Test running past and following the fork, using the parameters - # set above. - gdb_test $cmd $expected_re "$cmd past fork" + # Test running past and following the fork, using the parameters + # set above. + gdb_test $cmd $expected_re "$cmd past fork" - # Check that we have the inferiors arranged correctly after - # following the fork. - set resume_unfollowed 0 - if {${follow-fork-mode} == "parent" && ${detach-on-fork} == "on"} { + # Check that we have the inferiors arranged correctly after + # following the fork. + set resume_unfollowed 0 + if {${follow-fork-mode} == "parent" && ${detach-on-fork} == "on"} { - # Follow parent / detach child: the only inferior is the parent. - gdb_test "info inferiors" "\\* 1 .* process.*" + # Follow parent / detach child: the only inferior is the parent. + gdb_test "info inferiors" "\\* 1 .* process.*" - } elseif {${follow-fork-mode} == "parent" && ${detach-on-fork} == "off"} { + } elseif {${follow-fork-mode} == "parent" && ${detach-on-fork} == "off"} { - # Follow parent / keep child: two inferiors under debug, the - # parent is the current inferior. - gdb_test "info inferiors" "\\* 1 .*process.* 2 .*process.*" + # Follow parent / keep child: two inferiors under debug, the + # parent is the current inferior. + gdb_test "info inferiors" "\\* 1 .*process.* 2 .*process.*" - gdb_test "inferior 2" "Switching to inferior 2 .*" - set resume_unfollowed 1 + gdb_test "inferior 2" "Switching to inferior 2 .*" + set resume_unfollowed 1 - } elseif {${follow-fork-mode} == "child" && ${detach-on-fork} == "on"} { + } elseif {${follow-fork-mode} == "child" && ${detach-on-fork} == "on"} { - # Follow child / detach parent: the child is under debug and is - # the current inferior. The parent is listed but is not under - # debug. - gdb_test "info inferiors" " 1 .*.*\\* 2 .*process.*" + # Follow child / detach parent: the child is under debug and is + # the current inferior. The parent is listed but is not under + # debug. + gdb_test "info inferiors" " 1 .*.*\\* 2 .*process.*" - } elseif {${follow-fork-mode} == "child" && ${detach-on-fork} == "off"} { + } elseif {${follow-fork-mode} == "child" && ${detach-on-fork} == "off"} { - # Follow child / keep parent: two inferiors under debug, the - # child is the current inferior. - gdb_test "info inferiors" " 1 .*process.*\\* 2 .*process.*" + # Follow child / keep parent: two inferiors under debug, the + # child is the current inferior. + gdb_test "info inferiors" " 1 .*process.*\\* 2 .*process.*" - gdb_test "inferior 1" "Switching to inferior 1 .*" - set resume_unfollowed 1 - } + gdb_test "inferior 1" "Switching to inferior 1 .*" + set resume_unfollowed 1 + } - if {$resume_unfollowed == 1} { - if {$cmd == "next 2"} { + if {$resume_unfollowed == 1} { + if {$cmd == "next 2"} { - gdb_continue_to_end "continue unfollowed inferior to end" + gdb_continue_to_end "continue unfollowed inferior to end" - } elseif {$cmd == "continue"} { + } elseif {$cmd == "continue"} { - gdb_continue_to_breakpoint \ - "continue unfollowed inferior to bp" \ - ".* set breakpoint here.*" - } + gdb_continue_to_breakpoint \ + "continue unfollowed inferior to bp" \ + ".* set breakpoint here.*" } } } @@ -395,14 +392,14 @@ if { ![check_fork_catchpoints] } { # The first loop should be sufficient to test the defaults. There # is no need to test using the defaults in other permutations (e.g. # "default" "on", "parent" "default", etc.). -foreach cmd {"next 2" "continue"} { +foreach_with_prefix cmd {"next 2" "continue"} { test_follow_fork "default" "default" $cmd } # Now test all explicit permutations. -foreach follow-fork-mode {"parent" "child"} { - foreach detach-on-fork {"on" "off"} { - foreach cmd {"next 2" "continue"} { +foreach_with_prefix follow-fork-mode {"parent" "child"} { + foreach_with_prefix detach-on-fork {"on" "off"} { + foreach_with_prefix cmd {"next 2" "continue"} { test_follow_fork ${follow-fork-mode} ${detach-on-fork} $cmd } } -- 2.33.0