aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2014-06-19 10:50:20 +0100
committerGary Benson <gbenson@redhat.com>2014-06-19 10:55:12 +0100
commit322a8e06b9675df9dfaaae956538b6cc8a695d4a (patch)
tree718a0219e3d8cad17057d9ea3d17ce2a62617a76 /gdb
parent8f26655c9e3a038159ce4e6f4ad027fd40a99333 (diff)
downloadgdb-322a8e06b9675df9dfaaae956538b6cc8a695d4a.zip
gdb-322a8e06b9675df9dfaaae956538b6cc8a695d4a.tar.gz
gdb-322a8e06b9675df9dfaaae956538b6cc8a695d4a.tar.bz2
Refactor i386_{insert,remove}_hw_breakpoint
This commit refactors i386_{insert,remove}_hw_breakpoint to call i386_{insert,remove}_watchpoint rather than duplicating functionality. gdb/ 2014-06-19 Gary Benson <gbenson@redhat.com> * i386-nat.c (i386_insert_hw_breakpoint): Use i386_insert_watchpoint. (i386_remove_hw_breakpoint): Use i386_remove_watchpoint.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/i386-nat.c39
2 files changed, 11 insertions, 34 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index bd3ccae..0ffb849 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2014-06-19 Gary Benson <gbenson@redhat.com>
+ * i386-nat.c (i386_insert_hw_breakpoint): Use
+ i386_insert_watchpoint.
+ (i386_remove_hw_breakpoint): Use i386_remove_watchpoint.
+
+2014-06-19 Gary Benson <gbenson@redhat.com>
+
* i386-nat.c (i386_dr_show): Renamed to
i386_show_dr and made static. All uses updated.
(i386_dr_length_and_rw_bits): Renamed to
diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c
index 3ff0711..c956583 100644
--- a/gdb/i386-nat.c
+++ b/gdb/i386-nat.c
@@ -738,27 +738,13 @@ i386_stopped_by_watchpoint (struct target_ops *ops)
/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
Return 0 on success, EBUSY on failure. */
+
static int
i386_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- struct i386_debug_reg_state *state
- = i386_debug_reg_state (ptid_get_pid (inferior_ptid));
- unsigned len_rw = i386_length_and_rw_bits (1, hw_execute);
- CORE_ADDR addr = bp_tgt->placed_address;
- /* Work on a local copy of the debug registers, and on success,
- commit the change back to the inferior. */
- struct i386_debug_reg_state local_state = *state;
- int retval = i386_insert_aligned_watchpoint (&local_state,
- addr, len_rw) ? EBUSY : 0;
-
- if (retval == 0)
- i386_update_inferior_debug_regs (state, &local_state);
-
- if (debug_hw_points)
- i386_show_dr (state, "insert_hwbp", addr, 1, hw_execute);
-
- return retval;
+ return i386_insert_watchpoint (self, bp_tgt->placed_address, 1,
+ hw_execute, NULL) ? EBUSY : 0;
}
/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address.
@@ -768,23 +754,8 @@ static int
i386_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- struct i386_debug_reg_state *state
- = i386_debug_reg_state (ptid_get_pid (inferior_ptid));
- unsigned len_rw = i386_length_and_rw_bits (1, hw_execute);
- CORE_ADDR addr = bp_tgt->placed_address;
- /* Work on a local copy of the debug registers, and on success,
- commit the change back to the inferior. */
- struct i386_debug_reg_state local_state = *state;
- int retval = i386_remove_aligned_watchpoint (&local_state,
- addr, len_rw);
-
- if (retval == 0)
- i386_update_inferior_debug_regs (state, &local_state);
-
- if (debug_hw_points)
- i386_show_dr (state, "remove_hwbp", addr, 1, hw_execute);
-
- return retval;
+ return i386_remove_watchpoint (self, bp_tgt->placed_address, 1,
+ hw_execute, NULL);
}
/* Returns the number of hardware watchpoints of type TYPE that we can