From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16418 invoked by alias); 15 Oct 2012 12:21:09 -0000 Received: (qmail 16407 invoked by uid 22791); 15 Oct 2012 12:21:07 -0000 X-SWARE-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL 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; Mon, 15 Oct 2012 12:20:58 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1TNjfE-0004FX-6j from Luis_Gustavo@mentor.com ; Mon, 15 Oct 2012 05:20:56 -0700 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); Mon, 15 Oct 2012 05:20:45 -0700 Received: from [0.0.0.0] ([172.16.63.104]) by NA1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 15 Oct 2012 05:20:45 -0700 Message-ID: <507BFF97.2000900@codesourcery.com> Date: Mon, 15 Oct 2012 12:21:00 -0000 From: Luis Machado Reply-To: lgustavo@codesourcery.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.28) Gecko/20120313 Lightning/1.0b2 Thunderbird/3.1.20 MIME-Version: 1.0 To: Joel Brobecker CC: gdb-patches@sourceware.org Subject: Re: [PATCH] Fix mi "-var-create" regression References: <5075D4FD.9050900@mentor.com> <20121014171805.GB3050@adacore.com> In-Reply-To: <20121014171805.GB3050@adacore.com> Content-Type: multipart/mixed; boundary="------------010306010300090903030508" 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-10/txt/msg00213.txt.bz2 This is a multi-part message in MIME format. --------------010306010300090903030508 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1657 On 10/14/2012 02:18 PM, Joel Brobecker wrote: > I don't feel entirely comfortable approving this patch, not because > I think it's iffy, but just because I don't have a good knowledge > of what is going on for you (RTTI is C++, and I don't follow C++ > support). If no one else has the time to officially review your patch > within the next week or so, I will take a deeper look. It does look > reasonable. > The biggest problem caused by this regression is the breakage of information sent to IDEs based on MI output, as Marc pointed out. Eclipse, for example, will attempt to list registers and gdb will end up throwing these errors, causing eclipse to get all confused when trying to display the register values. This is more about a regression of a generic gdb feature than a fix to a C++ feature. > I did notice a couple of things (besides the unnecessary parens): > >> - if (TYPE_CODE (result) == TYPE_CODE_PTR >> + /* If result's target type is TYPE_CODE_VOID, do not try fetching its rtti >> + type. GDB will try to dereference the void pointer and will throw an >> + error when trying to do so. */ > > Can you reformat the comment to fit within 70 characters. That's the > soft line limit... > Fixed. >> + if ((TYPE_CODE (result) == TYPE_CODE_PTR >> || TYPE_CODE (result) == TYPE_CODE_REF) >> + && ((TYPE_TARGET_TYPE (result) != NULL) >> + && TYPE_CODE (TYPE_TARGET_TYPE (result)) != TYPE_CODE_VOID)) > > I don't think that you need to test for the TYPE_TARGET_TYPE, since > you already know that it's either a PTR or REF type, which always > have a TARGET_TYPE. > Well spotted. I fixed this now. Thanks, Luis --------------010306010300090903030508 Content-Type: text/x-patch; name="rtti-print-object.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="rtti-print-object.diff" Content-length: 905 2012-10-15 Luis Machado * value.c (value_actual_type): Check for TYPE_CODE_VOID target types. Index: gdb/gdb/value.c =================================================================== --- gdb.orig/gdb/value.c 2012-10-10 16:54:36.048188274 -0300 +++ gdb/gdb/value.c 2012-10-14 21:41:22.997797277 -0300 @@ -850,8 +850,13 @@ value_actual_type (struct value *value, result = value_type (value); if (opts.objectprint) { - if (TYPE_CODE (result) == TYPE_CODE_PTR + /* If result's target type is TYPE_CODE_VOID, do not try + fetching its rtti type. GDB will try to dereference + the void pointer and will throw an error when trying to + do so. */ + if ((TYPE_CODE (result) == TYPE_CODE_PTR || TYPE_CODE (result) == TYPE_CODE_REF) + && TYPE_CODE (TYPE_TARGET_TYPE (result)) != TYPE_CODE_VOID) { struct type *real_type; --------------010306010300090903030508--