From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4337 invoked by alias); 10 Sep 2012 09:54:50 -0000 Received: (qmail 4325 invoked by uid 22791); 10 Sep 2012 09:54:49 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mms3.broadcom.com (HELO mms3.broadcom.com) (216.31.210.19) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 Sep 2012 09:54:36 +0000 Received: from [10.9.200.133] by mms3.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Mon, 10 Sep 2012 02:52:05 -0700 X-Server-Uuid: B86B6450-0931-4310-942E-F00ED04CA7AF Received: from mail-irva-13.broadcom.com (10.11.16.103) by IRVEXCHHUB02.corp.ad.broadcom.com (10.9.200.133) with Microsoft SMTP Server id 8.2.247.2; Mon, 10 Sep 2012 02:53:44 -0700 Received: from [10.177.73.63] (unknown [10.177.73.63]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 482BC9F9F5 for ; Mon, 10 Sep 2012 02:54:20 -0700 (PDT) Message-ID: <504DB8CF.5020801@broadcom.com> Date: Mon, 10 Sep 2012 09:54:00 -0000 From: "Andrew Burgess" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120824 Thunderbird/15.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: [PATCH]: ptype of pointer to typedef References: <50447C4A.8010009@broadcom.com> In-Reply-To: <50447C4A.8010009@broadcom.com> Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 2012-09/txt/msg00103.txt.bz2 Ping! On 03/09/2012 10:45 AM, Andrew Burgess wrote: > Given a test program like this: > > typedef char (my_char_array) [4]; > my_char_array array = {'a', 'b', 'c', 'd'}; > my_char_array *array_p = &array; > > typedef char my_char; > my_char array2 [4] = {'a', 'b', 'c', 'd'}; > my_char (*array2_p)[4] = &array2; > > int > main ( void ) > { > return 0; > } > > Then in gdb: > > (gdb) ptype array2_p > type = char (*)[4] > (gdb) ptype array_p > type = char *)[4] > > > Notice in the array_p case, the missing "(" character. > > Patch below include a fix, and a test case. The test case builds on an > existing test that was marked as xfail in a few cases, I've extended the > xfail to cover the new case I've added, but I have no way to check if > this is the right thing to do or not, I'm happy to change the patch if > anyone has an opinion. > > Ok to commit? > > Cheers, > Andrew > > gdb/ChangeLog > > 2012-09-03 Andrew Bugess > > * c-typeprint.c (c_type_print_varspec_prefix): Pass through the > passed_a_ptr flag when displaying typedef types. > > diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c > index c2a775a..b51ced8 100644 > --- a/gdb/c-typeprint.c > +++ b/gdb/c-typeprint.c > @@ -306,7 +306,7 @@ c_type_print_varspec_prefix (struct type *type, > > case TYPE_CODE_TYPEDEF: > c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), > - stream, show, 0, 0); > + stream, show, passed_a_ptr, 0); > break; > > case TYPE_CODE_UNDEF: > > gdb/testsuite/ChangeLog > > 2012-09-03 Andrew Burgess > > * gdb.base/ptype.exp: Test ptype on a pointer to a typedef. > > diff --git a/gdb/testsuite/gdb.base/ptype.exp > b/gdb/testsuite/gdb.base/ptype.exp > index c7bede2..0eef17d 100644 > --- a/gdb/testsuite/gdb.base/ptype.exp > +++ b/gdb/testsuite/gdb.base/ptype.exp > @@ -370,6 +370,10 @@ if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" > "i*86-* > if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*"} > gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" > > +if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" } > +if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*"} > +gdb_test "ptype pv_char_array" "type = (|unsigned )char > \\(\\*\\)\\\[0?\\\]" > + > # > ## > ## test ptype command with pointers > > > >