Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>,
		Luis Machado <luisgpm@linux.vnet.ibm.com>,
		gdb-patches@sourceware.org
Subject: Re: [patch] ptype: show members of an unnamed struct inside an union
Date: Wed, 29 Aug 2007 04:36:00 -0000	[thread overview]
Message-ID: <20070829043633.GD3795@adacore.com> (raw)
In-Reply-To: <20070829025618.GA26311@caradoc.them.org>

> > Does this case actually make any sense? I don't think you can access
> > this union in your C program either, or can you?
> 
> GCC supports anonymous unions.  There's a test for it in the GDB
> testsuite, too.

But how can you access this union if the field doesn't have a name?
More precisely, using the example that Carlos sent:

   struct my_page {
     union {
       struct { int mapping; };
     };
   };

How do you access the union? That's why I gave the union field a name
"u" as follow:

   struct my_page {
     union {
       struct { int mapping; };
     } u;
   };

So that I can reference it using "my_page.u".

Just to be clear, I am not trying to object to the idea of enhancing
GDB for such situations, I'm just trying to understand whether these
situations correspond to something actually useful. I've seen this
being used in the past, when some fields were inserted as a way of
inserting some padding. I don't think it's really essential in that
case to show the actual description of the padding, or maybe it is?

-- 
Joel


  reply	other threads:[~2007-08-29  4:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-16 22:39 Carlos Eduardo Seo
2007-08-24 15:48 ` Joel Brobecker
2007-08-24 16:02   ` Carlos Eduardo Seo
2007-08-24 17:39     ` Joel Brobecker
2007-08-28 17:14 ` Joel Brobecker
2007-08-28 19:03   ` Luis Machado
2007-08-28 20:04     ` Joel Brobecker
2007-08-28 20:12       ` Carlos Eduardo Seo
2007-08-28 20:34         ` Joel Brobecker
2007-08-29  2:56           ` Daniel Jacobowitz
2007-08-29  4:36             ` Joel Brobecker [this message]
2007-08-29 16:30               ` Daniel Jacobowitz
2007-08-29 18:32                 ` Joel Brobecker
2007-08-29 18:36                   ` Daniel Jacobowitz
2007-08-29 18:48                     ` Joel Brobecker
2007-08-29 18:50                       ` Carlos Eduardo Seo
2007-08-29 20:14                       ` Carlos Eduardo Seo
2007-08-29 20:23                         ` Daniel Jacobowitz
2007-08-29 20:26                           ` Carlos Eduardo Seo
2007-08-29 20:41                             ` Joel Brobecker
2007-08-29 20:44                               ` Daniel Jacobowitz
2007-08-29 21:01                                 ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070829043633.GD3795@adacore.com \
    --to=brobecker@adacore.com \
    --cc=cseo@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=luisgpm@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox