This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]