From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11083 invoked by alias); 20 Apr 2006 11:42:51 -0000 Received: (qmail 10988 invoked by uid 22791); 20 Apr 2006 11:42:49 -0000 X-Spam-Check-By: sourceware.org Received: from nitzan.inter.net.il (HELO nitzan.inter.net.il) (192.114.186.20) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 20 Apr 2006 11:42:39 +0000 Received: from HOME-C4E4A596F7 (IGLD-80-230-8-103.inter.net.il [80.230.8.103]) by nitzan.inter.net.il (MOS 3.7.3-GA) with ESMTP id DEB07497 (AUTH halo1); Thu, 20 Apr 2006 14:42:35 +0300 (IDT) Date: Thu, 20 Apr 2006 12:21:00 -0000 Message-Id: From: Eli Zaretskii To: Vladimir Prus CC: gdb@sources.redhat.com In-reply-to: <200604201426.59360.ghost@cs.msu.su> (message from Vladimir Prus on Thu, 20 Apr 2006 14:26:58 +0400) Subject: Re: Checking if addess is on stack? Reply-to: Eli Zaretskii References: <200604201426.59360.ghost@cs.msu.su> 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/msg00269.txt.bz2 > From: Vladimir Prus > Date: Thu, 20 Apr 2006 14:26:58 +0400 > Cc: gdb@sources.redhat.com > > I'm not sure that's exactly what I need. This way, watchpoint will be > automatically inserted when I enter 'do_that', but as soon as I leave > 'do_that', gdb will remove wathchpoint because 'ptr' has gone out of scope. > This will prevent me from catching accesses to ptr->i made outside of the > function where 'ptr' is valid. Am I missing something? Perhaps _I_ am missing something. Isn't `ptr' a variable that is local to the function `do_that'? I thought it was; if so, then it couldn't possibly be accessed after `do_that' returns, because all locals are popped off the stack when `do_that' returns. These locals will get entirely new values when `do_that' is entered the next time. (If you want to catch accesses to the address where `ptr' _was_ on the stack, then you really need to set the wathchpoint on an absolute address. But watching addresses on the stack beyond the stack top is a very unusual thing to do, so I don't think this is what your users would need.) OTOH, if by ``leave `do_that''' you mean that `do_that' calls some other function, then `ptr' does not go off the scope, and GDB should not delete the watchpoint. Does this make sense?