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


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

        


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