This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
subtype printing ignores type printers: API deficiency?
- From: Matei David <matei at cs dot toronto dot edu>
- To: gdb at sourceware dot org
- Date: Thu, 12 Mar 2015 18:42:19 -0400
- Subject: subtype printing ignores type printers: API deficiency?
- Authentication-results: sourceware.org; auth=none
Hi,
While working on pretty printers for Boost, I found something which
might be a deficiency of the default built-in value printer, or of the
python API:
When type `A` is a base class of type `B`, and gdb attempts to print an
object `b` of type `B`, the default built-in printer produces something
like:
{ <A> = [invoke value printer for A], [other fields of B] }
The problem is that in doing so, it ignores any type printer for A.
A full example is here:
https://github.com/ruediger/Boost-Pretty-Printer/issues/11#issuecomment-78616860
I would expect the output to look like:
{ <[invoke type printer for A]> = [invoke value printer for A], [other
fields of B] }
Is there a way to achieve this? That is, to customize how A gets
printed as a base class?
Naturally, this is all fixed by writing a custom value printer for B.
But if A is a type in a library and B is a user type, it would be nice
to have the option to customize the value/type printing of A, not B.
Thanks,
Matei