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: Cleanup varobjs for invalid expressions


On Sun, Mar 25, 2007 at 02:20:14PM +0300, Vladimir Prus wrote:
> 
> Pretty much everywhere in varobj.c, we use a convention
> that varobj value of NULL means that some error occured
> when evaluating the value. However, in some cases
> we try to evaluate at least the type of varobj, and that
> code unintentionally sets varobj value to non-null.
> The result of this is:
> 
> 	-var-create null_ptr * **0
>         ^done,name="null_ptr",numchild="0",value="0",type="int"
> 
> Clearly, the value of "0" is bogus (on x86).
> 
> This patch fixes the problem and changes the above output to:
> 
>         ^done,name="null_ptr",numchild="0",value="",type="int"

I guess that's better.

> +      struct value *value = NULL;

> +	{
> +	  /* Error getting the value.  Try to at least get the
> +	     right type.  */
> +	  struct value *value = evaluate_type (var->root->exp);
> +	  var->type = value_type (value);
> +	}

GDB is already full of -Wshadow problems, but I'd rather we didn't
make it worse - I find it incredibly confusing.  The patch is OK if
you give the inner variable some name other than "value".

-- 
Daniel Jacobowitz
CodeSourcery


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