aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2008-12-21 15:01:32 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2008-12-21 15:01:32 +0000
commitdb2ad4c3f7d0c035ad9e38e312d0cf24a906f701 (patch)
treea3804fa9899e7b0d9a4206f9bcd759d135401d5e /gdb/breakpoint.c
parent22e8c8e0c1d95681c1e4b869b1c84a872d5d5077 (diff)
downloadgdb-db2ad4c3f7d0c035ad9e38e312d0cf24a906f701.zip
gdb-db2ad4c3f7d0c035ad9e38e312d0cf24a906f701.tar.gz
gdb-db2ad4c3f7d0c035ad9e38e312d0cf24a906f701.tar.bz2
gdb/
Fix hw watchpoints created before the inferior was started. * breakpoint.c (update_watchpoint): Convert the bp_watchpoint and bp_hardware_watchpoint types according to the current runtime state. gdb/testsuite/ * gdb.base/watchpoint-hw.exp, gdb.base/watchpoint-hw.c: New.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 0322d02..fac96b6 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -891,6 +891,27 @@ update_watchpoint (struct breakpoint *b, int reparse)
b->val_valid = 1;
}
+ /* Change the type of breakpoint between hardware assisted or an
+ ordinary watchpoint depending on the hardware support and free
+ hardware slots. REPARSE is set when the inferior is started. */
+ if ((b->type == bp_watchpoint || b->type == bp_hardware_watchpoint)
+ && reparse)
+ {
+ int i, mem_cnt, target_resources_ok, other_type_used;
+
+ i = hw_watchpoint_used_count (bp_hardware_watchpoint,
+ &other_type_used);
+ mem_cnt = can_use_hardware_watchpoint (val_chain);
+
+ if (mem_cnt)
+ target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT
+ (bp_hardware_watchpoint, i + mem_cnt, other_type_used);
+ if (!mem_cnt || target_resources_ok <= 0)
+ b->type = bp_watchpoint;
+ else
+ b->type = bp_hardware_watchpoint;
+ }
+
/* Look at each value on the value chain. */
for (v = val_chain; v; v = next)
{