This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix ptype problem printing typedefs defined differently in different compilation units


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]