From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118594 invoked by alias); 14 Apr 2015 15:27:40 -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 118580 invoked by uid 89); 14 Apr 2015 15:27:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 14 Apr 2015 15:27:37 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3EFRYKx024589 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 14 Apr 2015 11:27:34 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3EFRWRp007813; Tue, 14 Apr 2015 11:27:33 -0400 Message-ID: <552D31E4.1080503@redhat.com> Date: Tue, 14 Apr 2015 15:27:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: 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> In-Reply-To: <1429023644-13403-1-git-send-email-qiyaoltc@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-04/txt/msg00529.txt.bz2 On 04/14/2015 04:00 PM, Yao Qi wrote: > From: Yao Qi > > I see the following two timeout fails on pandaboard (arm-linux target), > > FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: continue until exit (timeout) > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: continue until exit (timeout) > > In this test, more than one watchpoint is used, so the following > watchpoint requests fall back to software watchpoint, so that GDB > will single step all the way and it is very slow. > > This patch is to copy the fix from > > [PATCH] GDB/testsuite: Correct gdb.base/watchpoint-solib.exp timeout tweak > https://sourceware.org/ml/gdb-patches/2014-07/msg00716.html > > I find the left-over of this patch review is to factor out code into > a procedure, so I do that in this patch. Thank you! > # Check that -location watchpoints against bitfields trigger properly. > proc test_watch_location {} { > + global timeout > + Why did you need this? > with_test_prefix "-location watch against bitfields" { > if {![runto_main]} { > return -1 > @@ -54,13 +56,22 @@ proc test_watch_location {} { > expect_watchpoint "q.e" 0 5 > expect_watchpoint "q.a" 1 0 > expect_watchpoint "q.e" 5 4 > - gdb_continue_to_end > + > + # It'll execute a large amount of code with software watchpoint > + # enabled, which means GDB will single stepping all the way > + # through til the inferior exits. Increase the timeout by a > + # factor of 4. > + with_timeout_factor 4 { > + gdb_continue_to_end > + } > } > } > > # Check that regular watchpoints against expressions involving > # bitfields trigger properly. > proc test_regular_watch {} { > + global timeout > + Likewise? > > +# 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). Thanks, Pedro Alves