From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12358 invoked by alias); 16 Sep 2009 05:39:07 -0000 Received: (qmail 12206 invoked by uid 22791); 16 Sep 2009 05:39:06 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from lo.gmane.org (HELO lo.gmane.org) (80.91.229.12) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 16 Sep 2009 05:39:03 +0000 Received: from list by lo.gmane.org with local (Exim 4.50) id 1MnnEJ-0005AI-5k for gdb-patches@sources.redhat.com; Wed, 16 Sep 2009 07:38:59 +0200 Received: from h86-62-88-129.ln.rinet.ru ([86.62.88.129]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 16 Sep 2009 07:38:59 +0200 Received: from vladimir by h86-62-88-129.ln.rinet.ru with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 16 Sep 2009 07:38:59 +0200 To: gdb-patches@sources.redhat.com From: Vladimir Prus Subject: Re: Patch: implement new dynamic varobj spec Date: Wed, 16 Sep 2009 05:39:00 -0000 Message-ID: References: <19120.6268.50257.257928@totara.tehura.co.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit User-Agent: KNode/0.10.9 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: 2009-09/txt/msg00498.txt.bz2 Nick Roberts wrote: > > Nick> 2) If is_map is true, rather than: > > [...] > > Nick> I would prefer GDB to output: > > Nick> var1.0 = "map_element" > > Nick> var1.0.key = key0 > > Nick> var1.0.value = value0 > > > > Nick> That way the values could be displayed as a tree: > > > > I considered this back at the start. The problem with doing this is > > that the key need not be a scalar. It could be a struct or some other > > complicated varobj with children. > > It's probably unusual for the key to be a structure Rather, it's very typical in C++. std::map is used all over. > but that wouldn't be a > problem and it in could be expanded in turn. Something like (I'm not a C++ > programmer and maybe values would need some kind of comparator to be defined): > > struct values > { > int a; > float b; > }; > > map m1; > > struct values val = {a : 5, b : 7.5}; > struct values *v; > *v = val; > > m1[v] = "a string"; > > > -var-create - * m1 > -var-list-children -var1 > > var1.0 = "map_element" > var1.0.key = key0 > var1.0.key.a = 5 > var1.0.key.b = 7.5 > var1.0.value = "a string" What if 'values' wishes to have a field named 'key'? - Volodya