From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2917 invoked by alias); 11 Oct 2012 21:53:57 -0000 Received: (qmail 2906 invoked by uid 22791); 11 Oct 2012 21:53:56 -0000 X-SWARE-Spam-Status: No, hits=-7.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS 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, 11 Oct 2012 21:53:45 +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 q9BLrfGe014641 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 11 Oct 2012 17:53:41 -0400 Received: from psique (ovpn-113-159.phx2.redhat.com [10.3.113.159]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9BLrb5M030163; Thu, 11 Oct 2012 17:53:39 -0400 From: Sergio Durigan Junior To: "Gustavo\, Luis" Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Fix mi "-var-create" regression In-Reply-To: <5075D4FD.9050900@mentor.com> (Luis Gustavo's message of "Wed, 10 Oct 2012 17:05:17 -0300") References: <5075D4FD.9050900@mentor.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-URL: http://www.redhat.com Date: Thu, 11 Oct 2012 21:53:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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/msg00186.txt.bz2 On Wednesday, October 10 2012, Luis Gustavo wrote: > Hi, Hey Luis :-) > 2012-10-10 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:38:21.872234906 -0300 > +++ gdb/gdb/value.c 2012-10-10 16:42:49.560222099 -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_TARGET_TYPE (result) != NULL) > + && TYPE_CODE (TYPE_TARGET_TYPE (result)) != TYPE_CODE_VOID)) > { > struct type *real_type; > As far as I remember this code (thanks for the explanation BTW), the patch looks fine by me (not a maintainer). Just two things I noticed: 1) I believe you could remove some of the parentheses in the `if' above. Something like: 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) would have the same effect, right? 2) Would it be possible to provide a testcase for this issue? Not sure if it's really needed, but I guess it won't hurt :-). Of course, if some maintainer thinks it's useless, then please disconsider the idea right away. Thanks a lot, -- Sergio