target, breakpoint: allow insert/remove breakpoint to be forwarded

2014-01-16  Markus Metzger  <markus.t.metzger@intel.com>

	* target.h (target_ops) <to_insert_breakpoint>
	<to_remove_breakpoint>: Add target_ops parameter.
	(forward_target_insert_breakpoint): New.
	(forward_target_remove_breakpoint): New.
	(memory_remove_breakpoint, memory_insert_breakpoint):
	Add target_ops parameter.
	* target.c (target_insert_breakpoint): Split into this and ...
	(forward_target_insert_breakpoint): ... this.
	(target_remove_breakpoint): Split into this and ...
	(forward_target_remove_breakpoint): ... this.
	(debug_to_insert_breakpoint): Add target_ops parameter.
	Call forward_target_insert_breakpoint.
	(debug_to_remove_breakpoint): Add target_ops parameter.
	Call forward_target_remove_breakpoint.
	(update_current_target): Do not inherit or default to_insert_breakpoint
	and to_remove_breakpoint.
	* corelow.c (ignore): Add target_ops parameter.
	* exec.c (ignore): Add target_ops parameter.
	* mem-break.c (memory_insert_breakpoint, memory_remove_breakpoint):
	Add target_ops parameter.
	* monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint):
	Add target_ops parameter.
	* nto-procfs.c (procfs_insert_breakpoint, procfs_remove_breakpoint):
	Add target_ops parameter.
	* record-full.c (record_full_beneath_to_insert_breakpoint)
	(record_full_beneath_to_remove_breakpoint, tmp_to_insert_breakpoint)
	(tmp_to_remove_breakpoint, record_full_insert_breakpoint)
	(record_full_remove_breakpoint, record_full_core_insert_breakpoint)
	(record_full_core_remove_breakpoint): Add target_ops parameter.
	Update users.
	(record_full_beneath_to_insert_breakpoint_ops)
	(record_full_beneath_to_remove_breakpoint_ops)
	(tmp_to_insert_breakpoint_ops, tmp_to_remove_breakpoint_ops): New.
	(record_full_open): Initialize tmp_to_insert_breakpoint_ops,
	tmp_to_remove_breakpoint_ops,
	record_full_beneath_to_insert_breakpoint_ops, and
	record_full_beneath_to_remove_breakpoint_ops.
	* remote-m32r-sdi.c (m32r_insert_breakpoint)
	(m32r_remove_breakpoint): Add target_ops parameter.
	* remote-mips.c (mips_insert_breakpoint, mips_remove_breakpoint):
	Add target_ops parameter.
	* remote.c (remote_insert_breakpoint, remote_remove_breakpoint):
	Add target_ops parameter.
This commit is contained in:
Markus Metzger
2013-12-17 10:49:03 +01:00
parent cecac1aba0
commit 3db08215d4
12 changed files with 173 additions and 50 deletions

View File

@@ -243,11 +243,15 @@ static void (*record_full_beneath_to_store_registers) (struct target_ops *,
static struct target_ops *record_full_beneath_to_xfer_partial_ops;
static target_xfer_partial_ftype *record_full_beneath_to_xfer_partial;
static int
(*record_full_beneath_to_insert_breakpoint) (struct gdbarch *,
(*record_full_beneath_to_insert_breakpoint) (struct target_ops *,
struct gdbarch *,
struct bp_target_info *);
static struct target_ops *record_full_beneath_to_insert_breakpoint_ops;
static int
(*record_full_beneath_to_remove_breakpoint) (struct gdbarch *,
(*record_full_beneath_to_remove_breakpoint) (struct target_ops *,
struct gdbarch *,
struct bp_target_info *);
static struct target_ops *record_full_beneath_to_remove_breakpoint_ops;
static int (*record_full_beneath_to_stopped_by_watchpoint) (void);
static int (*record_full_beneath_to_stopped_data_address) (struct target_ops *,
CORE_ADDR *);
@@ -814,10 +818,12 @@ static void (*tmp_to_store_registers) (struct target_ops *,
int regno);
static struct target_ops *tmp_to_xfer_partial_ops;
static target_xfer_partial_ftype *tmp_to_xfer_partial;
static int (*tmp_to_insert_breakpoint) (struct gdbarch *,
static int (*tmp_to_insert_breakpoint) (struct target_ops *, struct gdbarch *,
struct bp_target_info *);
static int (*tmp_to_remove_breakpoint) (struct gdbarch *,
static struct target_ops *tmp_to_insert_breakpoint_ops;
static int (*tmp_to_remove_breakpoint) (struct target_ops *, struct gdbarch *,
struct bp_target_info *);
static struct target_ops *tmp_to_remove_breakpoint_ops;
static int (*tmp_to_stopped_by_watchpoint) (void);
static int (*tmp_to_stopped_data_address) (struct target_ops *, CORE_ADDR *);
static int (*tmp_to_stopped_data_address) (struct target_ops *, CORE_ADDR *);
@@ -936,6 +942,8 @@ record_full_open (char *name, int from_tty)
tmp_to_stopped_by_watchpoint = NULL;
tmp_to_stopped_data_address = NULL;
tmp_to_async = NULL;
tmp_to_insert_breakpoint_ops = NULL;
tmp_to_remove_breakpoint_ops = NULL;
/* Set the beneath function pointers. */
for (t = current_target.beneath; t != NULL; t = t->beneath)
@@ -961,9 +969,15 @@ record_full_open (char *name, int from_tty)
tmp_to_xfer_partial_ops = t;
}
if (!tmp_to_insert_breakpoint)
tmp_to_insert_breakpoint = t->to_insert_breakpoint;
{
tmp_to_insert_breakpoint = t->to_insert_breakpoint;
tmp_to_insert_breakpoint_ops = t;
}
if (!tmp_to_remove_breakpoint)
tmp_to_remove_breakpoint = t->to_remove_breakpoint;
{
tmp_to_remove_breakpoint = t->to_remove_breakpoint;
tmp_to_remove_breakpoint_ops = t;
}
if (!tmp_to_stopped_by_watchpoint)
tmp_to_stopped_by_watchpoint = t->to_stopped_by_watchpoint;
if (!tmp_to_stopped_data_address)
@@ -990,7 +1004,9 @@ record_full_open (char *name, int from_tty)
record_full_beneath_to_xfer_partial_ops = tmp_to_xfer_partial_ops;
record_full_beneath_to_xfer_partial = tmp_to_xfer_partial;
record_full_beneath_to_insert_breakpoint = tmp_to_insert_breakpoint;
record_full_beneath_to_insert_breakpoint_ops = tmp_to_insert_breakpoint_ops;
record_full_beneath_to_remove_breakpoint = tmp_to_remove_breakpoint;
record_full_beneath_to_remove_breakpoint_ops = tmp_to_remove_breakpoint_ops;
record_full_beneath_to_stopped_by_watchpoint = tmp_to_stopped_by_watchpoint;
record_full_beneath_to_stopped_data_address = tmp_to_stopped_data_address;
record_full_beneath_to_async = tmp_to_async;
@@ -1755,7 +1771,8 @@ record_full_init_record_breakpoints (void)
when recording. */
static int
record_full_insert_breakpoint (struct gdbarch *gdbarch,
record_full_insert_breakpoint (struct target_ops *ops,
struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
struct record_full_breakpoint *bp;
@@ -1772,7 +1789,9 @@ record_full_insert_breakpoint (struct gdbarch *gdbarch,
int ret;
old_cleanups = record_full_gdb_operation_disable_set ();
ret = record_full_beneath_to_insert_breakpoint (gdbarch, bp_tgt);
ops = record_full_beneath_to_insert_breakpoint_ops;
ret = record_full_beneath_to_insert_breakpoint (ops, gdbarch,
bp_tgt);
do_cleanups (old_cleanups);
if (ret != 0)
@@ -1792,7 +1811,8 @@ record_full_insert_breakpoint (struct gdbarch *gdbarch,
/* "to_remove_breakpoint" method for process record target. */
static int
record_full_remove_breakpoint (struct gdbarch *gdbarch,
record_full_remove_breakpoint (struct target_ops *ops,
struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
struct record_full_breakpoint *bp;
@@ -1812,7 +1832,9 @@ record_full_remove_breakpoint (struct gdbarch *gdbarch,
int ret;
old_cleanups = record_full_gdb_operation_disable_set ();
ret = record_full_beneath_to_remove_breakpoint (gdbarch, bp_tgt);
ops = record_full_beneath_to_remove_breakpoint_ops;
ret = record_full_beneath_to_remove_breakpoint (ops, gdbarch,
bp_tgt);
do_cleanups (old_cleanups);
if (ret != 0)
@@ -2262,7 +2284,8 @@ record_full_core_xfer_partial (struct target_ops *ops,
/* "to_insert_breakpoint" method for prec over corefile. */
static int
record_full_core_insert_breakpoint (struct gdbarch *gdbarch,
record_full_core_insert_breakpoint (struct target_ops *ops,
struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
return 0;
@@ -2271,7 +2294,8 @@ record_full_core_insert_breakpoint (struct gdbarch *gdbarch,
/* "to_remove_breakpoint" method for prec over corefile. */
static int
record_full_core_remove_breakpoint (struct gdbarch *gdbarch,
record_full_core_remove_breakpoint (struct target_ops *ops,
struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
return 0;