From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29750 invoked by alias); 15 Sep 2009 22:28:34 -0000 Received: (qmail 29742 invoked by uid 22791); 15 Sep 2009 22:28:33 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_36,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:28:28 +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 9B4C73DA32E; Wed, 16 Sep 2009 10:28:25 +1200 (NZST) Received: by totara (Postfix, from userid 1000) id E874BC164; Wed, 16 Sep 2009 10:28:23 +1200 (NZST) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <19120.5383.874148.235514@totara.tehura.co.nz> Date: Tue, 15 Sep 2009 22:28: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/msg00493.txt.bz2 > With a dynamic varobj you can tell if it has children by examining the > has_more attribute. The field has_more tells you if it _currently_ has children. If you create a variable object of a STL container immediately after declaring an empty container, e.g. after map m; then has_more=0 yet the node for it would need to be expandable. In Emacs this means there is a plus sign on the icon in the toolbar. Clicking on it gives no immediate children but then as you proceed: l.push_back (1); l.push_back (2); the additional children appear. With a string there are never any children so you would not want an expandable node. AFAICS the only way the front end can discriminate is through the displayhint field. On that note, printers.py in libstdc++ doesn't have a displayhint function for StdListPrinter. Also there appears to be something wrong with the python class StdVectorPrinter because if you create a variable object immediately after declaring it, e.g. after vector v(4); // create vector of integers with 4 elts then do -var-list-children, GDB hangs: -var-create - * v ^done,name="var1",numchild="0",value="{...}",type="std::vector >",thread-id="1",dynamic="1",has_more="1" (gdb) -var-list-children var1 p v gives: p v &"p v\n" ~"$1 = std::vector of length -17178288109, capacity 35167192218076 = {" &"Cannot access memory at address 0x1000000006\n" ^error,msg="Cannot access memory at address 0x1000000006" (gdb) while a similar declaration for list just prints with uninitialised values. -- Nick http://www.inet.net.nz/~nickrob