From: Tom Tromey <tromey@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org, vladimir@codesourcery.com
Subject: Re: RFC: how to handle mutable types in varobj?
Date: Mon, 02 Jan 2012 21:03:00 -0000 [thread overview]
Message-ID: <m3zke5kebm.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20111228155943.GD2632@adacore.com> (Joel Brobecker's message of "Wed, 28 Dec 2011 19:59:43 +0400")
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> Purely based on the reading of the documentation and then the code,
Joel> I think that mutable types haven't been considered in the original
Joel> design
Yeah, I agree. The weird access protection stuff makes me think that
perhaps C++ also wasn't considered -- IMNSHO this should be represented
via attributes on the various fields, not phony intermediate varobjs.
Joel> It also seems that support for Python pretty-printing
Joel> has been crafted on to varobj, and indirectly introduced the notion
Joel> of dynamicity, which is probably similar in some ways to our mutability.
Joel> But I am also guessing that this support was implemented in a way
Joel> that kept things compatible at the GDB/MI level. As a result, I am
Joel> having a hard time building a good overal picture of how things work,
Joel> partly because there are so many flags: children_requested, from, to,
Joel> type_changed, updated, changedm children_changed, etc.
The spaghetti is at least partly my fault. Sorry about that.
TBH I found hacking varobj to be quite difficult.
You are right that dynamic varobjs were introduced to maintain
compatibility. If the client does not send -enable-pretty-printing,
then no dynamic varobj will ever be created. The idea is that dynamic
varobjs require some special client handling, so clients have to
explicitly request them.
Joel> The careful reader will also notice that I'm having trouble with
Joel> figuring out some invariants regarding the `from' and `to' fields
Joel> with respect to the `num_children' field... More stuff to be figured
Joel> out later...
'from' and 'to' are set by the MI client. See -var-list-children and
-var-set-update-range. I think these only really make sense for dynamic
varobjs, but maybe they work with any varobj, I don't recall.
I don't remember how 'num_children' is used any more.
Pedro> So, I factored out the "listing dynamic varobj's
Pedro> children" code behind a common interface, making use of a new
Pedro> iterator "virtual" object (struct varobj_iter), and reimplemented
Pedro> both pretty-printing varobjs and available-children-only varobjs using
Pedro> that same interface.
Sounds nice.
Pedro> Implementing Ada mutable types support through this would mean mutable
Pedro> varobjs would be exposed as dynamic=1 varobjs. I'm not sure that'd be
Pedro> a problem? With frontends that currently support dynamic varobjs,
Pedro> things should simply work.
I think the only caveat is that it has to be requested.
But, presumably Joel has a particular client in mind.
And, anyway, clients not supporting dynamic varobjs are really missing out.
Pedro> Non dynamic varobjs were kind of a mistake
Pedro> anyway (a !dynamic varobj that is bound to an 10000000 element array
Pedro> is wholly fetched in gdb memory at once...).
Yeah.
Tom
next prev parent reply other threads:[~2012-01-02 21:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-28 16:13 Joel Brobecker
2011-12-29 11:13 ` Joel Brobecker
2012-01-02 15:43 ` Pedro Alves
2012-01-02 16:22 ` Joel Brobecker
2012-01-02 16:48 ` Pedro Alves
2012-01-02 21:03 ` Tom Tromey [this message]
2012-01-03 17:11 ` 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=m3zke5kebm.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=vladimir@codesourcery.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