This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Python API - nested pretty printers MI implications
- From: Andrew Oakley <andrew at ado dot is-a-geek dot net>
- To: gdb at sourceware dot org
- Date: Sun, 14 Aug 2011 17:10:23 +0100
- Subject: Python API - nested pretty printers MI implications
I've got a patch to allow the Python pretty printer children iterators
to return more pretty printers so they can create "phony groups" a bit
like this:
class outer_pretty_printer:
class inner_pretty_printer:
def __init__(self, ...):
...
def to_string(self):
...
def children(self):
...
def __init__(self, val):
...
def to_string(self):
...
def children(self):
yield ("normal variable", "some value")
yield ("phony group 1", inner_pretty_printer(...))
yield ("phony group 2", inner_pretty_printer(...))
This seems to work well but I'm not quite sure how to handle the for MI.
As far as I can tell I need to create "fake" varobj structures with no
underlying value or type (because I don't have one). This appears to
already happen and is tested for with CPLUS_FAKE_CHILD, but I'm not
quite sure what that is for. Does this seem like a reasonable thing to
do (after searching around for CPLUS_FAKE_CHILD)?
My other worry is varobj invalidation and update. Am I correct in
thinking that updates can only happen from a "root" varobj? If so it
should be possible to reconstruct the "fake" varobj structures in
varobj_update (I don't think it will be straightforward though).
Am I correct in assuming you would want MI to work before accepting
patches?
--
Andrew Oakley