This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: breakpoint for accessing memory location


On Sat, Oct 21, 2006 at 11:26:10PM +0200, Eli Zaretskii wrote:
> > Date: Sat, 21 Oct 2006 11:51:25 -0400
> > From: Daniel Jacobowitz <drow@false.org>
> > Cc: "Rodney M. Bates" <rodney.bates@wichita.edu>, gdb@sourceware.org
> > 
> > > > I print the address of p->f and then watch the contents of that address.
> > > 
> > > Does "watch *(<type-of-p->f> *)&p->f" work as well?
> > 
> > I'm pretty sure it won't.  Because "p" is still in the expression, we
> > consider the expression dependent on the value of p, so it goes out of
> > scope when p does.
> 
> So you are saying that "watch p - p" will also cause an error message
> when p goes out of scope?

Well, I just tried it; that's what I'd expect, and it seems to be what
happens, also.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]