From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14513 invoked by alias); 20 Apr 2006 12:49:16 -0000 Received: (qmail 14496 invoked by uid 22791); 20 Apr 2006 12:49:15 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Thu, 20 Apr 2006 12:49:06 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FWYam-0002uD-E6 for gdb@sourceware.org; Thu, 20 Apr 2006 08:49:04 -0400 Date: Thu, 20 Apr 2006 14:39:00 -0000 From: Daniel Jacobowitz To: gdb@sourceware.org Subject: Re: Checking if addess is on stack? Message-ID: <20060420124903.GA11015@nevyn.them.org> Mail-Followup-To: gdb@sourceware.org References: <200604201426.59360.ghost@cs.msu.su> <200604201548.36899.ghost@cs.msu.su> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.8i 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/msg00272.txt.bz2 On Thu, Apr 20, 2006 at 03:21:03PM +0300, Eli Zaretskii wrote: > Well, I thought the trick with tb does the equivalent of what you > wanted. It automatically inserts the watchpoint when the scope is > entered, while its deletion is handled by GDB itself. Next time the > function is entered, GDB will insert the watchpoint again. Isn't that > what you want, as far as the variable-out-of-scope issue is > considered? (Whether to watch the address or the expression is a > different matter, as mentioned above.) What he wants is not to stop the watchpoint when ptr goes out of scope, but when ptr->i goes out of scope - if ptr points to a stack allocated variable, in this function or another one. Sorry, Vladimir, there's no way to do this. You'd have to keep an eye on the value of $sp manually, and know whether the stack grew up or down. Even that wouldn't help enough, since you might miss a stack pop and push. There's no way to keep track of register values in the way we can watchpoint memory. -- Daniel Jacobowitz CodeSourcery