This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] embryo of type/main_type pretty_printing...
- From: Tom Tromey <tromey at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 22 Dec 2009 11:42:00 -0700
- Subject: Re: [RFC] embryo of type/main_type pretty_printing...
- References: <20091220074121.GG2804@adacore.com>
- Reply-to: tromey at redhat dot com
>>>>> "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.
Excellent.
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
object.
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.
Tom