From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18538 invoked by alias); 20 Sep 2010 12:02:41 -0000 Received: (qmail 18528 invoked by uid 22791); 20 Sep 2010 12:02:40 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 20 Sep 2010 12:02:35 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8KC2OCu026149 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 20 Sep 2010 08:02:24 -0400 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8KC2Lcu005496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Sep 2010 08:02:23 -0400 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o8KC2L7I008316; Mon, 20 Sep 2010 14:02:21 +0200 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o8KC2KJP008311; Mon, 20 Sep 2010 14:02:20 +0200 Date: Tue, 21 Sep 2010 12:39:00 -0000 From: Jan Kratochvil To: Paul Bolle Cc: gdb-patches@sourceware.org, Daniel Jacobowitz Subject: Re: [PATCH] [RFC] python: gdb.Type: strip typedefs past pointers too Message-ID: <20100920120220.GA7099@host1.dyn.jankratochvil.net> References: <1284753356.21566.10.camel@localhost.localdomain> <20100920100417.GA5751@host1.dyn.jankratochvil.net> <1284979636.1857.47.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1284979636.1857.47.camel@localhost.localdomain> User-Agent: Mutt/1.5.20 (2009-12-10) X-IsSubscribed: yes 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 X-SW-Source: 2010-09/txt/msg00344.txt.bz2 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: