Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: Yao Qi <qiyaoltc@gmail.com>,  gdb-patches@sourceware.org
Subject: Re: [PATCH] Increase timeout in watch-bitfields.exp for software watchpoint
Date: Tue, 14 Apr 2015 16:35:00 -0000	[thread overview]
Message-ID: <86a8yau0qb.fsf@gmail.com> (raw)
In-Reply-To: <552D31E4.1080503@redhat.com> (Pedro Alves's message of "Tue, 14	Apr 2015 16:27:32 +0100")

Pedro Alves <palves@redhat.com> 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".

>>  
>> +# 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"?

-- 
Yao (齐尧)


  reply	other threads:[~2015-04-14 16:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-14 15:01 Yao Qi
2015-04-14 15:27 ` Pedro Alves
2015-04-14 16:35   ` Yao Qi [this message]
2015-04-14 17:05     ` Pedro Alves
2015-04-15  9:17       ` Yao Qi
2015-04-15 11:00         ` Pedro Alves
2015-04-15 11:48           ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86a8yau0qb.fsf@gmail.com \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox