From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10979 invoked by alias); 23 Dec 2013 03:54:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 10970 invoked by uid 89); 23 Dec 2013 03:54:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mtaout23.012.net.il Received: from mtaout23.012.net.il (HELO mtaout23.012.net.il) (80.179.55.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Dec 2013 03:54:29 +0000 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MY800400QPP4200@a-mtaout23.012.net.il> for gdb-patches@sourceware.org; Mon, 23 Dec 2013 05:54:27 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MY800404QUQ3330@a-mtaout23.012.net.il>; Mon, 23 Dec 2013 05:54:27 +0200 (IST) Date: Mon, 23 Dec 2013 03:54:00 -0000 From: Eli Zaretskii Subject: Re: [RFA/python+doco/NEWS] Add gdb.Type.name attribute. In-reply-to: <1387769845-28452-1-git-send-email-brobecker@adacore.com> To: Joel Brobecker Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <838uvc8bo4.fsf@gnu.org> References: <1387769845-28452-1-git-send-email-brobecker@adacore.com> X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00877.txt.bz2 > From: Joel Brobecker > Date: Mon, 23 Dec 2013 07:37:25 +0400 > > Consider the following declarations: > > typedef long our_time_t; > our_time_t current_time = 1384395743; > > The purpose of this patch is to allow the use of a pretty-printer > for variables of type our_time_t. Normally, pretty-printing sniffers > use the tag name in order to determine which, if any, pretty-printer > should be used. But in the case above, the tag name is not set, since > it does not apply to integral types. > > This patch extends the gdb.Type list of attributes to also include > the name of the type, thus allowing the sniffer to match against > that name. With that change, I was able to write a pretty-printer > which displays our variable as follow: > > (gdb) print current_time > $1 = Thu Nov 14 02:22:23 2013 (1384395743) > > gdb/ChangeLog: > > * python/py-type.c (typy_get_name): New function. > (type_object_getset): Add entry for attribute "name". > * NEWS: Add entry mentioning this new attribute. > > gdb/doc/ChangeLog: > > * gdb.texinfo (Types In Python): Document new attribute Types.name. > > gdb/testsuite/gdb.python: > > * py-pp-integral.c: New file. > * py-pp-integral.py: New file. > * py-pp-integral.exp: New file. > > Tested on x86_64-linux. OK to commit? OK for the documentation parts. Thanks.