Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <vladimir@codesourcery.com>
To: Jim Ingham <jingham@apple.com>
Cc: gdb@sources.redhat.com
Subject: Re: MI and anonymous unions
Date: Wed, 15 Nov 2006 17:28:00 -0000	[thread overview]
Message-ID: <200611152027.44035.vladimir@codesourcery.com> (raw)
In-Reply-To: <0F999BE0-8618-44C4-A924-EE55588784EC@apple.com>

On Wednesday 15 November 2006 20:20, Jim Ingham wrote:
> Support for anonymous unions & structures is another of the "things we
> fixed but haven't submitted back"...  We do pretty much what Vladimir
> suggests, though I use #anon#N for the varobj name: the choice doesn't
> much matter.  We still return a blank expression (since that's really
> what the  There's one other tricky bit 'caused by the fact that you
> might have more than one anonymous union or structure inside a
> structure.  This wouldn't be a problem, but the varobj code tends to
> look up structure elements by name, which obviously won't work here.
> So you have to convert all the code that looks up structure elements
> to use the index rather than the name.

Ah, I see. So this is not as easy change as I though.

> Another of the things we do in our varobj code for C++ is that we look
> up the dynamic type of objects (the same mechanism that "set print
> object on" uses, and the value & children we return are based on the
> dynamic type.  As soon as you do that, you really do need a "give me
> the expression that can recreate this varobj" for child varobj's.
> Otherwise the MI client needs to get all these dynamic casts right to
> get down to the proper child, which is a bit of a pain.

Good point.

> But it's a generally useful command.  We called it "var-info-path-
> expression" and given a varobj, it returns the expression that if
> evaluated would result in the same value.  Xcode uses this for "show
> in separate window" actions in the debugger variable view.  You can
> also use the to eliminate the "." for the anonymous structures or
> unions - though of course the MI client could do this too...

In fact, I've posted a patch that ports -var-info-path-expression to mainline 
some time ago and we talked briefly with Daniel some time ago.

I'll see if I can revive that patch.

Thanks,
Volodya


  reply	other threads:[~2006-11-15 17:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-15  9:38 Vladimir Prus
2006-11-15 14:54 ` Daniel Jacobowitz
2006-11-15 14:58   ` Vladimir Prus
2006-11-15 17:21     ` Jim Ingham
2006-11-15 17:28       ` Vladimir Prus [this message]
2006-11-15 17:52         ` Jim Ingham

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=200611152027.44035.vladimir@codesourcery.com \
    --to=vladimir@codesourcery.com \
    --cc=gdb@sources.redhat.com \
    --cc=jingham@apple.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