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: [ob] unbreak MI


On Tuesday 27 November 2007 13:32:54 Nick Roberts wrote:
>  > >  > Probably:
>  > >  > 
>  > >  >         if (!gdb_type)
>  > >  >                 ui_out_field_string (uiout, "value", "");
>  > >  >         else if (mi_print_value_p (gdb_type, print_values))
>  > >  >                 ui_out_field_string (uiout, "value", varobj_get_value (var));
>  > >  > 
>  > >  > is the right logic?
>  > > 
>  > > It's probably the right logic, but it seems to cure the symptom rather
>  > > than the cause.
> 
> Looking again, I see it's not the right logic. GDB will print a value=""
> field even for "--no-values" when gdb_type is NULL.
> 
>  >...
>  > The original code, in fact, was in error too, because of this:
>  > 
>  >   return (TYPE_CODE (type) != TYPE_CODE_ARRAY
>  > 	  && TYPE_CODE (type) != TYPE_CODE_STRUCT
>  > 	  && TYPE_CODE (type) != TYPE_CODE_UNION);	
>  > 
>  > This will crash if 'type' is NULL. Testsuite fails to detect this because
>  > presently type is NULL only for C++ pseudo-fields ('public'/'private') and
>  > the code above is only executed for --simple-values.
> 
> I never use, and never wanted, "-var-list-children --simple-values".

And? You keep on making this argument in various context, and I find it wrong. It does
not matter if you, or I, make use of a feature -- the code that can segfault on a
usage documented in gdb manual should either be removed, or fixed.

>  > Does this clarify things?
> 
> Yes, thanks.  I think the patch below should cover all cases.

As far as I'm concerned, it's fine.

- Volodya


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