Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 1/3] [gdb/testsuite] Rename variable in test-case gdb.base/attach-twice.exp
Date: Mon, 23 Nov 2026 14:03:46 +0100	[thread overview]
Message-ID: <20261123130348.767273-2-tdevries@suse.de> (raw)
In-Reply-To: <20261123130348.767273-1-tdevries@suse.de>

Test-case gdb.base/attach-twice.exp uses an inferior calling fork, resulting
in a parent and child process.

For cleanup, it:
- kills the parent process using kill_wait_spawned_process
- opportunistically kills the child process, if gdb printed it in reaction to
  attach

However, the child process is tracked in a variable called parentpid.

Rename the parentpid variable to the more appropriate child_pid.
---
 gdb/testsuite/gdb.base/attach-twice.exp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/gdb.base/attach-twice.exp b/gdb/testsuite/gdb.base/attach-twice.exp
index a3677f2fad9..e2db55187d2 100644
--- a/gdb/testsuite/gdb.base/attach-twice.exp
+++ b/gdb/testsuite/gdb.base/attach-twice.exp
@@ -28,12 +28,12 @@ if { [prepare_for_testing "failed to prepare" $executable] } {
 set test_spawn_id [spawn_wait_for_attach $binfile]
 set testpid [spawn_id_get_pid $test_spawn_id]
 
-set parentpid 0
+set child_pid 0
 
 set test "attach"
 gdb_test_multiple "attach $testpid" $test {
     -re "Attaching to program: \[^\r\n\]*, process $testpid\r\n.*warning: process $testpid is already traced by process (${::decimal})\r\n.*ptrace: Operation not permitted\\.\r\n$gdb_prompt $" {
-	set parentpid $expect_out(1,string)
+	set child_pid $expect_out(1,string)
 	pass $test
     }
     -re "Attaching to program: \[^\r\n\]*, process $testpid\r\n.*ptrace: Operation not permitted\\.\r\n$gdb_prompt $" {
@@ -44,7 +44,7 @@ gdb_test_multiple "attach $testpid" $test {
     }
 }
 
-if {$parentpid != 0} {
-    exec kill -9 $parentpid
+if {$child_pid != 0} {
+    exec kill -9 $child_pid
 }
 kill_wait_spawned_process $test_spawn_id
-- 
2.51.0


  reply	other threads:[~2026-11-23 13:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 13:03 [pushed 0/3] [gdb/testsuite] Modernize two test-cases Tom de Vries
2026-11-23 13:03 ` Tom de Vries [this message]
2026-11-23 13:03 ` [pushed 2/3] [gdb/testsuite] Modernize gdb.base/attach-twice.exp Tom de Vries
2026-11-23 13:03 ` [pushed 3/3] [gdb/testsuite] Modernize gdb.base/attach-non-pgrp-leader.exp Tom de Vries

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=20261123130348.767273-2-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /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