This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [ob] unbreak MI
- From: Vladimir Prus <ghost at cs dot msu dot su>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 27 Nov 2007 09:13:14 +0300
- Subject: Re: [ob] unbreak MI
- References: <200708312244.58216.ghost@cs.msu.su> <18251.35325.929245.184830@kahikatea.snap.net.nz>
Nick Roberts wrote:
> > It appears that some of recent cleanups broke MI, because
> > check_typedef is getting passed a NULL pointer -- this
> > suggest someone did not run a testsuite prior to commit ;-).
> >
> > It does not matter which particular patch broke it, because
> > it's trivially fixable by the attached patch, checked in
> > as obvious.
>
> This fix (now in GDB 6.7) breaks watch expressions of C++ objects on Emacs
> because the MI command "-var-list-children --all-values" no longer always
> includes the value field:
>
> - if (mi_print_value_p (varobj_get_gdb_type (var), print_values))
> + gdb_type = varobj_get_gdb_type (var);
> + if (gdb_type && mi_print_value_p (gdb_type, print_values))
> ui_out_field_string (uiout, "value", varobj_get_value (var));
>
>
> Generally, with a NULL pointer, or and address that can't be dereferenced,
> MI prints out the value field as value="".
>
> What is the problem in this case? Why isn't the right fix to add a
> check_typedef somewhere?
check_typedef? The original problem was that check_typedef was getting
called on NULL pointer, so adding more check_typedef calls won't help.
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?
- Volodya