From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id DC2643858CDB for ; Mon, 28 Nov 2022 11:43:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DC2643858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669635821; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XfY185VJi6prUgadU+u6lj4u5tjra5JQcQHf5ZoE7i4=; b=N010EG9aDKGFryGXwBqxvLDw0nD8LJPhLEa2Pv/2iu2bguW4pDkhczdPtAQrduyoSihSZH LWmeR1LmNhn0h0sMgclfqO5Vc2ti129cydp7ZwZ4Pi7c52l71YvX6J2G13zVwoHovNk0CJ HTNQFJOsMRHorCgs8ehupxvXFHF5Qjg= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-265-XaWshM9ZMJW31qENDVNBTQ-1; Mon, 28 Nov 2022 06:43:35 -0500 X-MC-Unique: XaWshM9ZMJW31qENDVNBTQ-1 Received: by mail-wr1-f70.google.com with SMTP id o10-20020adfa10a000000b00241f603af8dso1829592wro.11 for ; Mon, 28 Nov 2022 03:43:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XfY185VJi6prUgadU+u6lj4u5tjra5JQcQHf5ZoE7i4=; b=cRBx3bP8mk/qO+MkGMJxA5qg9i3rKkAcHx/uJBNXIAmOJ2PfGuN9axyB6Dx0sprEKS EiwQbXfgorTDhJUEcqRjCWdXyIl4Qme+YZowM+P4CCkgATh5qiEaJAobn1irs7pT6s9A Da7oHA/ArGpF2zJZJiYaDGeFEPqnZILzeIYsgH+87MlO4vYf/b1eXKz6ZgntUNgK+lRt V38nE0Ilk9NjrephWiiMsJezVBXuW53wjeyrWPKo7A6CH7CWGbqrbMxpAYzo1emov7bS nucgZuGlP8KjDvAO8xwbD+ZUBaT4X51KyYiJoPXVYANjLSPryhlPyUP62tdru398SPuL quXg== X-Gm-Message-State: ANoB5plwVs/deBdriET6E3f9k1hHO25Nmz3BaR14kQgFB6sPhw+VTihG jnztfu7wuXSqJdbzCrNk2oVLP+RaGKfSbFVw7HWdrI1+/CLIEmZW7Hvh3/QfIScfD8VUI6B76DL VvyehXGa4zgzWMpkqI8ZWYQ== X-Received: by 2002:adf:f84e:0:b0:22e:46be:5bc9 with SMTP id d14-20020adff84e000000b0022e46be5bc9mr32878605wrq.378.1669635814290; Mon, 28 Nov 2022 03:43:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Wqa8H4ccgfMb1QD37gf8ce/DeL05AXFrKREeEkdzpTmIMAU+muuZc1knBzaiQ7Wu8t/UW3w== X-Received: by 2002:adf:f84e:0:b0:22e:46be:5bc9 with SMTP id d14-20020adff84e000000b0022e46be5bc9mr32878585wrq.378.1669635814063; Mon, 28 Nov 2022 03:43:34 -0800 (PST) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id n16-20020a5d4c50000000b00242152e06f9sm3414256wrt.116.2022.11.28.03.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 03:43:33 -0800 (PST) From: Andrew Burgess To: Simon Marchi , gdb-patches@sourceware.org Cc: Simon Marchi Subject: Re: [PATCH v2 1/5] gdb/testsuite: remove global declarations in gdb.threads/detach-step-over.exp In-Reply-To: <20221121171213.1414366-2-simon.marchi@polymtl.ca> References: <20221121171213.1414366-1-simon.marchi@polymtl.ca> <20221121171213.1414366-2-simon.marchi@polymtl.ca> Date: Mon, 28 Nov 2022 11:43:32 +0000 Message-ID: <87lenv2tjv.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 List-Id: Simon Marchi via Gdb-patches writes: > From: Simon Marchi > > Before doing further changes to this file, change to use the :: notation > instead of declaring global variables with the `global` keyword. LGTM. Thanks, Andrew > > Change-Id: I72301fd8f4693fea61aac054ba17245a1f4442fb > --- > .../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 15af7e0e7231..917be2ef3782 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 > } > } > -- > 2.38.1