From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17712 invoked by alias); 6 Apr 2006 16:52:32 -0000 Received: (qmail 17704 invoked by uid 22791); 6 Apr 2006 16:52:32 -0000 X-Spam-Check-By: sourceware.org Received: from mail-out3.apple.com (HELO mail-out3.apple.com) (17.254.13.22) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 06 Apr 2006 16:52:30 +0000 Received: from relay6.apple.com (relay6.apple.com [17.128.113.36]) by mail-out3.apple.com (8.12.11/8.12.11) with ESMTP id k36GqKJp024304; Thu, 6 Apr 2006 09:52:20 -0700 (PDT) Received: from [17.201.22.240] (inghji.apple.com [17.201.22.240]) by relay6.apple.com (Apple SCV relay) with ESMTP id D0E2217; Thu, 6 Apr 2006 09:52:20 -0700 (PDT) In-Reply-To: <200604061703.26246.ghost@cs.msu.su> References: <200602171724.03824.ghost@cs.msu.su> <200602210951.53705.ghost@cs.msu.su> <8B18ED72-F372-4A1C-A6DF-9A5AA4A0826F@apple.com> <200604061703.26246.ghost@cs.msu.su> Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <3D7DB938-8B8A-4DE9-BA5B-2E2F56DA24D7@apple.com> Cc: GDB List Content-Transfer-Encoding: 7bit From: Jim Ingham Subject: Re: MI: type prefixes for values Date: Thu, 06 Apr 2006 18:58:00 -0000 To: Vladimir Prus X-IsSubscribed: yes 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/msg00075.txt.bz2 On Apr 6, 2006, at 6:03 AM, Vladimir Prus wrote: > 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? > I said this in another response, but to be clear, Xcode stores the frame_id's from each stack frame when it stops. It holds onto this, and when it stops again it checks this fingerprint against the new frame id's, and the throws away all the varobj's from the point the frame_id's vary on to the bottom of stack. There's no ambiguity if you do this. Jim >> 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