From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 83E2E3858C62; Mon, 28 Nov 2022 13:02:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 83E2E3858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669640574; bh=liW7r4Scl4TkjP4uJrJP5piI6q/5LNLerxWM7+inHAE=; h=From:To:Subject:Date:From; b=VmSHmq+f8h96DHSzgL8IaSBg/n9dYASIvWLjlQUTQF4JrlXyTH5BZG8qr90ngEM/g tRfXwM5rCf0MhSCKWCRhC+4WFlJo2bLQ3RrfgikwP3hgZrUnSnhX/Ilggb1hTQXWR4 Oa2mw1oGXOkEuDqI9RSm4ucj6guICYlMMwKAoY14= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: remove global declarations in gdb.threads/detach-step-over.exp X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 85819864f7cbf813cde00cf3bed30a38414e1bd8 X-Git-Newrev: dc41f7e87e73e999999cfbe1fa3a6a23f90bad5f Message-Id: <20221128130254.83E2E3858C62@sourceware.org> Date: Mon, 28 Nov 2022 13:02:54 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Ddc41f7e87e73= e999999cfbe1fa3a6a23f90bad5f commit dc41f7e87e73e999999cfbe1fa3a6a23f90bad5f Author: Simon Marchi Date: Mon Nov 21 12:12:09 2022 -0500 gdb/testsuite: remove global declarations in gdb.threads/detach-step-ov= er.exp =20 Before doing further changes to this file, change to use the :: notation instead of declaring global variables with the `global` keyword. =20 Change-Id: I72301fd8f4693fea61aac054ba17245a1f4442fb Approved-By: Andrew Burgess Diff: --- gdb/testsuite/gdb.threads/detach-step-over.exp | 40 +++++++++++-----------= ---- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/gdb/testsuite/gdb.threads/detach-step-over.exp b/gdb/testsuite= /gdb.threads/detach-step-over.exp index 15af7e0e723..917be2ef378 100644 --- a/gdb/testsuite/gdb.threads/detach-step-over.exp +++ b/gdb/testsuite/gdb.threads/detach-step-over.exp @@ -58,24 +58,18 @@ set bp_lineno [gdb_get_line_number "Set breakpoint here= "] =20 # The test proper. See description above. proc test {condition_eval target_non_stop non_stop displaced} { - global binfile srcfile - global gdb_prompt - global decimal - global bp_lineno - global GDBFLAGS - # Number of threads started by the program. set n_threads 10 =20 - save_vars { GDBFLAGS } { - append GDBFLAGS " -ex \"maint set target-non-stop $target_non_stop\"" - append GDBFLAGS " -ex \"set non-stop $non_stop\"" - append GDBFLAGS " -ex \"set displaced $displaced\"" - append GDBFLAGS " -ex \"set schedule-multiple on\"" - clean_restart $binfile + save_vars { ::GDBFLAGS } { + append ::GDBFLAGS " -ex \"maint set target-non-stop $target_non_stop\"" + append ::GDBFLAGS " -ex \"set non-stop $non_stop\"" + append ::GDBFLAGS " -ex \"set displaced $displaced\"" + append ::GDBFLAGS " -ex \"set schedule-multiple on\"" + clean_restart $::binfile } =20 - set test_spawn_id [spawn_wait_for_attach $binfile] + set test_spawn_id [spawn_wait_for_attach $::binfile] set testpid [spawn_id_get_pid $test_spawn_id] =20 set any "\[^\r\n\]*" @@ -83,7 +77,7 @@ proc test {condition_eval target_non_stop non_stop displa= ced} { gdb_test "add-inferior" "Added inferior 2.*" gdb_test "inferior 2" "Switching to .*" =20 - gdb_load $binfile + gdb_load $::binfile if ![runto setup_done] then { fail "can't run to setup_done" kill_wait_spawned_process $test_spawn_id @@ -95,7 +89,7 @@ proc test {condition_eval target_non_stop non_stop displa= ced} { # Get the PID of the test process. set pid_inf2 "" gdb_test_multiple "p mypid" "get pid of inferior 2" { - -re " =3D ($decimal)\r\n$gdb_prompt $" { + -re " =3D ($::decimal)\r\n$::gdb_prompt $" { set pid_inf2 $expect_out(1,string) pass $gdb_test_name } @@ -124,13 +118,13 @@ proc test {condition_eval target_non_stop non_stop di= splaced} { # Prevent -readnow timeout. exp_continue } - -re "is a zombie - the process has already terminated.*$gdb_prompt "= { + -re "is a zombie - the process has already terminated.*$::gdb_prompt= " { fail $gdb_test_name } - -re "Unable to attach: .*$gdb_prompt " { + -re "Unable to attach: .*$::gdb_prompt " { fail $gdb_test_name } - -re "\r\n$gdb_prompt " { + -re "\r\n$::gdb_prompt " { if { $saw_attaching } { set attached 1 pass $test @@ -173,7 +167,7 @@ proc test {condition_eval target_non_stop non_stop disp= laced} { } =20 # Set threads stepping over a breakpoint continuously. - gdb_test "break $srcfile:$bp_lineno if 0" "Breakpoint.*" \ + gdb_test "break $::srcfile:$::bp_lineno if 0" "Breakpoint.*" \ "break LOC if 0" =20 if {$attempt < $attempts} { @@ -192,7 +186,7 @@ proc test {condition_eval target_non_stop non_stop disp= laced} { =20 set cont_cmd_re [string_to_regexp $cont_cmd] gdb_test_multiple $cont_cmd "" { - -re "^$cont_cmd_re\r\nContinuing\.\r\n$gdb_prompt " { + -re "^$cont_cmd_re\r\nContinuing\.\r\n$::gdb_prompt " { pass $gdb_test_name } } @@ -208,14 +202,14 @@ proc test {condition_eval target_non_stop non_stop di= splaced} { incr running_count exp_continue } - -re "Cannot execute this command while the target is running.*$gdb_promp= t $" { + -re "Cannot execute this command while the target is running.*$::gdb_pro= mpt $" { # Testing against a remote server that doesn't do # non-stop mode. Explicitly interrupt. This # doesn't test the same code paths in GDB, but # it's still something. set interrupted 1 gdb_test_multiple "interrupt" "" { - -re "$gdb_prompt " { + -re "$::gdb_prompt " { gdb_test_multiple "" $gdb_test_name { -re "received signal SIGINT, Interrupt" { pass $gdb_test_name @@ -224,7 +218,7 @@ proc test {condition_eval target_non_stop non_stop disp= laced} { } } } - -re "$gdb_prompt $" { + -re "$::gdb_prompt $" { gdb_assert {$running_count =3D=3D ($n_threads + 1) * 2} $gdb_test_na= me } }