[binutils-gdb] gdb/testsuite: use proc_with_prefix in gdb.base/attach.exp

Simon Marchi simark@sourceware.org
Mon Jun 7 15:21:39 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f1854e35d87ac3237e0d7a10224a1eff42e65297

commit f1854e35d87ac3237e0d7a10224a1eff42e65297
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Mon Jun 7 11:18:35 2021 -0400

    gdb/testsuite: use proc_with_prefix in gdb.base/attach.exp
    
    Use proc_with_prefix for test_command_line_attach_run, as we do for
    other procs.
    
    gdb/testsuite/ChangeLog:
    
            * gdb.base/attach.exp (test_command_line_attach_run): Use
            proc_with_prefix.
    
    Change-Id: I47b61bb91b6ac0570ad7556a824f874ea50c7cda

Diff:
---
 gdb/testsuite/ChangeLog           |  5 ++++
 gdb/testsuite/gdb.base/attach.exp | 50 +++++++++++++++++++--------------------
 2 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 1524b829c87..5565cedd396 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2021-06-07  Simon Marchi  <simon.marchi@polymtl.ca>
+
+	* gdb.base/attach.exp (test_command_line_attach_run): Use
+	proc_with_prefix.
+
 2021-06-07  Tom de Vries  <tdevries@suse.de>
 
 	PR testsuite/27908
diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
index 96466559b43..b0ded430bb2 100644
--- a/gdb/testsuite/gdb.base/attach.exp
+++ b/gdb/testsuite/gdb.base/attach.exp
@@ -468,7 +468,7 @@ proc_with_prefix do_command_attach_tests {} {
 # Test ' gdb --pid PID -ex "run" '.  GDB used to have a bug where
 # "run" would run before the attach finished - PR17347.
 
-proc test_command_line_attach_run {} {
+proc_with_prefix test_command_line_attach_run {} {
     global gdb_prompt
     global binfile
 
@@ -482,38 +482,36 @@ proc test_command_line_attach_run {} {
 	return 0
     }
 
-    with_test_prefix "cmdline attach run" {
-	set test_spawn_id [spawn_wait_for_attach $binfile]
-	set testpid [spawn_id_get_pid $test_spawn_id]
+    set test_spawn_id [spawn_wait_for_attach $binfile]
+    set testpid [spawn_id_get_pid $test_spawn_id]
 
-	set test "run to prompt"
-	gdb_exit
+    set test "run to prompt"
+    gdb_exit
 
-	set res [gdb_spawn_with_cmdline_opts \
-		     "-quiet -iex \"set height 0\" -iex \"set width 0\" --pid=$testpid -ex \"start\""]
-	if { $res != 0} {
-	    fail $test
-	    kill_wait_spawned_process $test_spawn_id
-	    return $res
-	}
-	gdb_test_multiple "" $test {
-	    -re {Attaching to.*Start it from the beginning\? \(y or n\) } {
-		pass $test
-	    }
+    set res [gdb_spawn_with_cmdline_opts \
+		 "-quiet -iex \"set height 0\" -iex \"set width 0\" --pid=$testpid -ex \"start\""]
+    if { $res != 0} {
+	fail $test
+	kill_wait_spawned_process $test_spawn_id
+	return $res
+    }
+    gdb_test_multiple "" $test {
+	-re {Attaching to.*Start it from the beginning\? \(y or n\) } {
+	    pass $test
 	}
+    }
 
-	send_gdb "y\n"
+    send_gdb "y\n"
 
-	set test "run to main"
-	gdb_test_multiple "" $test {
-	    -re "Temporary breakpoint .* main .*$gdb_prompt $" {
-		pass $test
-	    }
+    set test "run to main"
+    gdb_test_multiple "" $test {
+	-re "Temporary breakpoint .* main .*$gdb_prompt $" {
+	    pass $test
 	}
-
-	# Get rid of the process
-	kill_wait_spawned_process $test_spawn_id
     }
+
+    # Get rid of the process
+    kill_wait_spawned_process $test_spawn_id
 }


More information about the Gdb-cvs mailing list