From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21101 invoked by alias); 22 May 2007 02:05:49 -0000 Received: (qmail 20788 invoked by uid 22791); 22 May 2007 02:05:48 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 22 May 2007 02:05:43 +0000 Received: from kahikatea.snap.net.nz (52.60.255.123.dynamic.snap.net.nz [123.255.60.52]) by viper.snap.net.nz (Postfix) with ESMTP id 675293DB7A7; Tue, 22 May 2007 14:05:39 +1200 (NZST) Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id EC4BA8F92C; Tue, 22 May 2007 14:05:35 +1200 (NZST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18002.20463.147887.664973@kahikatea.snap.net.nz> Date: Tue, 22 May 2007 02:05:00 -0000 To: Ross Morley Cc: Maxim Grigoriev , gdb@sourceware.org, Marc Gauthier , Pete MacLiesh Subject: Re: Understanding GDB frames In-Reply-To: <46522B10.6090008@tensilica.com> References: <46521C04.7040405@hq.tensilica.com> <46522B10.6090008@tensilica.com> X-Mailer: VM 7.19 under Emacs 22.1.50.258 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-05/txt/msg00100.txt.bz2 > Compare the two iterations of the loop in f12() with the two > calls to f11(). For the calls to f11(), each has a separate > instantiation of the frame and thus (strictly speaking) has a > separate frame and a separate instance of var 'a'. In the two > iterations of f12(), the frame is the same one set up at the > beginning of the single call, and 'a' is the same variable. > In both cases, the PC and SP are the same. > > How can GDB tell the difference? (using the return address > instead of the PC in identifying the frame is one way, but > then one only needs to go one level deeper to defeat it). > > Does GDB need to tell the difference? > > GDB confronts a similar issue with watchpoints on local vars. > It uses a special scope breakpoint to detect the return of the > function and thus detect the watched variable going out of > scope. That mechanism is not used for MI variables. Is that > because the extra overhead is tolerable if a watchpoint is > set but not otherwise? Watchpoints are different to variable objects in that they stop execution, when their value changes, for example. Presumably when the vlaue is being monitored, so too can the scope. Variable objects are only updated (if requested) after execution has already stopped. > Should scoping of MI vars be treated the same as watched vars? As watchpoints? I don't think so. A closer analogy to variable objects is the "display" command. There, GDB allows expressions to come back into scope. -- Nick http://www.inet.net.nz/~nickrob