From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3780 invoked by alias); 8 Mar 2012 23:15:10 -0000 Received: (qmail 3769 invoked by uid 22791); 8 Mar 2012 23:15:08 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Mar 2012 23:14:50 +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 q28NES0x002350 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 8 Mar 2012 18:14:28 -0500 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q28NEPE5019208 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 8 Mar 2012 18:14:27 -0500 Message-ID: <4F593D51.6020105@redhat.com> Date: Thu, 08 Mar 2012 23:15:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Joel Brobecker CC: Tom Tromey , "gdb-patches@sourceware.org ml" Subject: Re: [RFA] gdb_get_line_number on unknown tags References: <4F592C48.7000500@redhat.com> <8762een3u2.fsf@fleche.redhat.com> <20120308222412.GU2853@adacore.com> In-Reply-To: <20120308222412.GU2853@adacore.com> Content-Type: multipart/mixed; boundary="------------080804010508010401090505" X-IsSubscribed: yes 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 X-SW-Source: 2012-03/txt/msg00303.txt.bz2 This is a multi-part message in MIME format. --------------080804010508010401090505 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 768 On 03/08/2012 02:24 PM, Joel Brobecker wrote: >>>>>>> "Keith" == Keith Seitz writes: >> >> Keith> This is occurring because the two tests which do it are using >> Keith> gdb_get_line_number on a tag which is not defined in the source >> Keith> file. >> >> I wonder whether this should be an error. > > Seems like a good idea... Well, we three agree, so here it is. It exposed buglets in three other tests (which appear to be copies of one common file). Ok? Keith testsuite/ChangeLog 2012-03-08 Keith Seitz * lib/gdb.exp (gdb_get_line_number): Throw an error instead of returning -1. * gdb.base/break.exp: Remove unused variable bp_location5. * gdb.base/hbreak2.exp: Likewise. * gdb.base/sepdebug.exp: Likewise. --------------080804010508010401090505 Content-Type: text/x-patch; name="gdb_get_line_number-error.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gdb_get_line_number-error.patch" Content-length: 3376 Index: gdb.base/break.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/break.exp,v retrieving revision 1.53 diff -u -p -r1.53 break.exp --- gdb.base/break.exp 13 Feb 2012 18:09:59 -0000 1.53 +++ gdb.base/break.exp 8 Mar 2012 23:12:55 -0000 @@ -115,7 +115,6 @@ gdb_test "break multi_line_while_conditi "Breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \ "breakpoint at start of multi line while conditional" -set bp_location5 [gdb_get_line_number "set breakpoint 5 here"] set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] set main_line $bp_location6 Index: gdb.base/hbreak2.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/hbreak2.exp,v retrieving revision 1.1 diff -u -p -r1.1 hbreak2.exp --- gdb.base/hbreak2.exp 1 Mar 2012 21:01:11 -0000 1.1 +++ gdb.base/hbreak2.exp 8 Mar 2012 23:12:55 -0000 @@ -130,7 +130,6 @@ gdb_test "hbreak multi_line_while_condit "Hardware assisted breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \ "hardware breakpoint at start of multi line while conditional" -set bp_location5 [gdb_get_line_number "set breakpoint 5 here"] set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] set main_line $bp_location6 Index: gdb.base/sepdebug.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/sepdebug.exp,v retrieving revision 1.38 diff -u -p -r1.38 sepdebug.exp --- gdb.base/sepdebug.exp 21 Feb 2012 22:01:09 -0000 1.38 +++ gdb.base/sepdebug.exp 8 Mar 2012 23:12:55 -0000 @@ -150,7 +150,6 @@ gdb_test "break multi_line_while_conditi "Breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \ "breakpoint at start of multi line while conditional" -set bp_location5 [gdb_get_line_number "set breakpoint 5 here"] set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] set main_line $bp_location6 Index: lib/gdb.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v retrieving revision 1.202 diff -u -p -r1.202 gdb.exp --- lib/gdb.exp 21 Feb 2012 22:01:10 -0000 1.202 +++ lib/gdb.exp 8 Mar 2012 23:12:56 -0000 @@ -3243,7 +3243,7 @@ proc setup_kfail_for_target { PR target # gdb_get_line_number TEXT [FILE] # # Search the source file FILE, and return the line number of the -# first line containing TEXT. If no match is found, return -1. +# first line containing TEXT. If no match is found, an error is thrown. # # TEXT is a string literal, not a regular expression. # @@ -3316,15 +3316,13 @@ proc gdb_get_line_number { text { file " } if { [ catch { set fd [open "$file"] } message ] } then { - perror "$message" - return -1 + error "$message" } set found -1 for { set line 1 } { 1 } { incr line } { if { [ catch { set nchar [gets "$fd" body] } message ] } then { - perror "$message" - return -1 + error "$message" } if { $nchar < 0 } then { break @@ -3336,8 +3334,11 @@ proc gdb_get_line_number { text { file " } if { [ catch { close "$fd" } message ] } then { - perror "$message" - return -1 + error "$message" + } + + if {$found == -1} { + error "undefined tag \"$text\"" } return $found --------------080804010508010401090505--