From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30998 invoked by alias); 4 Oct 2012 10:57:12 -0000 Received: (qmail 30985 invoked by uid 22791); 4 Oct 2012 10:57:10 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mms1.broadcom.com (HELO mms1.broadcom.com) (216.31.210.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Oct 2012 10:57:06 +0000 Received: from [10.9.200.131] by mms1.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Thu, 04 Oct 2012 03:55:57 -0700 X-Server-Uuid: 06151B78-6688-425E-9DE2-57CB27892261 Received: from mail-irva-13.broadcom.com (10.11.16.103) by IRVEXCHHUB01.corp.ad.broadcom.com (10.9.200.131) with Microsoft SMTP Server id 8.2.247.2; Thu, 4 Oct 2012 03:56:59 -0700 Received: from [10.177.73.83] (unknown [10.177.73.83]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 6F6EF40FE5 for ; Thu, 4 Oct 2012 03:56:59 -0700 (PDT) Message-ID: <506D6B7B.8070602@broadcom.com> Date: Thu, 04 Oct 2012 10:57:00 -0000 From: "Andrew Burgess" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: [RFC] Change how value is shown for varobjs of type vector. References: <50631DE7.7050702@broadcom.com> In-Reply-To: <50631DE7.7050702@broadcom.com> Content-Type: text/plain; charset=iso-8859-1 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-10/txt/msg00066.txt.bz2 *ping* On 26/09/2012 4:23 PM, Andrew Burgess wrote: > Consider: > >> cat vec.c > char vector __attribute__ ((vector_size (8))) = { 0, 0, 0, 0, 0, 0, 0, 0 }; > > int > main () > { > /* Nothing. */ > } >> gcc -g -o vec.x vec.c >> gdb vec.x > (gdb) start > (gdb) interpreter-exec mi2 "-var-create vector * vector" > ^done,name="vector",numchild="8",value="[8]",type="char [8]",has_more="0" > > ## END ## > > I have a patch (below) that changes the value field from the current "[8]" to "{ 0, 0, 0, 0, 0, 0, 0, 0 }". The varobj still has 8 children, and the top level varobj is still not editable, you have to edit through the children. > > This better suits my local usage where vectors are generally used with just a small number of entries, each vector type has a total size of one 64-bit register, the frontend used to view this MI data is just passing the value field through, and my users wanted to visualise the set of values in a single field. > > I've not finished the patch yet with changelog or tests because I wasn't sure if this change was going to be acceptable, so I'm looking for some feedback please. One possibility would be to make this behaviour switchable, if it can't be the default. > > Thanks, > > Andrew > > > diff --git a/gdb/varobj.c b/gdb/varobj.c > index 6699699..c72716b 100644 > --- a/gdb/varobj.c > +++ b/gdb/varobj.c > @@ -3119,10 +3119,13 @@ default_value_is_changeable_p (struct varobj *var) > { > case TYPE_CODE_STRUCT: > case TYPE_CODE_UNION: > - case TYPE_CODE_ARRAY: > r = 0; > break; > > + case TYPE_CODE_ARRAY: > + r = TYPE_VECTOR (type); > + break; > + > default: > r = 1; > } > @@ -3507,12 +3510,16 @@ c_value_of_variable (struct varobj *var, enum varobj_display_formats format) > > case TYPE_CODE_ARRAY: > { > - char *number; > + if (!TYPE_VECTOR (type)) > + { > + char *number; > > - number = xstrprintf ("[%d]", var->num_children); > - return (number); > + number = xstrprintf ("[%d]", var->num_children); > + return (number); > + /* break; */ > + } > } > - /* break; */ > + /* fall through */ > > default: > { > > > > > > >