From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 110237 invoked by alias); 25 Aug 2015 12:10:11 -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 110213 invoked by uid 89); 25 Aug 2015 12:10:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS 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, 25 Aug 2015 12:10:09 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 81451341AE8 for ; Tue, 25 Aug 2015 12:10:08 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7PCA7t1025977; Tue, 25 Aug 2015 08:10:07 -0400 Message-ID: <55DC5B1E.3050407@redhat.com> Date: Tue, 25 Aug 2015 12:10: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: Kevin Buettner , gdb-patches@sourceware.org Subject: Re: [PATCH 1/8] Add new test, gdb.base/loop-break.exp References: <20150818235334.1afb0c85@pinnacle.lan> <20150818235756.23c9d7db@pinnacle.lan> In-Reply-To: <20150818235756.23c9d7db@pinnacle.lan> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-08/txt/msg00720.txt.bz2 On 08/19/2015 07:57 AM, Kevin Buettner wrote: > index 0000000..3e4b5ca > --- /dev/null > +++ b/gdb/testsuite/gdb.base/loop-break.c > @@ -0,0 +1,42 @@ > +volatile int v; > +volatile int w; Copyright header missing. > + 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) Line break after first int. > +{ > + 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..fef3fcb > --- /dev/null > +++ b/gdb/testsuite/gdb.base/loop-break.exp > @@ -0,0 +1,113 @@ > +# 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 "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 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 > + 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 ? Thanks, Pedro Alves