From patchwork Mon Nov 28 18:40:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61183 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 74E6338532C7 for ; Mon, 28 Nov 2022 18:41:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74E6338532C7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669660890; bh=ex7MB+d5oo1LC5HSePuOKWcZ0s4z8+5Eumj8Iy58DAw=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=ZGN3v6Cq0sVvol51F7L+fYFTP3A7XvbRKQBoDFlpKr7OHQ0tRiJz2o42DWgnij3vJ XML6yB0peL1PzR5Ib+EK1ANSKc7P0g0wKaDnkNuAgy4pnWyAiImsGImJkqfR8608Fn 9gJh+75KHTunCxxnTAFMZTl9UKFeniOCcgWofpJc= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 1F6FA3857C51 for ; Mon, 28 Nov 2022 18:40:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1F6FA3857C51 X-ASG-Debug-ID: 1669660845-0c856e02a043f3a0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id AHGRCDNTfAv3E6B6 (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO); Mon, 28 Nov 2022 13:40:45 -0500 (EST) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from epycamd.internal.efficios.com (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) by smtp.ebox.ca (Postfix) with ESMTP id A19AE441B21; Mon, 28 Nov 2022 13:40:45 -0500 (EST) X-Barracuda-RBL-IP: 192.222.180.24 X-Barracuda-Effective-Source-IP: 192-222-180-24.qc.cable.ebox.net[192.222.180.24] X-Barracuda-Apparent-Source-IP: 192.222.180.24 To: gdb-patches@sourceware.org Cc: Simon Marchi , Andrew Burgess Subject: [PATCH gdb-12-branch 2/6] gdb/testsuite: remove global declarations in gdb.threads/detach-step-over.exp Date: Mon, 28 Nov 2022 13:40:38 -0500 X-ASG-Orig-Subj: [PATCH gdb-12-branch 2/6] gdb/testsuite: remove global declarations in gdb.threads/detach-step-over.exp Message-Id: <20221128184042.3781569-3-simon.marchi@efficios.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221128184042.3781569-1-simon.marchi@efficios.com> References: <20221128184042.3781569-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1669660845 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 4886 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.102463 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-3498.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Before doing further changes to this file, change to use the :: notation instead of declaring global variables with the `global` keyword. Change-Id: I72301fd8f4693fea61aac054ba17245a1f4442fb Approved-By: Andrew Burgess --- .../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"] # 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 - 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 } - 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] set any "\[^\r\n\]*" @@ -83,7 +77,7 @@ proc test {condition_eval target_non_stop non_stop displaced} { gdb_test "add-inferior" "Added inferior 2.*" gdb_test "inferior 2" "Switching to .*" - 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 displaced} { # Get the PID of the test process. set pid_inf2 "" gdb_test_multiple "p mypid" "get pid of inferior 2" { - -re " = ($decimal)\r\n$gdb_prompt $" { + -re " = ($::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 displaced} { # 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 displaced} { } # 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" if {$attempt < $attempts} { @@ -192,7 +186,7 @@ proc test {condition_eval target_non_stop non_stop displaced} { 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 displaced} { incr running_count exp_continue } - -re "Cannot execute this command while the target is running.*$gdb_prompt $" { + -re "Cannot execute this command while the target is running.*$::gdb_prompt $" { # 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 displaced} { } } } - -re "$gdb_prompt $" { + -re "$::gdb_prompt $" { gdb_assert {$running_count == ($n_threads + 1) * 2} $gdb_test_name } }