From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13214 invoked by alias); 6 Apr 2006 13:03:44 -0000 Received: (qmail 13204 invoked by uid 22791); 6 Apr 2006 13:03:43 -0000 X-Spam-Check-By: sourceware.org Received: from zigzag.lvk.cs.msu.su (HELO zigzag.lvk.cs.msu.su) (158.250.17.23) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 06 Apr 2006 13:03:41 +0000 Received: from Debian-exim by zigzag.lvk.cs.msu.su with spam-scanned (Exim 4.50) id 1FRU96-0000mW-G9 for gdb@sources.redhat.com; Thu, 06 Apr 2006 17:03:37 +0400 Received: from zigzag.lvk.cs.msu.su ([158.250.17.23]) by zigzag.lvk.cs.msu.su with esmtp (Exim 4.50) id 1FRU90-0000l8-UX; Thu, 06 Apr 2006 17:03:27 +0400 From: Vladimir Prus To: Jim Ingham Subject: Re: MI: type prefixes for values Date: Thu, 06 Apr 2006 13:33:00 -0000 User-Agent: KMail/1.7.2 Cc: GDB List References: <200602171724.03824.ghost@cs.msu.su> <200602210951.53705.ghost@cs.msu.su> <8B18ED72-F372-4A1C-A6DF-9A5AA4A0826F@apple.com> In-Reply-To: <8B18ED72-F372-4A1C-A6DF-9A5AA4A0826F@apple.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200604061703.26246.ghost@cs.msu.su> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-04/txt/msg00055.txt.bz2 On Tuesday 21 February 2006 21:13, Jim Ingham wrote: > > Say, I've created a bunch of variable objects for for local > > variables. When I > > leave the function, those variables become invalid. How do you > > detect this > > case? Do you have a command '-list-var-objects-that-are-dead', or > > some other > > mechanism. > > We don't do this in gdb. Xcode keeps track of which varobj's go with > which stack frames, and deletes them when appropriate. You want to > be a little clever about this, 'cause there's no need to delete the > varobj's till the function is actually popped off the stack. You > might descend into another function then come back to this one, in > which case the varobj's are still good. I was thinking about this more, and still not 100% sure how Xcode can do this. Do you mean that Xcode takes a stack trace when the varobj was created, and deletes varobj whenever it sees that stack became shorter? The case I'm not sure about is this: 1. main calls 'a' which calls 'b' which bits breakpoint. 2 varobj is created for local var of 'b' 3. Users says 'continue'. 4. 'b' exists and then 'a' calls 'b' again and breakpoint is hit again. However, this second time it's not guaranteed that stack frame of 'b' is at the same address as it was the last time -- maybe 'a' has pushed something on stack. How do you detect this case? > Note, however, that the varobj's do remember their frames, so if you > tried to evaluate one that was no longer on the stack, the varobj > would report "out of scope". Would be great to add this in FSF version. - Volodya