From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 66617 invoked by alias); 14 Apr 2015 16:35:36 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 66603 invoked by uid 89); 14 Apr 2015 16:35:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f175.google.com Received: from mail-pd0-f175.google.com (HELO mail-pd0-f175.google.com) (209.85.192.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 14 Apr 2015 16:35:34 +0000 Received: by pdbnk13 with SMTP id nk13so17991292pdb.0 for ; Tue, 14 Apr 2015 09:35:32 -0700 (PDT) X-Received: by 10.70.1.75 with SMTP id 11mr38152802pdk.147.1429029332877; Tue, 14 Apr 2015 09:35:32 -0700 (PDT) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by mx.google.com with ESMTPSA id m8sm1594125pdn.5.2015.04.14.09.35.30 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 14 Apr 2015 09:35:31 -0700 (PDT) From: Yao Qi To: Pedro Alves Cc: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH] Increase timeout in watch-bitfields.exp for software watchpoint References: <1429023644-13403-1-git-send-email-qiyaoltc@gmail.com> <552D31E4.1080503@redhat.com> Date: Tue, 14 Apr 2015 16:35:00 -0000 In-Reply-To: <552D31E4.1080503@redhat.com> (Pedro Alves's message of "Tue, 14 Apr 2015 16:27:32 +0100") Message-ID: <86a8yau0qb.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00533.txt.bz2 Pedro Alves writes: >> # Check that -location watchpoints against bitfields trigger properly. >> proc test_watch_location {} { >> + global timeout >> + > > Why did you need this? > Because the initial implementation is not to use with_timeout_factor, and save/restore timeout directly as what the old code does. After I read the mail archive, I decide to factor code out into proc with_timeout_factor, but forget to remove "global timeout". >>=20=20 >> +# Run tests in BODY with timeout increased by factor of FACTOR. When >> +# BODY is finished, restore timeout. >> + >> +proc with_timeout_factor { factor body } { >> + global timeout >> + >> + set savedtimeout $timeout >> + if { [target_info exists gdb,timeout] >> + && $timeout < [target_info gdb,timeout] } { >> + set oldtimeout [target_info gdb,timeout] >> + } else { >> + set oldtimeout $timeout >> + } >> + set timeout [expr $oldtimeout * $factor] > > The "timeout" variable is special. gdb_test/gdb_test_multiple/expect > will take into account a local "timeout" variable in the callers > scope too, not just the global. So this should be taking that > into account as well. The old code didn't need to do that because it > was code at the global scope. See the upvars in gdb_expect. I think > we should do the same here. We should probably move > that "get me highest timeout" bit of code to a shared > procedure (adjusted to "upvar 2 timeout timeout", most likely). I don't think I fully understand you... Why do we need such shared proc to get timeout? Isn't simpler to just use "upvar timeout timeout" at the beginning of with_timeout_factor? like this: proc with_timeout_factor { factor body } { upvar timeout timeout and in watch-bitfields.exp proc test_watch_location and test_regular_watch, use "global timeout"? --=20 Yao (=E9=BD=90=E5=B0=A7)