From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Paul Bolle <pebolle@tiscali.nl>
Cc: gdb-patches@sourceware.org, Daniel Jacobowitz <dan@codesourcery.com>
Subject: Re: [PATCH] [RFC] python: gdb.Type: strip typedefs past pointers too
Date: Tue, 21 Sep 2010 12:39:00 -0000 [thread overview]
Message-ID: <20100920120220.GA7099@host1.dyn.jankratochvil.net> (raw)
In-Reply-To: <1284979636.1857.47.camel@localhost.localdomain>
On Mon, 20 Sep 2010 12:47:16 +0200, Paul Bolle wrote:
> On Mon, 2010-09-20 at 12:04 +0200, Jan Kratochvil wrote:
> > On Fri, 17 Sep 2010 21:55:56 +0200, Paul Bolle wrote:
> > > (gdb) ptype wchar_t
> > > type = long int
> > > (gdb) ptype wchar_t *
> > > type = long int *
I can confirm it here:
(gdb) ptype wchar_t *
type = int *
> Daniel explained that this seems to be a bug in the ptype command.
I also thought so, therefore tried the fix below but it regresses on:
(gdb) ptype foop
-type = struct foo {
- int a;
- int b;
-} *
-PASS: gdb.base/opaque.exp: ptype on opaque struct pointer (statically)
+type = struct foo *
+FAIL: gdb.base/opaque.exp: ptype on opaque struct pointer (statically)
Still if `a' or `b' are typedefs they are preserved undereferenced.
I would generally prefer to use always whatis; but that does not work for:
(gdb) whatis struct foo
type = struct foo
This is a longterm issue that `ptype' is too much aggreesive while `whatis' is
too little aggresive.
> Do you mean that the current text is ambiguous?
Yes.
> In the commit message of my draft patch I noted that strip_typedefs()
> "doesn't really behave as advertised (well, as I understand the
> advertisement)". I understood that text to mean that behavior similar to
> that of the ptype command was intended.
I understood it as the intended behavior was that of check_typedef.
This is also how the function is implemented.
BTW I am +1 for André's suggested Python wrapper (or even +0.5 for the Phil's
suggested new parameter.)
Thanks,
Jan
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -723,7 +723,7 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show,
case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD:
case TYPE_CODE_METHODPTR:
- c_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+ c_type_print_base (TYPE_TARGET_TYPE (type), stream, show - 1, level);
break;
case TYPE_CODE_STRUCT:
next prev parent reply other threads:[~2010-09-20 12:02 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 [this message]
2010-09-20 13:14 ` André Pönitz
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=20100920120220.GA7099@host1.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=dan@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=pebolle@tiscali.nl \
/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