From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2462 invoked by alias); 7 Aug 2013 05:42:44 -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 2448 invoked by uid 89); 7 Aug 2013 05:42:44 -0000 X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RDNS_NONE autolearn=no version=3.3.1 Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 07 Aug 2013 05:42:43 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1V6wW3-0006Cb-BJ from Ali_Anwar@mentor.com ; Tue, 06 Aug 2013 22:42:35 -0700 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 6 Aug 2013 22:42:35 -0700 Received: from [137.202.157.39] (147.34.91.1) by SVR-ORW-FEM-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server (TLS) id 14.2.247.3; Tue, 6 Aug 2013 22:42:34 -0700 Message-ID: <5201DE39.6060302@codesourcery.com> Date: Wed, 07 Aug 2013 05:42:00 -0000 From: ali_anwar User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 MIME-Version: 1.0 To: Keith Seitz CC: Subject: Re: [PATCH] Fix for PR15117 References: <51F7EFF1.6030609@codesourcery.com> <51F80C61.9080308@redhat.com> <51FBA2A6.8000307@codesourcery.com> <51FBF127.7000108@redhat.com> In-Reply-To: <51FBF127.7000108@redhat.com> Content-Type: multipart/mixed; boundary="------------020902000708040904010602" X-Virus-Found: No X-SW-Source: 2013-08/txt/msg00182.txt.bz2 --------------020902000708040904010602 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1005 On 08/02/2013 10:49 PM, Keith Seitz wrote: > > Two tiny nits: > >> + { >> + /* Not able to parse user specified variable. Do not >> + throw an error here. parse_linespec will do it for us*/ > > This comment is not formatted properly: two spaces after '.'. Use > complete sentences (where possible/feasible). This should probably read: > > /* The user-specified variable was not valid. Do not > throw an error here. parse_linespec will do it for us. */ > > [i.e, just copy the bits from the following block] Fixed. >> +# Test break via convenience variable with file name >> +# >> +set line [gdb_get_line_number "set breakpoint 1 here"] >> +gdb_test_no_output "set \$l = $line" > > I'm showing extra whitespace at the end of the above line. Could you > double-check that before committing? > Fixed. > With those trivial things fixed, I think this patch is ready for a > global maintainer to review and approve. > Thank you for reviewing the patch again. Regards, -Ali --------------020902000708040904010602 Content-Type: text/x-patch; name="PR15117_v3.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="PR15117_v3.patch" Content-length: 2227 Index: linespec.c =================================================================== RCS file: /cvs/src/src/gdb/linespec.c,v retrieving revision 1.185 diff -u -r1.185 linespec.c --- linespec.c 30 May 2013 16:57:38 -0000 1.185 +++ linespec.c 7 Aug 2013 05:32:04 -0000 @@ -1649,7 +1649,7 @@ else { /* NAME was not a function or a method. So it must be a label - name. */ + name or user specified variable like "break foo.c:$zippo". */ labels = find_label_symbols (PARSER_STATE (parser), NULL, &symbols, name); if (labels != NULL) @@ -1660,6 +1660,22 @@ symbols = NULL; discard_cleanups (cleanup); } + else if (token.type == LSTOKEN_STRING + && *LS_TOKEN_STOKEN (token).ptr == '$') + { + /* User specified a convenience variable or history value. */ + PARSER_RESULT (parser)->line_offset + = linespec_parse_variable (PARSER_STATE (parser), name); + + if (PARSER_RESULT (parser)->line_offset.sign == LINE_OFFSET_UNKNOWN) + { + /* The user-specified variable was not valid. Do not + throw an error here. parse_linespec will do it for us. */ + PARSER_RESULT (parser)->function_name = name; + discard_cleanups (cleanup); + return; + } + } else { /* The name is also not a label. Abort parsing. Do not throw Index: testsuite/gdb.base/break.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/break.exp,v retrieving revision 1.58 diff -u -r1.58 break.exp --- testsuite/gdb.base/break.exp 7 Jun 2013 17:31:07 -0000 1.58 +++ testsuite/gdb.base/break.exp 7 Aug 2013 05:40:12 -0000 @@ -957,6 +957,18 @@ } } +# +# Test break via convenience variable with file name +# +set line [gdb_get_line_number "set breakpoint 1 here"] +gdb_test_no_output "set \$l = $line" +gdb_breakpoint ${srcfile}:\$l + +gdb_test_no_output "set \$foo=81.5" \ + "set convenience variable \$foo to 81.5" +gdb_test "break $srcfile:\$foo" \ + "Convenience variables used in line specs must have integer values.*" \ + "set breakpoint via non-integer convenience variable disallowed" # Reset the default arguments for VxWorks if [istarget "*-*-vxworks*"] { --------------020902000708040904010602--