From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26439 invoked by alias); 20 Apr 2006 18:26:03 -0000 Received: (qmail 26426 invoked by uid 22791); 20 Apr 2006 18:26:02 -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 18:26:01 +0000 Received: from HOME-C4E4A596F7 (IGLD-80-230-9-6.inter.net.il [80.230.9.6]) by nitzan.inter.net.il (MOS 3.7.3-GA) with ESMTP id DED12151 (AUTH halo1); Thu, 20 Apr 2006 21:25:57 +0300 (IDT) Date: Thu, 20 Apr 2006 18:41:00 -0000 Message-Id: From: Eli Zaretskii To: gdb@sourceware.org In-reply-to: <20060420143944.GA14255@nevyn.them.org> (message from Daniel Jacobowitz on Thu, 20 Apr 2006 10:39:44 -0400) Subject: Re: Checking if addess is on stack? Reply-to: Eli Zaretskii References: <200604201426.59360.ghost@cs.msu.su> <200604201548.36899.ghost@cs.msu.su> <20060420124903.GA11015@nevyn.them.org> <20060420143944.GA14255@nevyn.them.org> 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/msg00281.txt.bz2 > Date: Thu, 20 Apr 2006 10:39:44 -0400 > From: Daniel Jacobowitz > > Everything's clearer with code! It is, thanks. > struct kind { > int i; > }; > > void func1 (void) > { > struct kind kin; > > func2 (&kin); > } > > void func2 (struct kind *my_kin) > { > struct kind *ptr = my_kin; > /* HERE */ > } > > We're at HERE. I believe that what Vladimir wants is: > (A) a watchpoint on the value referenced by ptr->i, at the moment, > regardless of future changes to ptr. I do this all the time > and wouldn't mind an easier way, but it's just: > print &ptr->i > watch *$31 > (Where $31 is the right number. But "watch ptr->i" already does that for you. Except that it _also_ watches &ptr, and that latter address is what goes out of scope when we leave func2. > (B) For that watchpoint to go out of scope when kin.i, the underlying > object, dies. So perhaps we need to modify the watchpoint machinery so that when func2 returns, we stop watching the parts of the expression that are popped from the stack, but continue watching those which are still valid and in scope. Would that make sense? > Put this way, it's apparent that there is really no way to do > this. I think it can be achieved with setting 2 watchpoints: one on "ptr->i", the other on the address it points to. > -> Would that actually be neat and useful for the CLI? > > (gdb) print $31 > $32 = (int *) 0x44444444 Doesn't "info symbol $31" do this already?