From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116162 invoked by alias); 12 Mar 2015 22:45:11 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 116151 invoked by uid 89); 12 Mar 2015 22:45:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=BAYES_00,FSL_HELO_BARE_IP_2,RCVD_IN_DNSWL_LOW,RCVD_NUMERIC_HELO,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: plane.gmane.org Received: from plane.gmane.org (HELO plane.gmane.org) (80.91.229.3) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 12 Mar 2015 22:45:10 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YWBqh-00088D-Ec for gdb@sourceware.org; Thu, 12 Mar 2015 23:45:03 +0100 Received: from 173.199.65.35 ([173.199.65.35]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 Mar 2015 23:45:03 +0100 Received: from matei by 173.199.65.35 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 Mar 2015 23:45:03 +0100 To: gdb@sourceware.org From: Matei David Subject: subtype printing ignores type printers: API deficiency? Date: Thu, 12 Mar 2015 22:45:00 -0000 Message-ID: <20150312184219.3496aaa6@ara-vm-ku1404-3> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00025.txt.bz2 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: { = [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