Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 4/6] gdb.base/foll-fork.exp: rename variables
Date: Fri, 10 Sep 2021 16:54:00 -0400	[thread overview]
Message-ID: <20210910205402.3853607-4-simon.marchi@efficios.com> (raw)
In-Reply-To: <20210910205402.3853607-1-simon.marchi@efficios.com>

Rename the variables / parameters used to match the corresponding GDB
setting name, I find that easier to follow.

Change-Id: Idcbddbbb369279fcf1e808b11a8c478f21b2a946
---
 gdb/testsuite/gdb.base/foll-fork.exp | 40 ++++++++++++++--------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/gdb/testsuite/gdb.base/foll-fork.exp b/gdb/testsuite/gdb.base/foll-fork.exp
index 4661bf56a52..3b90bb2e785 100644
--- a/gdb/testsuite/gdb.base/foll-fork.exp
+++ b/gdb/testsuite/gdb.base/foll-fork.exp
@@ -74,12 +74,12 @@ proc_with_prefix check_fork_catchpoints {} {
 # execute the program past the fork.  If the value of WHO or DETACH is
 # 'default', the corresponding GDB command is skipped for that test.
 # The value of CMD must be either 'next 2' or 'continue'.
-proc_with_prefix test_follow_fork { who detach cmd } {
+proc_with_prefix test_follow_fork { follow-fork-mode detach-on-fork cmd } {
     global gdb_prompt
     global srcfile
     global testfile
 
-    with_test_prefix "follow $who, detach $detach, command \"$cmd\"" {
+    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] } {
@@ -91,24 +91,24 @@ proc_with_prefix test_follow_fork { who detach cmd } {
 	gdb_test_no_output "set verbose"
 
 	# Set follow-fork-mode if we aren't using the default.
-	if {$who == "default"} {
-	    set who "parent"
+	if {${follow-fork-mode} == "default"} {
+	    set follow-fork-mode "parent"
 	} else {
-	    gdb_test_no_output "set follow-fork $who"
+	    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 \"$who\"."
+	"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 == "default"} {
-	    set detach "on"
+	if {${detach-on-fork} == "default"} {
+	    set detach-on-fork "on"
 	} else {
-	    gdb_test_no_output "set detach-on-fork $detach"
+	    gdb_test_no_output "set detach-on-fork ${detach-on-fork}"
 	}
 
 	gdb_test "show detach-on-fork" \
-		 "Whether gdb will detach.* fork is $detach."
+		 "Whether gdb will detach.* fork is ${detach-on-fork}."
 
 	# Set a breakpoint after the fork if we aren't single-stepping
 	# past the fork.
@@ -121,13 +121,13 @@ proc_with_prefix test_follow_fork { who detach cmd } {
 
 	# Set up the output we expect to see after we run.
 	set expected_re ""
-	if {$who == "child"} {
+	if {${follow-fork-mode} == "child"} {
 	    set expected_re "\\\[Attaching after.* fork to.*"
-	    if {$detach == "on"} {
+	    if {${detach-on-fork} == "on"} {
 		append expected_re "\\\[Detaching after fork from .*"
 	    }
 	    append expected_re "set breakpoint here.*"
-	} elseif {$who == "parent" && $detach == "on"} {
+	} 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.*"
@@ -140,12 +140,12 @@ proc_with_prefix test_follow_fork { who detach cmd } {
 	# Check that we have the inferiors arranged correctly after 
 	# following the fork.
 	set resume_unfollowed 0
-	if {$who == "parent" && $detach == "on"} {
+	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.*"
 
-	} elseif {$who == "parent" && $detach == "off"} {
+	} elseif {${follow-fork-mode} == "parent" && ${detach-on-fork} == "off"} {
 
 	    # Follow parent / keep child: two inferiors under debug, the
 	    # parent is the current inferior.
@@ -154,14 +154,14 @@ proc_with_prefix test_follow_fork { who detach cmd } {
 	    gdb_test "inferior 2" "Switching to inferior 2 .*"
 	    set resume_unfollowed 1
 
-	} elseif {$who == "child" && $detach == "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 .*<null>.*\\* 2 .*process.*"
 
-	} elseif {$who == "child" && $detach == "off"} {
+	} elseif {${follow-fork-mode} == "child" && ${detach-on-fork} == "off"} {
 
 	    # Follow child / keep parent: two inferiors under debug, the
 	    # child is the current inferior.
@@ -400,10 +400,10 @@ foreach cmd {"next 2" "continue"} {
 }
 
 # Now test all explicit permutations.
-foreach who {"parent" "child"} {
-    foreach detach {"on" "off"} {
+foreach follow-fork-mode {"parent" "child"} {
+    foreach detach-on-fork {"on" "off"} {
 	foreach cmd {"next 2" "continue"} {
-	    test_follow_fork $who $detach $cmd
+	    test_follow_fork ${follow-fork-mode} ${detach-on-fork} $cmd
 	}
     }
 }
-- 
2.33.0


  parent reply	other threads:[~2021-09-10 20:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 20:53 [PATCH 1/6] gdb.base/foll-fork.exp: remove DUPLICATEs Simon Marchi via Gdb-patches
2021-09-10 20:53 ` [PATCH 2/6] gdb.base/foll-fork.exp: remove gating based on target triplet Simon Marchi via Gdb-patches
2021-09-10 20:53 ` [PATCH 3/6] gdb.base/foll-fork.exp: refactor to restart GDB between each portion of the test Simon Marchi via Gdb-patches
2021-09-10 20:54 ` Simon Marchi via Gdb-patches [this message]
2021-09-10 20:54 ` [PATCH 5/6] gdb.base/foll-fork.exp: use foreach_with_prefix to handle prefixes Simon Marchi via Gdb-patches
2021-09-10 20:54 ` [PATCH 6/6] gdb: don't share aspace/pspace on fork with "detach-on-fork on" and "follow-fork-mode child" Simon Marchi via Gdb-patches
2021-09-10 23:33   ` John Baldwin
2021-09-11  3:16     ` Simon Marchi via Gdb-patches
2021-09-11 13:02       ` Simon Marchi via Gdb-patches
2021-09-11 13:03         ` Simon Marchi via Gdb-patches
2021-09-27 19:32       ` Simon Marchi via Gdb-patches
2021-09-28 15:10         ` Tom de Vries via Gdb-patches
2021-09-28 19:12           ` Simon Marchi via Gdb-patches
2021-09-28 19:31             ` Pedro Alves
2021-09-28 19:35               ` Pedro Alves
2021-09-28 23:32                 ` Simon Marchi via Gdb-patches
2021-09-28 22:38             ` Tom de Vries via Gdb-patches
2021-09-23 19:23 ` [PATCH 1/6] gdb.base/foll-fork.exp: remove DUPLICATEs Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210910205402.3853607-4-simon.marchi@efficios.com \
    --to=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox