This is the mail archive of the gdb@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]

subtype printing ignores type printers: API deficiency?


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


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