This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA/python+doco/NEWS] Add gdb.Type.name attribute.
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 23 Dec 2013 05:54:19 +0200
- Subject: Re: [RFA/python+doco/NEWS] Add gdb.Type.name attribute.
- Authentication-results: sourceware.org; auth=none
- References: <1387769845-28452-1-git-send-email-brobecker at adacore dot com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> From: Joel Brobecker <brobecker@adacore.com>
> 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.