Inconsistency in pretty printer documentation
Evan Driscoll <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <CAAR9PsVN-ZHjfXcn1ibAA08K1-Mx7F9Xh0kZZVMX0cV_3A5SpQ@mail.gmail.com> |
The documentation for the gdb.printing module [1] says the following: PrettyPrinter (name, subprinters=None) ... Pretty-printers should generally inherit from this class. However, in the "writing a pretty printer" section [2], there are several examples of pretty printers (StdStringPrinter, fooPrinter, barPrinter), none of which inherit from gdb.printing.PrettyPrinter. Many of the third-party pages describing third-party printers around the web (e.g. [3-5]) do not inherit from anything except object. In the printers I've written, I've not been using PrettyPrinter and things seem to mostly work, but I also haven't really messed around with enable/disable pretty-printer etc. Am I missing out on something by not using the PrettyPrinter class? If I were to use it, do I just implement the same API? Is PrettyPrinter a largely-defunct class that is no longer needed? Is it a newer class and the other docs haven't been updated, and get new functionaliy from it? Evan [1] https://sourceware.org/gdb/onlinedocs/gdb/gdb_002eprinting.html#gdb_002eprinting [2] https://sourceware.org/gdb/onlinedocs/gdb/Writing-a-Pretty_002dPrinter.html#Writing-a-Pretty_002dPrinter [3] https://www.rethinkdb.com/blog/make-debugging-easier-with-custom-pretty-printers/ [4] http://tromey.com/blog/?p=524 [5] http://tromey.com/blog/?p=546