Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Orjan Friberg <orjan.friberg@axis.com>
To: gdb-patches@sources.redhat.com
Subject: recurse.exp: watch on local variable that goes out of scope
Date: Tue, 20 Jul 2004 14:37:00 -0000	[thread overview]
Message-ID: <40FD2E1F.7070403@axis.com> (raw)

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


             reply	other threads:[~2004-07-20 14:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-20 14:37 Orjan Friberg [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40FD2E1F.7070403@axis.com \
    --to=orjan.friberg@axis.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox