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 Thu, Oct 19, 2006 at 10:23:56PM +0200, Erik Leunissen wrote:
> Daniel Jacobowitz wrote:
> >
> >Take a look at "watchpoints" in the manual.  They should be exactly
> >what you need.
> >
> 
> Yes, I saw watchpoints also, but didn't recognize them as being useful 
> in my case. From the manual:
> 
> watch expr
>     Set a watchpoint for an expression. GDB will break when expr is
>     written into by the program and its value changes.
> 
> Did you mean that "expr" may stand for a specific memory location?
> 
> (In my case, assuming that the memory location that I want to watch is 
> 0x08135400, I could simply do
> 
>     watch 0x08135400   ?)

Almost, but not quite.  "0x08135400" is an expression whose value never
changes.  But "*(int*)0x08135400" is an expression that will change
when that memory location is written to.

-- 
Daniel Jacobowitz
CodeSourcery


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