Re: [patch] ptype: show members of an unnamed struct inside an union

Carlos Eduardo Seo
2007-08-29T20:14:54Z

[-- Attachment #1: Type: text/plain, Size: 692 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>
> Cool! Carlos, would you be able to look into that? I promise to
> review any patch promptly.
>
Joel

I believe this simple fix addresses the issue. It also fixes one thing
that was wrong with the previous patch: GDB was showing "{...}" when a
struct had no members, instead of <no data fields>.

What do you think?

- --
Carlos Eduardo Seo
Software Engineer
IBM Linux Technology Center
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG1dOuqvq7Aov/qQARAuiXAJ9l6SplkC3rw0yWirpfykMUIeozKQCdE+Nz
ozaauc2l8paWiDR/t3NUCtQ=
=egcI
-----END PGP SIGNATURE-----

[-- Attachment #2: ptype_unnamed.diff --]
[-- Type: text/plain, Size: 717 bytes --]

2007-08-16 Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>

gdb/c-typeprint.c (c_type_print_base): allows GDB to
show members of unnamed struct/union that couldn't be
displayed otherwise using ptype.

Index: src/gdb/c-typeprint.c
===================================================================
--- src.orig/gdb/c-typeprint.c 2007-08-29 12:36:09.000000000 -0700
+++ src/gdb/c-typeprint.c 2007-08-29 12:57:51.000000000 -0700
@@ -733,7 +733,7 @@
fputs_filtered (" ", stream);
}
wrap_here (" ");
- if (show < 0)
+ if ((show < 0) && (TYPE_TAG_NAME (type) != NULL))
{
/* If we just printed a tag name, no need to print anything else. */
if (TYPE_TAG_NAME (type) == NULL)

[-- Attachment #3: ptype_unnamed.diff.sig --]
[-- Type: application/octet-stream, Size: 65 bytes --]