From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7164 invoked by alias); 8 Mar 2012 16:44:38 -0000 Received: (qmail 7149 invoked by uid 22791); 8 Mar 2012 16:44:36 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Mar 2012 16:44:23 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1S5gRy-0000gJ-BY from Luis_Gustavo@mentor.com ; Thu, 08 Mar 2012 08:44:22 -0800 Received: from NA1-MAIL.mgc.mentorg.com ([147.34.98.181]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 8 Mar 2012 08:44:09 -0800 Received: from [0.0.0.0] ([172.16.63.104]) by NA1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 8 Mar 2012 03:47:47 -0800 Message-ID: <4F589C5A.6060705@mentor.com> Date: Thu, 08 Mar 2012 16:44:00 -0000 From: Luis Gustavo Reply-To: "Gustavo, Luis" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.27) Gecko/20120216 Lightning/1.0b2 Thunderbird/3.1.19 MIME-Version: 1.0 To: Jan Kratochvil CC: gdb-patches@sourceware.org Subject: Re: [PATCH] Make AX engine fail gracefully due to unknown types References: <4F57A77E.307@mentor.com> <20120307202203.GA5491@host2.jankratochvil.net> In-Reply-To: <20120307202203.GA5491@host2.jankratochvil.net> Content-Type: multipart/mixed; boundary="------------010706070007000407040109" 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/msg00272.txt.bz2 This is a multi-part message in MIME format. --------------010706070007000407040109 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 713 On 03/07/2012 05:22 PM, Jan Kratochvil wrote: > On Wed, 07 Mar 2012 19:22:54 +0100, Luis Gustavo wrote: >> +++ HEAD-git/gdb/ax-gdb.c 2012-03-07 14:16:23.846145476 -0300 >> @@ -557,8 +557,8 @@ gen_fetch (struct agent_expr *ax, struct >> pointer (other code's fault), or we're not implementing >> something we should be (this code's fault). In any case, >> it's a bug the user shouldn't see. */ >> - internal_error (__FILE__, __LINE__, >> - _("gen_fetch: bad type code")); >> + error (_("gen_fetch: Unsupported type code `%s'."), >> + TYPE_NAME (type)); > > I find it OK but here the comment should be updated. > > > Thanks, > Jan How about this one? Luis --------------010706070007000407040109 Content-Type: text/x-patch; name="bz13781.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="bz13781.diff" Content-length: 3130 2012-03-07 Luis Machado * ax-gdb.c (gen_fetch): Fail gracefully and use error instead of internal error for unknown/unsupported types. Revert: 2012-03-03 Jan Kratochvil Implement testsuite workaround for PR breakpoints/13781. * gdb.cp/mb-templates.exp: New loop with variable $workaround. (set breakpoint condition-evaluation host): New conditional command. Index: HEAD-git/gdb/ax-gdb.c =================================================================== --- HEAD-git.orig/gdb/ax-gdb.c 2012-03-07 14:59:50.546064105 -0300 +++ HEAD-git/gdb/ax-gdb.c 2012-03-08 08:41:25.976898540 -0300 @@ -553,12 +553,11 @@ gen_fetch (struct agent_expr *ax, struct break; default: - /* Either our caller shouldn't have asked us to dereference that - pointer (other code's fault), or we're not implementing - something we should be (this code's fault). In any case, - it's a bug the user shouldn't see. */ - internal_error (__FILE__, __LINE__, - _("gen_fetch: bad type code")); + /* Our caller requested us to dereference a pointer from an unsupported + type. Error out and give callers a chance to handle the failure + gracefully. */ + error (_("gen_fetch: Unsupported type code `%s'."), + TYPE_NAME (type)); } } Index: HEAD-git/gdb/testsuite/gdb.cp/mb-templates.exp =================================================================== --- HEAD-git.orig/gdb/testsuite/gdb.cp/mb-templates.exp 2012-03-07 14:59:50.522064107 -0300 +++ HEAD-git/gdb/testsuite/gdb.cp/mb-templates.exp 2012-03-08 08:27:48.344944130 -0300 @@ -38,35 +38,24 @@ if { [gdb_compile "${srcdir}/${subdir}/ return -1 } -# If GDB crashes try it again workarounding PR breakpoints/13781. +clean_restart ${executable} -foreach workaround [list "" " (workaround)"] { - clean_restart ${executable} +set bp_location [gdb_get_line_number "set breakpoint here"] - if {${workaround} != ""} { - gdb_test_no_output "set breakpoint condition-evaluation host" - } - - set bp_location [gdb_get_line_number "set breakpoint here"] +# Set a breakpoint with multiple locations +# and a condition. - # Set a breakpoint with multiple locations - # and a condition. +gdb_test "break $srcfile:$bp_location if i==1" \ + "Breakpoint.*at.*: $srcfile:$bp_location. \\(2 locations\\).*" \ + "initial condition: set breakpoint" - gdb_test "break $srcfile:$bp_location if i==1" \ - "Breakpoint.*at.*: $srcfile:$bp_location. \\(2 locations\\).*" \ - "initial condition: set breakpoint$workaround" +gdb_run_cmd - gdb_run_cmd - - if {${workaround} == "" && [is_remote target]} { - setup_kfail breakpoints/13781 "*-*-*" - } - set test "initial condition: run to breakpoint$workaround" - gdb_test_multiple "" $test { - -re "Breakpoint \[0-9\]+,.*foo \\(i=1\\).*$gdb_prompt $" { - pass $test - break - } +set test "initial condition: run to breakpoint" +gdb_test_multiple "" $test { + -re "Breakpoint \[0-9\]+,.*foo \\(i=1\\).*$gdb_prompt $" { + pass $test + break } } --------------010706070007000407040109--