public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Setting watchpoints
@ 2003-04-17 20:10 Al Niessner
  2003-04-17 20:20 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Al Niessner @ 2003-04-17 20:10 UTC (permalink / raw)
  To: gdb


Platform information:
OS: Linux
Kernel: 2.4.19
gcc/g++: 3.2.2
gdb: 5.3
threads: 1 -- single threaded application


How do I set a watch point so that the debugger halts when memory at a
specific address is changed? There is no easy to define variable that I
can latch onto, but I do know its address. When I set a watch point to
this address -- 'watch 0x8559ff4' or 'watch *0x8559ff4' -- gdb just
sails by this memory being changed. If I set a conditional break point
just prior to the segmentation fault I can see the change and so can gdb
it just does not sense it with the watch. So, what am I doing wrong and
how do I get gdb to monitor a memory location and halt when it changes?
I have already searched the web (google) and did not find any solutions
there. 

-- 
Al Niessner <Al.Niessner@jpl.nasa.gov>
Jet Propulsion Laboratory

All opinions stated above are mine and do not necessarily reflect those of JPL or NASA.

 ----
| dS | >= 0
 ----

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Setting watchpoints
  2003-04-17 20:10 Setting watchpoints Al Niessner
@ 2003-04-17 20:20 ` Daniel Jacobowitz
  2003-04-17 20:28   ` Al Niessner
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2003-04-17 20:20 UTC (permalink / raw)
  To: Al Niessner; +Cc: gdb

On Thu, Apr 17, 2003 at 01:09:59PM -0700, Al Niessner wrote:
> 
> Platform information:
> OS: Linux
> Kernel: 2.4.19
> gcc/g++: 3.2.2
> gdb: 5.3
> threads: 1 -- single threaded application
> 
> 
> How do I set a watch point so that the debugger halts when memory at a
> specific address is changed? There is no easy to define variable that I
> can latch onto, but I do know its address. When I set a watch point to
> this address -- 'watch 0x8559ff4' or 'watch *0x8559ff4' -- gdb just
> sails by this memory being changed. If I set a conditional break point
> just prior to the segmentation fault I can see the change and so can gdb
> it just does not sense it with the watch. So, what am I doing wrong and
> how do I get gdb to monitor a memory location and halt when it changes?
> I have already searched the web (google) and did not find any solutions
> there. 

Does "watch *(int *) 0x8559ff4" work?  How big is the area you're
watching?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Setting watchpoints
  2003-04-17 20:20 ` Daniel Jacobowitz
@ 2003-04-17 20:28   ` Al Niessner
  0 siblings, 0 replies; 3+ messages in thread
From: Al Niessner @ 2003-04-17 20:28 UTC (permalink / raw)
  To: gdb

I am watching a character pointer. 'watch *0x8559ff4' does not work
because that is the value of the pointer in the structure. Watching the
char** instead of char* works great though. To get the char** I did a
print &(symbol->name). So, gdb works as expected and I make mistakes --
as expected?? Thanks for the help though.

On Thu, 2003-04-17 at 13:20, Daniel Jacobowitz wrote:
> On Thu, Apr 17, 2003 at 01:09:59PM -0700, Al Niessner wrote:
> > 
> > Platform information:
> > OS: Linux
> > Kernel: 2.4.19
> > gcc/g++: 3.2.2
> > gdb: 5.3
> > threads: 1 -- single threaded application
> > 
> > 
> > How do I set a watch point so that the debugger halts when memory at a
> > specific address is changed? There is no easy to define variable that I
> > can latch onto, but I do know its address. When I set a watch point to
> > this address -- 'watch 0x8559ff4' or 'watch *0x8559ff4' -- gdb just
> > sails by this memory being changed. If I set a conditional break point
> > just prior to the segmentation fault I can see the change and so can gdb
> > it just does not sense it with the watch. So, what am I doing wrong and
> > how do I get gdb to monitor a memory location and halt when it changes?
> > I have already searched the web (google) and did not find any solutions
> > there. 
> 
> Does "watch *(int *) 0x8559ff4" work?  How big is the area you're
> watching?
-- 
Al Niessner <Al.Niessner@jpl.nasa.gov>
Jet Propulsion Laboratory

All opinions stated above are mine and do not necessarily reflect those of JPL or NASA.

 ----
| dS | >= 0
 ----

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-04-17 20:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-17 20:10 Setting watchpoints Al Niessner
2003-04-17 20:20 ` Daniel Jacobowitz
2003-04-17 20:28   ` Al Niessner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).