From: Tom Tromey Date: Wed, 18 Dec 2013 04:28:37 +0000 (-0700) Subject: Add target_ops argument to to_can_use_hw_breakpoint X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=5461485a87289f8e7909ae11f6256934579886dc;hp=f045800c90783c13d6f116d99ca429a9ef556055;p=deliverable%2Fbinutils-gdb.git Add target_ops argument to to_can_use_hw_breakpoint 2014-02-19 Tom Tromey * target.h (struct target_ops) : Add argument. (target_can_use_hardware_watchpoint): Add argument. * target.c (debug_to_can_use_hw_breakpoint): Add argument. (update_current_target): Update. * spu-linux-nat.c (spu_can_use_hw_breakpoint): Add 'self' argument. * s390-linux-nat.c (s390_can_use_hw_breakpoint): Add 'self' argument. * remote.c (remote_check_watch_resources): Add 'self' argument. * remote-mips.c (mips_can_use_watchpoint): Add 'self' argument. * remote-m32r-sdi.c (m32r_can_use_hw_watchpoint): Add 'self' argument. * procfs.c (procfs_can_use_hw_breakpoint): Add 'self' argument. * ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Add 'self' argument. * nto-procfs.c (procfs_can_use_hw_breakpoint): Add 'self' argument. * mips-linux-nat.c (mips_linux_can_use_hw_breakpoint): Add 'self' argument. * inf-ttrace.c (inf_ttrace_can_use_hw_breakpoint): Add 'self' argument. * ia64-linux-nat.c (ia64_linux_can_use_hw_breakpoint): Add 'self' argument. * ia64-hpux-nat.c (ia64_hpux_can_use_hw_breakpoint): Add 'self' argument. * i386-nat.c (i386_can_use_hw_breakpoint): Add 'self' argument. * arm-linux-nat.c (arm_linux_can_use_hw_breakpoint): Add 'self' argument. * aarch64-linux-nat.c (aarch64_linux_can_use_hw_breakpoint): Add 'self' argument. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 96d6e58018..e145c33c72 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,37 @@ +2014-02-19 Tom Tromey + + * target.h (struct target_ops) : Add + argument. + (target_can_use_hardware_watchpoint): Add argument. + * target.c (debug_to_can_use_hw_breakpoint): Add argument. + (update_current_target): Update. + * spu-linux-nat.c (spu_can_use_hw_breakpoint): Add 'self' + argument. + * s390-linux-nat.c (s390_can_use_hw_breakpoint): Add 'self' + argument. + * remote.c (remote_check_watch_resources): Add 'self' argument. + * remote-mips.c (mips_can_use_watchpoint): Add 'self' argument. + * remote-m32r-sdi.c (m32r_can_use_hw_watchpoint): Add 'self' + argument. + * procfs.c (procfs_can_use_hw_breakpoint): Add 'self' argument. + * ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Add 'self' + argument. + * nto-procfs.c (procfs_can_use_hw_breakpoint): Add 'self' + argument. + * mips-linux-nat.c (mips_linux_can_use_hw_breakpoint): Add 'self' + argument. + * inf-ttrace.c (inf_ttrace_can_use_hw_breakpoint): Add 'self' + argument. + * ia64-linux-nat.c (ia64_linux_can_use_hw_breakpoint): Add 'self' + argument. + * ia64-hpux-nat.c (ia64_hpux_can_use_hw_breakpoint): Add 'self' + argument. + * i386-nat.c (i386_can_use_hw_breakpoint): Add 'self' argument. + * arm-linux-nat.c (arm_linux_can_use_hw_breakpoint): Add 'self' + argument. + * aarch64-linux-nat.c (aarch64_linux_can_use_hw_breakpoint): Add + 'self' argument. + 2014-02-19 Tom Tromey * target.h (struct target_ops) : Add argument. diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 703c4ed96e..c9a3b4de09 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -941,7 +941,8 @@ aarch64_align_watchpoint (CORE_ADDR addr, int len, CORE_ADDR *aligned_addr_p, sharing implemented via reference counts. */ static int -aarch64_linux_can_use_hw_breakpoint (int type, int cnt, int othertype) +aarch64_linux_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { return 1; } diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 9fa5f5b166..a1a9cc58fe 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -747,7 +747,8 @@ arm_linux_get_hw_watchpoint_count (void) /* Have we got a free break-/watch-point available for use? Returns -1 if there is not an appropriate resource available, otherwise returns 1. */ static int -arm_linux_can_use_hw_breakpoint (int type, int cnt, int ot) +arm_linux_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int ot) { if (type == bp_hardware_watchpoint || type == bp_read_watchpoint || type == bp_access_watchpoint || type == bp_watchpoint) diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c index 23edc38a40..bae701a662 100644 --- a/gdb/i386-nat.c +++ b/gdb/i386-nat.c @@ -831,7 +831,8 @@ i386_remove_hw_breakpoint (struct gdbarch *gdbarch, sharing implemented via reference counts in i386-nat.c. */ static int -i386_can_use_hw_breakpoint (int type, int cnt, int othertype) +i386_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { return 1; } diff --git a/gdb/ia64-hpux-nat.c b/gdb/ia64-hpux-nat.c index 9e6516ddaf..6a4e088c5f 100644 --- a/gdb/ia64-hpux-nat.c +++ b/gdb/ia64-hpux-nat.c @@ -702,7 +702,8 @@ ia64_hpux_xfer_partial (struct target_ops *ops, enum target_object object, /* The "to_can_use_hw_breakpoint" target_ops routine for ia64-hpux. */ static int -ia64_hpux_can_use_hw_breakpoint (int type, int cnt, int othertype) +ia64_hpux_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { /* No hardware watchpoint/breakpoint support yet. */ return 0; diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c index ea575c8bba..938807f88e 100644 --- a/gdb/ia64-linux-nat.c +++ b/gdb/ia64-linux-nat.c @@ -676,7 +676,8 @@ ia64_linux_stopped_by_watchpoint (struct target_ops *ops) } static int -ia64_linux_can_use_hw_breakpoint (int type, int cnt, int othertype) +ia64_linux_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { return 1; } diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c index e219fb8bdb..28b55eb269 100644 --- a/gdb/inf-ttrace.c +++ b/gdb/inf-ttrace.c @@ -359,7 +359,8 @@ inf_ttrace_remove_watchpoint (CORE_ADDR addr, int len, int type, } static int -inf_ttrace_can_use_hw_breakpoint (int type, int len, int ot) +inf_ttrace_can_use_hw_breakpoint (struct target_ops *self, + int type, int len, int ot) { return (type == bp_hardware_watchpoint); } diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index 98f8d96d66..a92078d2a5 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -512,7 +512,8 @@ mips_show_dr (const char *func, CORE_ADDR addr, handle the specified watch type. */ static int -mips_linux_can_use_hw_breakpoint (int type, int cnt, int ot) +mips_linux_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int ot) { int i; uint32_t wanted_mask, irw_mask; diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 9fab861864..4914336c49 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -67,7 +67,8 @@ static void init_procfs_ops (void); static ptid_t do_attach (ptid_t ptid); -static int procfs_can_use_hw_breakpoint (int, int, int); +static int procfs_can_use_hw_breakpoint (struct target_ops *self, + int, int, int); static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type, struct expression *cond); @@ -1488,7 +1489,8 @@ procfs_hw_watchpoint (int addr, int len, int type) } static int -procfs_can_use_hw_breakpoint (int type, int cnt, int othertype) +procfs_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { return 1; } diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index b38b33ef25..c29efdaa41 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -1444,7 +1444,8 @@ have_ptrace_hwdebug_interface (void) } static int -ppc_linux_can_use_hw_breakpoint (int type, int cnt, int ot) +ppc_linux_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int ot) { int total_hw_wp, total_hw_bp; diff --git a/gdb/procfs.c b/gdb/procfs.c index 9cdbdd53e8..5b54a42fd1 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -140,7 +140,8 @@ static int proc_find_memory_regions (find_memory_region_ftype, void *); static char * procfs_make_note_section (bfd *, int *); -static int procfs_can_use_hw_breakpoint (int, int, int); +static int procfs_can_use_hw_breakpoint (struct target_ops *self, + int, int, int); static void procfs_info_proc (struct target_ops *, char *, enum info_proc_what); @@ -4834,7 +4835,8 @@ procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag, target_can_use_hardware_watchpoint. */ static int -procfs_can_use_hw_breakpoint (int type, int cnt, int othertype) +procfs_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { /* Due to the way that proc_set_watchpoint() is implemented, host and target pointers must be of the same size. If they are not, diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 0bcfb1f69d..4cd12d8689 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -1407,7 +1407,8 @@ m32r_stop (ptid_t ptid) implements the target_can_use_hardware_watchpoint macro. */ static int -m32r_can_use_hw_watchpoint (int type, int cnt, int othertype) +m32r_can_use_hw_watchpoint (struct target_ops *self, + int type, int cnt, int othertype) { return sdi_desc != NULL && cnt < max_access_breaks; } diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 8dde5cc210..2e2116c504 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -2391,7 +2391,8 @@ mips_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, implements the target_can_use_hardware_watchpoint macro. */ static int -mips_can_use_watchpoint (int type, int cnt, int othertype) +mips_can_use_watchpoint (struct target_ops *self, + int type, int cnt, int othertype) { return cnt < MAX_LSI_BREAKPOINTS && strcmp (target_shortname, "lsi") == 0; } diff --git a/gdb/remote.c b/gdb/remote.c index fb90c5591a..0677fa4c95 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8270,7 +8270,8 @@ remote_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) } static int -remote_check_watch_resources (int type, int cnt, int ot) +remote_check_watch_resources (struct target_ops *self, + int type, int cnt, int ot) { if (type == bp_hardware_breakpoint) { diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c index 8cc9060bae..ae00a513f7 100644 --- a/gdb/s390-linux-nat.c +++ b/gdb/s390-linux-nat.c @@ -557,7 +557,8 @@ s390_remove_watchpoint (CORE_ADDR addr, int len, int type, } static int -s390_can_use_hw_breakpoint (int type, int cnt, int othertype) +s390_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { return type == bp_hardware_watchpoint; } diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c index 71c1643c55..d80b78c36e 100644 --- a/gdb/spu-linux-nat.c +++ b/gdb/spu-linux-nat.c @@ -624,7 +624,8 @@ spu_xfer_partial (struct target_ops *ops, /* Override the to_can_use_hw_breakpoint routine. */ static int -spu_can_use_hw_breakpoint (int type, int cnt, int othertype) +spu_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int othertype) { return 0; } diff --git a/gdb/target.c b/gdb/target.c index 73531e1e89..53f3783339 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -100,7 +100,8 @@ static int debug_to_insert_breakpoint (struct target_ops *, struct gdbarch *, static int debug_to_remove_breakpoint (struct target_ops *, struct gdbarch *, struct bp_target_info *); -static int debug_to_can_use_hw_breakpoint (int, int, int); +static int debug_to_can_use_hw_breakpoint (struct target_ops *self, + int, int, int); static int debug_to_insert_hw_breakpoint (struct gdbarch *, struct bp_target_info *); @@ -734,7 +735,7 @@ update_current_target (void) (void (*) (struct target_ops *)) target_ignore); de_fault (to_can_use_hw_breakpoint, - (int (*) (int, int, int)) + (int (*) (struct target_ops *, int, int, int)) return_zero); de_fault (to_insert_hw_breakpoint, (int (*) (struct gdbarch *, struct bp_target_info *)) @@ -4620,11 +4621,13 @@ debug_to_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, } static int -debug_to_can_use_hw_breakpoint (int type, int cnt, int from_tty) +debug_to_can_use_hw_breakpoint (struct target_ops *self, + int type, int cnt, int from_tty) { int retval; - retval = debug_target.to_can_use_hw_breakpoint (type, cnt, from_tty); + retval = debug_target.to_can_use_hw_breakpoint (&debug_target, + type, cnt, from_tty); fprintf_unfiltered (gdb_stdlog, "target_can_use_hw_breakpoint (%ld, %ld, %ld) = %ld\n", diff --git a/gdb/target.h b/gdb/target.h index 1e8d6122d0..e2002861fc 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -450,7 +450,7 @@ struct target_ops int (*to_remove_breakpoint) (struct target_ops *, struct gdbarch *, struct bp_target_info *) TARGET_DEFAULT_FUNC (memory_remove_breakpoint); - int (*to_can_use_hw_breakpoint) (int, int, int); + 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_remove_hw_breakpoint) (struct gdbarch *, struct bp_target_info *); @@ -1595,7 +1595,8 @@ extern char *target_thread_name (struct thread_info *); (including this one?). OTHERTYPE is who knows what... */ #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \ - (*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE); + (*current_target.to_can_use_hw_breakpoint) (¤t_target, \ + TYPE, CNT, OTHERTYPE); /* Returns the number of debug registers needed to watch the given memory region, or zero if not supported. */