public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* subtype printing ignores type printers: API deficiency?
@ 2015-03-12 22:45 Matei David
  0 siblings, 0 replies; only message in thread
From: Matei David @ 2015-03-12 22:45 UTC (permalink / raw)
  To: gdb

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-03-12 22:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-12 22:45 subtype printing ignores type printers: API deficiency? Matei David

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).