[RFC] embryo of type/main_type pretty_printing...

Tom Tromey tromey@redhat.com
Tue Dec 22 18:42:00 GMT 2009

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> As discussed with Daniel and Tom on IRC, I started looking at
Joel> writing pretty printers for struct type and struct main_type.


I like the approach you took; I think it is elegant.

Joel> class StructTypePrettyPrinter:
Joel>     def to_string(self):
Joel>         return "\n{" + ",\n ".join(fields) + "}"

It would be better to have a 'children' method that returns a container
(tuple or list, whatever is convenient).  See the Pretty Printing node
in the manual for details of the contents.

This is better for a few reasons.  From the CLI, it will mean that the
results are printed more nicely: they will respect indentation and "set
print pretty".  From MI, they will show up as children of the type

Regardless of whether you decide to change this, I think you should
check this in.  That will make it simpler for us to improve it.


More information about the Gdb-patches mailing list