From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4704 invoked by alias); 2 Sep 2005 07:58:45 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 4640 invoked by uid 22791); 2 Sep 2005 07:58:31 -0000 Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 02 Sep 2005 07:58:31 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1EB6Q9-0001SD-Sy for gdb@sources.redhat.com; Fri, 02 Sep 2005 09:57:09 +0200 Received: from zigzag.lvk.cs.msu.su ([158.250.17.23]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 02 Sep 2005 09:57:09 +0200 Received: from ghost by zigzag.lvk.cs.msu.su with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 02 Sep 2005 09:57:09 +0200 To: gdb@sources.redhat.com From: Vladimir Prus Subject: "info locals" -- is variable initialized Date: Fri, 02 Sep 2005 07:58:00 -0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit User-Agent: KNode/0.8.2 X-SW-Source: 2005-09/txt/msg00010.txt.bz2 Hello, I'm thinking about adding pretty-printing for STL and KDE structures in KDevelop, and run into this problem. Consider the program: int main() { int i1; .... KURL i2; } When entering this function, KDevelop asks gdb via "info locals" what locals vars are there. But, gdb reports all variables, even though at the function entry 'i2' is not initialized (or, from C++ point of view, not even visible yet). For pretty priting 'i2', I have to evaluate 'i2.prettyURL(0)', which will just crash. I can use "set unwindonsignal on", but generally, calling methods on uninitialized object can damage random memory. So: 1. Can I determine, for a given variable, if it's in scope already? 2. Can I make "info local" return only the variables that are already in scope? 3. If no, any ideas how the above can be implemented? - Volodya