This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] mi-cmd-var.c validate type
msnyder@sonic.net wrote:
> One of the few places that "type" is checked for null before being
> passed to check_typedef. ÂAccording to the comment, it should be
> checked here too.
> mitype.txt
> 2007-07-26 ÂMichael Snyder Â<msnyder@access-company.com>
>
> * mi/mi-cmd-var.c (mi_print_value_p): Return 0 if no type.
>
> Index: mi/mi-cmd-var.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mi/mi-cmd-var.c,v
> retrieving revision 1.33
> diff -p -r1.33 mi-cmd-var.c
> *** mi/mi-cmd-var.cÂÂÂÂÂ13 Jun 2007 19:08:47 -0000ÂÂÂÂÂÂ1.33
> --- mi/mi-cmd-var.cÂÂÂÂÂ26 Jul 2007 23:07:38 -0000
> *************** mi_print_value_p (struct type *type, enu
> *** 341,347 ****
> /* For PRINT_SIMPLE_VALUES, only print the value if it has a type
> and that type is not a compound type. Â*/
>
> ! Â return (TYPE_CODE (type) != TYPE_CODE_ARRAY
> && TYPE_CODE (type) != TYPE_CODE_STRUCT
> && TYPE_CODE (type) != TYPE_CODE_UNION);
I'd suspect the comment's bogus, in light of this comment in varobj.c
/* The type of this variable. This may NEVER be NULL. */
struct type *type;
I think mi_print_value_p can either assume type is not NULL, or
gdb_assert that.
- Volodya