aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2010-03-04 15:37:26 +0000
committerPedro Alves <palves@redhat.com>2010-03-04 15:37:26 +0000
commitc7437ca6e4ecefbaa0a0ebef0e68f09f8f19c449 (patch)
tree5d9969e4bbb8254fdf79911c4e5f1009a76a5880 /gdb/breakpoint.c
parent58dadb1bdf0ace689fd17cab2676338fe32b44c0 (diff)
downloadgdb-c7437ca6e4ecefbaa0a0ebef0e68f09f8f19c449.zip
gdb-c7437ca6e4ecefbaa0a0ebef0e68f09f8f19c449.tar.gz
gdb-c7437ca6e4ecefbaa0a0ebef0e68f09f8f19c449.tar.bz2
gdb/
* breakpoint.c (update_watchpoint): Create a sentinel location if the software watchpoint isn't watching any memory. (breakpoint_address_bits): Skip dummy software watchpoint locations. gdb/testsuite/ * gdb.base/watch-non-mem.c, gdb.base/watch-non-mem.exp: New.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index bd3330f..03db241 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1237,6 +1237,19 @@ update_watchpoint (struct breakpoint *b, int reparse)
value_free (v);
}
+ /* If a software watchpoint is not watching any memory, then the
+ above left it without any location set up. But,
+ bpstat_stop_status requires a location to be able to report
+ stops, so make sure there's at least a dummy one. */
+ if (b->type == bp_watchpoint && b->loc == NULL)
+ {
+ b->loc = allocate_bp_location (b);
+ b->loc->pspace = frame_pspace;
+ b->loc->address = -1;
+ b->loc->length = -1;
+ b->loc->watchpoint_type = -1;
+ }
+
/* We just regenerated the list of breakpoint locations.
The new location does not have its condition field set to anything
and therefore, we must always reparse the cond_string, independently
@@ -4516,7 +4529,14 @@ breakpoint_address_bits (struct breakpoint *b)
for (loc = b->loc; loc; loc = loc->next)
{
- int addr_bit = gdbarch_addr_bit (loc->gdbarch);
+ int addr_bit;
+
+ /* Software watchpoints that aren't watching memory don't have
+ an address to print. */
+ if (b->type == bp_watchpoint && loc->watchpoint_type == -1)
+ continue;
+
+ addr_bit = gdbarch_addr_bit (loc->gdbarch);
if (addr_bit > print_address_bits)
print_address_bits = addr_bit;
}