From 23a267714b1051ebbd5a9033a5e0e53c26083a64 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 17 Dec 2013 21:28:50 -0700 Subject: [PATCH] Add target_ops argument to to_insert_hw_breakpoint 2014-02-19 Tom Tromey * target.h (struct target_ops) : Add argument. (target_insert_hw_breakpoint): Add argument. * target.c (debug_to_insert_hw_breakpoint): Add argument. (update_current_target): Update. * remote.c (remote_insert_hw_breakpoint): Add 'self' argument. * ppc-linux-nat.c (ppc_linux_insert_hw_breakpoint): Add 'self' argument. * nto-procfs.c (procfs_insert_hw_breakpoint): Add 'self' argument. * i386-nat.c (i386_insert_hw_breakpoint): Add 'self' argument. * arm-linux-nat.c (arm_linux_insert_hw_breakpoint): Add 'self' argument. * aarch64-linux-nat.c (aarch64_linux_insert_hw_breakpoint): Add 'self' argument. --- gdb/ChangeLog | 17 +++++++++++++++++ gdb/aarch64-linux-nat.c | 3 ++- gdb/arm-linux-nat.c | 3 ++- gdb/i386-nat.c | 2 +- gdb/nto-procfs.c | 2 +- gdb/ppc-linux-nat.c | 3 ++- gdb/remote.c | 2 +- gdb/target.c | 12 ++++++++---- gdb/target.h | 6 ++++-- 9 files changed, 38 insertions(+), 12 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e145c33c721..db4e949bf17 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +2014-02-19 Tom Tromey + + * target.h (struct target_ops) : Add + argument. + (target_insert_hw_breakpoint): Add argument. + * target.c (debug_to_insert_hw_breakpoint): Add argument. + (update_current_target): Update. + * remote.c (remote_insert_hw_breakpoint): Add 'self' argument. + * ppc-linux-nat.c (ppc_linux_insert_hw_breakpoint): Add 'self' + argument. + * nto-procfs.c (procfs_insert_hw_breakpoint): Add 'self' argument. + * i386-nat.c (i386_insert_hw_breakpoint): Add 'self' argument. + * arm-linux-nat.c (arm_linux_insert_hw_breakpoint): Add 'self' + argument. + * aarch64-linux-nat.c (aarch64_linux_insert_hw_breakpoint): Add + 'self' argument. + 2014-02-19 Tom Tromey * target.h (struct target_ops) : Add diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index c9a3b4de09d..9a4aba969a6 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -1202,7 +1202,8 @@ aarch64_handle_breakpoint (int type, CORE_ADDR addr, int len, int is_insert) Return 0 on success, -1 on failure. */ static int -aarch64_linux_insert_hw_breakpoint (struct gdbarch *gdbarch, +aarch64_linux_insert_hw_breakpoint (struct target_ops *self, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { int ret; diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index a1a9cc58fe4..00b22cc5442 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -1037,7 +1037,8 @@ arm_linux_remove_hw_breakpoint1 (const struct arm_linux_hw_breakpoint *bpt, /* Insert a Hardware breakpoint. */ static int -arm_linux_insert_hw_breakpoint (struct gdbarch *gdbarch, +arm_linux_insert_hw_breakpoint (struct target_ops *self, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { struct lwp_info *lp; diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c index bae701a6627..21ef95ce2c8 100644 --- a/gdb/i386-nat.c +++ b/gdb/i386-nat.c @@ -765,7 +765,7 @@ 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 gdbarch *gdbarch, +i386_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { struct i386_debug_reg_state *state diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 4914336c49c..71c0526e8d0 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -937,7 +937,7 @@ procfs_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, } static int -procfs_insert_hw_breakpoint (struct gdbarch *gdbarch, +procfs_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { return procfs_breakpoint (bp_tgt->placed_address, diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index c29efdaa413..6213b746e68 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -1673,7 +1673,8 @@ ppc_linux_ranged_break_num_registers (struct target_ops *target) success, 1 if hardware breakpoints are not supported or -1 for failure. */ static int -ppc_linux_insert_hw_breakpoint (struct gdbarch *gdbarch, +ppc_linux_insert_hw_breakpoint (struct target_ops *self, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { struct lwp_info *lp; diff --git a/gdb/remote.c b/gdb/remote.c index 0677fa4c95b..8581d26fced 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8321,7 +8321,7 @@ remote_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p) static int -remote_insert_hw_breakpoint (struct gdbarch *gdbarch, +remote_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { CORE_ADDR addr; diff --git a/gdb/target.c b/gdb/target.c index 53f3783339d..08866b9d79d 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -103,7 +103,8 @@ static int debug_to_remove_breakpoint (struct target_ops *, struct gdbarch *, static int debug_to_can_use_hw_breakpoint (struct target_ops *self, int, int, int); -static int debug_to_insert_hw_breakpoint (struct gdbarch *, +static int debug_to_insert_hw_breakpoint (struct target_ops *self, + struct gdbarch *, struct bp_target_info *); static int debug_to_remove_hw_breakpoint (struct gdbarch *, @@ -738,7 +739,8 @@ update_current_target (void) (int (*) (struct target_ops *, int, int, int)) return_zero); de_fault (to_insert_hw_breakpoint, - (int (*) (struct gdbarch *, struct bp_target_info *)) + (int (*) (struct target_ops *, struct gdbarch *, + struct bp_target_info *)) return_minus_one); de_fault (to_remove_hw_breakpoint, (int (*) (struct gdbarch *, struct bp_target_info *)) @@ -4714,12 +4716,14 @@ debug_to_watchpoint_addr_within_range (struct target_ops *target, } static int -debug_to_insert_hw_breakpoint (struct gdbarch *gdbarch, +debug_to_insert_hw_breakpoint (struct target_ops *self, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { int retval; - retval = debug_target.to_insert_hw_breakpoint (gdbarch, bp_tgt); + retval = debug_target.to_insert_hw_breakpoint (&debug_target, + gdbarch, bp_tgt); fprintf_unfiltered (gdb_stdlog, "target_insert_hw_breakpoint (%s, xxx) = %ld\n", diff --git a/gdb/target.h b/gdb/target.h index e2002861fc4..6fc7294b0e4 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -452,7 +452,8 @@ struct target_ops TARGET_DEFAULT_FUNC (memory_remove_breakpoint); int (*to_can_use_hw_breakpoint) (struct target_ops *, int, int, int); int (*to_ranged_break_num_registers) (struct target_ops *); - int (*to_insert_hw_breakpoint) (struct gdbarch *, struct bp_target_info *); + int (*to_insert_hw_breakpoint) (struct target_ops *, + struct gdbarch *, struct bp_target_info *); int (*to_remove_hw_breakpoint) (struct gdbarch *, struct bp_target_info *); /* Documentation of what the two routines below are expected to do is @@ -1637,7 +1638,8 @@ extern int target_remove_mask_watchpoint (CORE_ADDR, CORE_ADDR, int); message) otherwise. */ #define target_insert_hw_breakpoint(gdbarch, bp_tgt) \ - (*current_target.to_insert_hw_breakpoint) (gdbarch, bp_tgt) + (*current_target.to_insert_hw_breakpoint) (¤t_target, \ + gdbarch, bp_tgt) #define target_remove_hw_breakpoint(gdbarch, bp_tgt) \ (*current_target.to_remove_hw_breakpoint) (gdbarch, bp_tgt) -- 2.30.2