From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7937 invoked by alias); 14 Feb 2006 14:11:02 -0000 Received: (qmail 7929 invoked by uid 22791); 14 Feb 2006 14:11:02 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Tue, 14 Feb 2006 14:11:00 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1F90tM-0005i8-27; Tue, 14 Feb 2006 09:10:56 -0500 Date: Tue, 14 Feb 2006 14:11:00 -0000 From: Daniel Jacobowitz To: Fred Fish Cc: Jim Blandy , gdb-patches@sourceware.org Subject: Re: [PATCH] Fix ptype problem printing typedefs defined differently in different compilation units Message-ID: <20060214141056.GB21812@nevyn.them.org> Mail-Followup-To: Fred Fish , Jim Blandy , gdb-patches@sourceware.org References: <200601031517.50309.fnf@specifix.com> <200602111501.01801.fnf@specifix.com> <20060211202059.GB27289@nevyn.them.org> <200602121349.07257.fnf@specifix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200602121349.07257.fnf@specifix.com> User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-02/txt/msg00301.txt.bz2 On Sun, Feb 12, 2006 at 01:49:06PM -0500, Fred Fish wrote: > *** eval.c 30 Dec 2005 18:53:04 -0000 1.1.1.2 > --- eval.c 12 Feb 2006 18:07:29 -0000 > *************** evaluate_subexp_standard (struct type *e > *** 461,466 **** > --- 461,472 ---- > value_rtti_target_type () if we are dealing with a pointer > or reference to a base class and print object is on. */ > > + /* If asked to evaluate a typedef, and we are avoiding side effects, > + then create a value of the appropriate type to return. */ > + if (noside == EVAL_AVOID_SIDE_EFFECTS > + && SYMBOL_CLASS (exp->elts[pc + 2].symbol) == LOC_TYPEDEF) > + return (allocate_value (SYMBOL_TYPE (exp->elts[2].symbol))); > + else > return value_of_variable (exp->elts[pc + 2].symbol, > exp->elts[pc + 1].block); > This patch seems OK to me; but we really ought to fix up the comment directly above this code that you're changing. /* JYG: We used to just return value_zero of the symbol type if we're asked to avoid side effects. Otherwise we return value_of_variable (...). However I'm not sure if value_of_variable () has any side effect. We need a full value object returned here for whatis_exp () to call evaluate_type () and then pass the full value to value_rtti_target_type () if we are dealing with a pointer or reference to a base class and print object is on. */ It'd be nice to mention "so now we only do this for typedefs". -- Daniel Jacobowitz CodeSourcery