This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] ptype: show members of an unnamed struct inside an union
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Carlos Eduardo Seo <cseo at linux dot vnet dot ibm dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 24 Aug 2007 11:52:10 -0400
- Subject: Re: [patch] ptype: show members of an unnamed struct inside an union
- References: <46C4D20E.1010703@linux.vnet.ibm.com>
Carlos,
> The attached patched fixes an issue described on this post:
>
> http://sourceware.org/ml/gdb-patches/2002-04/msg01114.html
> 2007-08-16 Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
>
> gdb/c-typeprint.c (c_type_print_base): check value of
> TYPE_NFIELDS (type) when displaying members of an
> unnamed struct inside an union.
Could you add a testcase for this issue? Being new at reviewing
other people's patches, it's sometimes hard for me to understand
what you are trying to do. A testcase would help in two ways: not
only ensure that we do not regress in the future, but also help
me understand clearly what it is that we're trying to fix.
Thank you!
> Index: src-git/gdb/c-typeprint.c
> ===================================================================
> --- src-git.orig/gdb/c-typeprint.c 2007-08-16 15:28:04.000000000 -0700
> +++ src-git/gdb/c-typeprint.c 2007-08-16 15:29:07.000000000 -0700
> @@ -735,7 +735,7 @@
> fputs_filtered (" ", stream);
> }
> wrap_here (" ");
> - if (show < 0)
> + if ((show < 0) && (TYPE_NFIELDS (type) == 0))
> {
> /* If we just printed a tag name, no need to print anything else. */
> if (TYPE_TAG_NAME (type) == NULL)
--
Joel