aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@broadcom.com>2013-10-18 16:25:14 +0000
committerAndrew Burgess <aburgess@broadcom.com>2013-10-18 16:25:14 +0000
commite8369a73b982f60326e89c38bd1a7e6bb7363beb (patch)
tree82dbafc553a62757810f5bf180f32ffd4f24cc95 /gdb/breakpoint.c
parent776f04fafe124218f3602c2d9c598662c0f17aa9 (diff)
downloadgdb-e8369a73b982f60326e89c38bd1a7e6bb7363beb.zip
gdb-e8369a73b982f60326e89c38bd1a7e6bb7363beb.tar.gz
gdb-e8369a73b982f60326e89c38bd1a7e6bb7363beb.tar.bz2
Hardware watchpoints turned off, inferior not yet started.
https://sourceware.org/ml/gdb-patches/2013-10/msg00477.html gdb/ChangeLog * breakpoint.c (update_watchpoint): If hardware watchpoints are forced off, downgrade them to software watchpoints if possible, and error out if not possible. (watch_command_1): Move watchpoint type selection closer to watchpoint creation, and extend the comments. gdb/testsuite/ChangeLog * gdb.base/watchpoints.exp: Add test for setting software watchpoints of different types before starting the inferior.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 5ce50de..c630b87 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1795,11 +1795,18 @@ update_watchpoint (struct watchpoint *b, int reparse)
don't try to insert watchpoint. We don't automatically delete
such watchpoint, though, since failure to parse expression
is different from out-of-scope watchpoint. */
- if ( !target_has_execution)
+ if (!target_has_execution)
{
/* Without execution, memory can't change. No use to try and
set watchpoint locations. The watchpoint will be reset when
the target gains execution, through breakpoint_re_set. */
+ if (!can_use_hw_watchpoints)
+ {
+ if (b->base.ops->works_in_software_mode (&b->base))
+ b->base.type = bp_watchpoint;
+ else
+ error (_("Software read/access watchpoints not supported."));
+ }
}
else if (within_current_scope && b->exp)
{
@@ -11081,13 +11088,6 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
if (*tok)
error (_("Junk at end of command."));
- if (accessflag == hw_read)
- bp_type = bp_read_watchpoint;
- else if (accessflag == hw_access)
- bp_type = bp_access_watchpoint;
- else
- bp_type = bp_hardware_watchpoint;
-
frame = block_innermost_frame (exp_valid_block);
/* If the expression is "local", then set up a "watchpoint scope"
@@ -11124,7 +11124,17 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
}
}
- /* Now set up the breakpoint. */
+ /* Now set up the breakpoint. We create all watchpoints as hardware
+ watchpoints here even if hardware watchpoints are turned off, a call
+ to update_watchpoint later in this function will cause the type to
+ drop back to bp_watchpoint (software watchpoint) if required. */
+
+ if (accessflag == hw_read)
+ bp_type = bp_read_watchpoint;
+ else if (accessflag == hw_access)
+ bp_type = bp_access_watchpoint;
+ else
+ bp_type = bp_hardware_watchpoint;
w = XCNEW (struct watchpoint);
b = &w->base;