From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31372 invoked by alias); 29 Feb 2016 16:17:19 -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 31350 invoked by uid 89); 29 Feb 2016 16:17:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=kevin, looping, n*, U*palves 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; Mon, 29 Feb 2016 16:17:16 +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 (Postfix) with ESMTPS id E56A0C062C87 for ; Mon, 29 Feb 2016 16:17:14 +0000 (UTC) Received: from pinnacle.lan ([10.3.113.17]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1TGHDDQ015292 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA256 bits=256 verify=NO) for ; Mon, 29 Feb 2016 11:17:14 -0500 Date: Mon, 29 Feb 2016 16:17:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: Re: [PATCH 1/8] Add new test, gdb.base/loop-break.exp Message-ID: <20160229091711.12ec1e62@pinnacle.lan> In-Reply-To: <20160201130023.2850ee36@pinnacle.lan> References: <20150818235334.1afb0c85@pinnacle.lan> <20150818235756.23c9d7db@pinnacle.lan> <55DC5B1E.3050407@redhat.com> <20150917175008.27fd125d@pinnacle.lan> <20160201130023.2850ee36@pinnacle.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-02/txt/msg00888.txt.bz2 Ping. On Mon, 1 Feb 2016 13:00:23 -0700 Kevin Buettner wrote: > Ping. > > I started to sent a ping for the 0/8 post, but decided instead to send > a ping for the latest version of the 1/8 patch, which is the test case. > > I'd really like to see this test case go in, even if the rest of it > doesn't. > > I should note that if the rest doesn't go in, I ought to rewrite the > test case somewhat to use KFAIL on the part that's known to fail (and > for which we're waiting for help from the compiler) in addition to > structuring it so that we don't get cascade failures from the first > part of the test. > > That said, if the rest of the patch series goes in, along with the > test case, I won't need modify the test case. > > Thoughts? > > Kevin > > On Thu, 17 Sep 2015 17:50:08 -0700 > Kevin Buettner wrote: > > > On Tue, 25 Aug 2015 13:10:06 +0100 > > Pedro Alves wrote: > > > > > On 08/19/2015 07:57 AM, Kevin Buettner wrote: > > > > > > > +++ b/gdb/testsuite/gdb.base/loop-break.c > > > > > > Copyright header missing. > > > > > > > +int main (int argc, char **argv) > > > > > > Line break after first int. > > > > > > > +if ![runto_main] then { fail "loop-break tests suppressed" } > > > > > > This should return rather than continue into a cascade of failures: > > > > > > if ![runto_main] then { > > > fail "Can't run to main" > > > return 0 > > > } > > > > > > > +proc continue_to { linenum testname iter } { > > > > + global srcfile > > > > + global gdb_prompt > > > > + set full_name "continue to $testname, $iter" > > > > + > > > > + send_gdb "continue\n" > > > > + gdb_expect { > > > > + -re "Continuing.*Breakpoint.*$srcfile:$linenum\r\n.*\r\n$gdb_prompt $" { > > > > + pass $full_name > > > > + } > > > > + -re ".*$gdb_prompt $" { > > > > + fail $full_name > > > > + } > > > > + timeout { > > > > + fail "$full_name (timeout)" > > > > + } > > > > > > Use gdb_test_multiple. Or even, gdb_test ? > > > > Hi Pedro, > > > > Thanks for the review. The version below fixes the problems you identified... > > > > > > > > Add new test, gdb.base/loop-break.exp. > > > > This test places breakpoints at various points on several different > > looping constructs, making sure that GDB behaves as expected. > > > > gdb/testsuite/ChangeLog: > > > > * gdb.base/loop-break.c, gdb.base/loop-break.exp: New files. > > --- > > gdb/testsuite/gdb.base/loop-break.c | 60 ++++++++++++++++++++ > > gdb/testsuite/gdb.base/loop-break.exp | 104 ++++++++++++++++++++++++++++++++++ > > 2 files changed, 164 insertions(+) > > > > diff --git a/gdb/testsuite/gdb.base/loop-break.c b/gdb/testsuite/gdb.base/loop-break.c > > new file mode 100644 > > index 0000000..7b7d0f7 > > --- /dev/null > > +++ b/gdb/testsuite/gdb.base/loop-break.c > > @@ -0,0 +1,60 @@ > > +/* This testcase is part of GDB, the GNU debugger. > > + > > + Copyright 2015 Free Software Foundation, Inc. > > + > > + This program is free software; you can redistribute it and/or modify > > + it under the terms of the GNU General Public License as published by > > + the Free Software Foundation; either version 3 of the License, or > > + (at your option) any later version. > > + > > + This program is distributed in the hope that it will be useful, > > + but WITHOUT ANY WARRANTY; without even the implied warranty of > > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > > + GNU General Public License for more details. > > + > > + You should have received a copy of the GNU General Public License > > + along with this program. If not, see . */ > > + > > +volatile int v; > > +volatile int w; > > + > > +void > > +loop_test (void) > > +{ > > + v = 0; > > + > > + while (v < 3) /* Loop 1 condition */ > > + { > > + v++; /* Loop 1 increment */ > > + } > > + > > + v = -42; > > + > > + for (v = 0; v < 3; ) /* Loop 2 */ > > + { > > + v++; /* Loop 2 increment */ > > + } > > + > > + v = -42; > > + w = 42; > > + > > + for (v = 0; /* Loop 3 initialization */ > > + v < 3; /* Loop 3 condition */ > > + v++) /* Loop 3 increment */ > > + { > > + w = w - v; > > + } > > + > > + v = 0; > > + goto b; /* Loop 4 initial goto */ > > +a: v++; > > +b: if (v < 3) goto a; /* Loop 4 condition */ > > +} > > + > > +int > > +main (int argc, char **argv) > > +{ > > + loop_test (); > > + > > + return 0; > > +} > > diff --git a/gdb/testsuite/gdb.base/loop-break.exp b/gdb/testsuite/gdb.base/loop-break.exp > > new file mode 100644 > > index 0000000..b573a7b > > --- /dev/null > > +++ b/gdb/testsuite/gdb.base/loop-break.exp > > @@ -0,0 +1,104 @@ > > +# Copyright 2015 Free Software Foundation, Inc. > > + > > +# This program is free software; you can redistribute it and/or modify > > +# it under the terms of the GNU General Public License as published by > > +# the Free Software Foundation; either version 3 of the License, or > > +# (at your option) any later version. > > +# > > +# This program is distributed in the hope that it will be useful, > > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > > +# GNU General Public License for more details. > > +# > > +# You should have received a copy of the GNU General Public License > > +# along with this program. If not, see . > > + > > +# Place breakpoints at various points on several different looping > > +# constructs. Make sure that GDB correctly runs to each of these > > +# breakpoints and that computed values are correct at each point along > > +# the way. > > + > > +standard_testfile > > + > > +if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { > > + return -1 > > +} > > + > > +if ![runto_main] then { > > + fail "Can't run to main" > > + return 0 > > +} > > + > > +proc break_at { search_string } { > > + global srcfile > > + set bp_location [gdb_get_line_number $search_string] > > + gdb_test "break $bp_location" \ > > + "Breakpoint.*at.* file .*$srcfile, line $bp_location\\." \ > > + "break $search_string" > > + > > + return $bp_location; > > +} > > + > > +proc continue_to { linenum testname iter } { > > + global srcfile > > + gdb_test "continue" \ > > + "Continuing.*Breakpoint.*$srcfile:$linenum.*" \ > > + "continue to $testname, $iter" > > +} > > + > > +set bp_location1a [break_at "Loop 1 condition"] > > +set bp_location1b [break_at "Loop 1 increment"] > > +set bp_location2a [break_at "Loop 2"] > > +set bp_location2b [break_at "Loop 2 increment"] > > +set bp_location3a [break_at "Loop 3 initialization"] > > +set bp_location3b [break_at "Loop 3 condition"] > > +set bp_location3c [break_at "Loop 3 increment"] > > +set bp_location4a [break_at "Loop 4 initial goto"] > > +set bp_location4b [break_at "Loop 4 condition"] > > + > > +continue_to $bp_location1a "Loop 1 condition" 0 > > +gdb_test "p v" "= 0" "Loop 1 value check at condition 0" > > +continue_to $bp_location1b "Loop 1 increment" 0 > > +gdb_test "p v" "= 0" "Loop 1 value check at increment 0" > > + > > +continue_to $bp_location1a "Loop 1 condition" 1 > > +gdb_test "p v" "= 1" "Loop 1 value check at condition 1" > > +continue_to $bp_location1b "Loop 1 increment" 1 > > +gdb_test "p v" "= 1" "Loop 1 value check at increment 1" > > + > > +continue_to $bp_location1a "Loop 1 condition" 2 > > +continue_to $bp_location1b "Loop 1 increment" 2 > > + > > +continue_to $bp_location1a "Loop 1 condition" 3 > > + > > +continue_to $bp_location2a "Loop 2" 0 > > +gdb_test "p v" "= -42" "Loop 2 value check at loop start" > > +continue_to $bp_location2b "Loop 2 increment" 0 > > +gdb_test "p v" "= 0" "Loop 2 value check at increment 0" > > +continue_to $bp_location2b "Loop 2 increment" 1 > > +gdb_test "p v" "= 1" "Loop 2 value check at increment 1" > > +continue_to $bp_location2b "Loop 2 increment" 2 > > +gdb_test "p v" "= 2" "Loop 2 value check at increment 2" > > + > > +continue_to $bp_location3a "Loop 3 initialization" 0 > > +gdb_test "p v" "= -42" "Loop 3 value check at initialization" > > +continue_to $bp_location3b "Loop 3 condition" 0 > > +gdb_test "p v" "= 0" "Loop 3 value check at condition 0" > > +continue_to $bp_location3c "Loop 3 increment" 0 > > +gdb_test "p v" "= 0" "Loop 3 value check at increment 0" > > +continue_to $bp_location3b "Loop 3 condition" 1 > > +continue_to $bp_location3c "Loop 3 increment" 1 > > +continue_to $bp_location3b "Loop 3 condition" 2 > > +continue_to $bp_location3c "Loop 3 increment" 2 > > +continue_to $bp_location3b "Loop 3 condition" 3 > > + > > +continue_to $bp_location4a "Loop 4 initial goto" 0 > > +gdb_test "p v" "= 0" "Loop 4 value check at initial goto" > > +continue_to $bp_location4b "Loop 4 condition" 0 > > +gdb_test "p v" "= 0" "Loop 4 value check at condition 0" > > +continue_to $bp_location4b "Loop 4 condition" 1 > > +gdb_test "p v" "= 1" "Loop 4 value check at condition 1" > > +continue_to $bp_location4b "Loop 4 condition" 2 > > +gdb_test "p v" "= 2" "Loop 4 value check at condition 2" > > +continue_to $bp_location4b "Loop 4 condition" 3 > > +gdb_test "p v" "= 3" "Loop 4 value check at condition 3" > >