Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* recurse.exp: watch on local variable that goes out of scope
@ 2004-07-20 14:37 Orjan Friberg
  2004-07-20 19:37 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Orjan Friberg @ 2004-07-20 14:37 UTC (permalink / raw)
  To: gdb-patches

I'm having problems with recurse.exp on CRISv32 with hardware watchpoint support 
- a local variable which goes out of scope isn't handled the same way as on the 
i386 ("second instance watchpoint deleted when leaving scope").  On the i386 
i386_stopped_data_address returns a proper address when I don't expect it to.

Here's a recap of what I think I've understood: in order to detect when a 
watched local variable goes out of scope, gdb inserts a breakpoint on the 
instruction where the function that the variable belongs to returns to.  In this 
case it shows up as ("maint info break"; local variable "b" is watched in 
recurse (a=5)):

4   hw watchpoint  keep y              b
         breakpoint already hit 2 times
-56 watchpoint scope del  y   0x08048403 <recurse+51>
         stop only in stack frame at 0xbffff4c4
         breakpoint already hit 4 times

When stopped at the return statement of recurse (a=5), a continue is issued, 
making recurse (a=5) return and the "watchpoint scope del" breakpoint is then 
hit (the bp_addr argument to bpstat_stop_status == 0x08048403).

Now for the confusing part: bpstat_stop_status is called with 
stopped_by_watchpoint == 1.  This is because, at this point, 
i386_stopped_data_address returns the address of the local variable "b" (the 
address it had in recurse (a=5)), as if it were stopped due to a watchpoint hit. 
  I would have expected i386_stopped_data_address to return 0 at this point, 
since it didn't stop due to a watchpoint hit.  What am I missing here?  Does 
i386_stopped_data_address retain the stopped data address from the previous hit?

Thanks in advance.

-- 
Orjan Friberg
Axis Communications


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

end of thread, other threads:[~2004-07-28 15:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-20 14:37 recurse.exp: watch on local variable that goes out of scope Orjan Friberg
2004-07-20 19:37 ` Eli Zaretskii
2004-07-22  9:44   ` Orjan Friberg
2004-07-22 19:19     ` Eli Zaretskii
2004-07-23  9:23       ` Orjan Friberg
2004-07-28 15:52         ` Orjan Friberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox