Add target_ops argument to to_can_use_hw_breakpoint

2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target.h (struct target_ops) <to_can_use_hw_breakpoint>: 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.
This commit is contained in:
Tom Tromey 2013-12-17 21:28:37 -07:00
parent f045800c90
commit 5461485a87
18 changed files with 78 additions and 23 deletions

View File

@ -1,3 +1,37 @@
2014-02-19 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_can_use_hw_breakpoint>: 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 <tromey@redhat.com>
* target.h (struct target_ops) <to_post_attach>: Add argument.

View File

@ -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;
}

View File

@ -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)

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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,

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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",

View File

@ -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) (&current_target, \
TYPE, CNT, OTHERTYPE);
/* Returns the number of debug registers needed to watch the given
memory region, or zero if not supported. */