This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] [RFC] python: gdb.Type: strip typedefs past pointers too
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Paul Bolle <pebolle at tiscali dot nl>
- Cc: gdb-patches at sourceware dot org
- Date: Sat, 18 Sep 2010 10:12:53 -0400
- Subject: Re: [PATCH] [RFC] python: gdb.Type: strip typedefs past pointers too
- References: <1284753356.21566.10.camel@localhost.localdomain>
> 1) I drafted a patch (pasted below this message) that works around this
> limitation:
Personally, I think that the current behavior is correct. But I did
not participate in the design of the API, so others will probably
have a more informed opinion.
If we want to support the behavior you are looking for, I think it
should be done either through the control of a parameter (defaulted
to current behavior), or another method (recursive_strip_typedef).
> + while (TYPE_CODE (real_type) == TYPE_CODE_PTR ||
> + TYPE_CODE (real_type) == TYPE_CODE_TYPEDEF)
Small nit on the coding style: the `||' should be at the beginning
of the next line:
while (TYPE_CODE (real_type) == TYPE_CODE_PTR
|| TYPE_CODE (real_type) == TYPE_CODE_TYPEDEF)
(how about references?)
> + if (TYPE_CODE (real_type) == TYPE_CODE_TYPEDEF)
> + {
> + CHECK_TYPEDEF (real_type);
> + }
When there is only one statement in the block, the prefered style
in GDB is to omit the curly braces:
if (TYPE_CODE (real_type) == TYPE_CODE_TYPEDEF)
CHECK_TYPEDEF (real_type);
--
Joel