From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9683 invoked by alias); 15 Sep 2009 22:43:19 -0000 Received: (qmail 9673 invoked by uid 22791); 15 Sep 2009 22:43:18 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.25) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 Sep 2009 22:43:14 +0000 Received: from totara (167.31.255.123.dynamic.snap.net.nz [123.255.31.167]) by viper.snap.net.nz (Postfix) with ESMTP id 1D8353DA2DE; Wed, 16 Sep 2009 10:43:12 +1200 (NZST) Received: by totara (Postfix, from userid 1000) id 6B236C164; Wed, 16 Sep 2009 10:43:10 +1200 (NZST) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <19120.6268.50257.257928@totara.tehura.co.nz> Date: Tue, 15 Sep 2009 22:43:00 -0000 To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: Patch: implement new dynamic varobj spec In-Reply-To: References: <19113.58116.381538.294631@totara.tehura.co.nz> <19114.58228.563201.654364@totara.tehura.co.nz> <19118.51646.285931.86868@totara.tehura.co.nz> From: nickrob@snap.net.nz (Nick Roberts) 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/msg00494.txt.bz2 > 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 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" > Also, the current approach has a benefit because it is simple and > uniform: we can add more display hints without modifying the C code. and > Nick> For collections, it would seem useful to have some kind of index number. > That would be fine by me. var1.0 above would provide the index. -- Nick http://www.inet.net.nz/~nickrob