From: "André Pönitz" <andre.poenitz@nokia.com>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH] [RFC] python: gdb.Type: strip typedefs past pointers too
Date: Mon, 20 Sep 2010 13:14:00 -0000 [thread overview]
Message-ID: <201009201214.21314.andre.poenitz@nokia.com> (raw)
In-Reply-To: <1284753356.21566.10.camel@localhost.localdomain>
On Friday 17 September 2010 21:55:56 ext Paul Bolle wrote:
> 0) gdb.Type.strip_typedefs() stops stripping types if it encounters a
> type that is a pointer to a typedef:
>
> (gdb) ptype wchar_t
> type = long int
> (gdb) ptype wchar_t *
> type = long int *
Funny. What platform and gdb version is that? I seem to get 'wchar_t *'
here with 6.3, 6.8. 7.0, 7.1, and fairly recent git.
>&"ptype wchar_t\n"
>~"type = wchar_t\n"
>^done
>&"ptype wchar_t*\n"
>~"type = wchar_t *\n"
> (gdb) python print gdb.lookup_type("wchar_t").strip_typedefs()
> long int
> (gdb) python print gdb.lookup_type("wchar_t").pointer().strip_typedefs()
> wchar_t *
[This is also in my opinion correct and expected behaviour.]
> 1) I drafted a patch (pasted below this message) that works around this
> limitation:
>
> (gdb) ptype wchar_t
> type = long int
> (gdb) ptype wchar_t *
> type = long int *
> (gdb) python print gdb.lookup_type("wchar_t").strip_typedefs()
> long int
> (gdb) python print gdb.lookup_type("wchar_t").pointer().strip_typedefs()
> long int *
If you need the functionality you can provide it using a few lines of
Python by checking for type.code == gdb.TYPE_CODE_PTR and
recurse if needed.
Andre'
prev parent reply other threads:[~2010-09-20 10:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-18 14:12 Paul Bolle
2010-09-19 16:35 ` Joel Brobecker
2010-09-19 17:56 ` Paul Bolle
2010-09-20 9:32 ` Daniel Jacobowitz
2010-09-20 9:48 ` Paul Bolle
2010-09-20 10:04 ` Daniel Jacobowitz
2010-09-20 10:15 ` Phil Muldoon
2010-09-20 10:53 ` Paul Bolle
2010-09-20 12:02 ` Jan Kratochvil
2010-09-20 16:25 ` Paul Bolle
2010-09-20 13:59 ` Paul Bolle
2010-09-20 16:08 ` Paul Bolle
2010-09-21 12:39 ` Jan Kratochvil
2010-09-20 13:14 ` André Pönitz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201009201214.21314.andre.poenitz@nokia.com \
--to=andre.poenitz@nokia.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox