From 3db08215d47b576303a8cbaf6195b5f4a3bb9a13 Mon Sep 17 00:00:00 2001 From: Markus Metzger Date: Tue, 17 Dec 2013 10:49:03 +0100 Subject: [PATCH] target, breakpoint: allow insert/remove breakpoint to be forwarded 2014-01-16 Markus Metzger * target.h (target_ops) : 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. --- gdb/ChangeLog | 46 +++++++++++++++++++++++++++++++++ gdb/corelow.c | 3 ++- gdb/exec.c | 3 ++- gdb/mem-break.c | 4 +-- gdb/monitor.c | 4 +-- gdb/nto-procfs.c | 4 +-- gdb/record-full.c | 48 +++++++++++++++++++++++++--------- gdb/remote-m32r-sdi.c | 6 +++-- gdb/remote-mips.c | 8 +++--- gdb/remote.c | 10 +++++--- gdb/target.c | 60 +++++++++++++++++++++++++++++++------------ gdb/target.h | 27 ++++++++++++++++--- 12 files changed, 173 insertions(+), 50 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 41bf49bca8..b4dd9c6732 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,49 @@ +2014-01-16 Markus Metzger + + * target.h (target_ops) + : 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. + 2014-01-16 Jan Kratochvil Markus Metzger diff --git a/gdb/corelow.c b/gdb/corelow.c index 6f59d31459..d4c1c16c25 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -842,7 +842,8 @@ core_xfer_partial (struct target_ops *ops, enum target_object object, breakpoint_init_inferior). */ static int -ignore (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) +ignore (struct target_ops *ops, struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { return 0; } diff --git a/gdb/exec.c b/gdb/exec.c index 809a0b2f8f..b5aa7f288c 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -801,7 +801,8 @@ exec_set_section_address (const char *filename, int index, CORE_ADDR address) breakpoint_init_inferior). */ static int -ignore (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) +ignore (struct target_ops *ops, struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { return 0; } diff --git a/gdb/mem-break.c b/gdb/mem-break.c index c206687a92..1a057df8a7 100644 --- a/gdb/mem-break.c +++ b/gdb/mem-break.c @@ -77,14 +77,14 @@ default_memory_remove_breakpoint (struct gdbarch *gdbarch, int -memory_insert_breakpoint (struct gdbarch *gdbarch, +memory_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { return gdbarch_memory_insert_breakpoint (gdbarch, bp_tgt); } int -memory_remove_breakpoint (struct gdbarch *gdbarch, +memory_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { return gdbarch_memory_remove_breakpoint (gdbarch, bp_tgt); diff --git a/gdb/monitor.c b/gdb/monitor.c index 2156f7ce80..29c3f71922 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -2095,7 +2095,7 @@ monitor_mourn_inferior (struct target_ops *ops) /* Tell the monitor to add a breakpoint. */ static int -monitor_insert_breakpoint (struct gdbarch *gdbarch, +monitor_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { CORE_ADDR addr = bp_tgt->placed_address; @@ -2132,7 +2132,7 @@ monitor_insert_breakpoint (struct gdbarch *gdbarch, /* Tell the monitor to remove a breakpoint. */ static int -monitor_remove_breakpoint (struct gdbarch *gdbarch, +monitor_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { CORE_ADDR addr = bp_tgt->placed_address; diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index c2d0d30f24..4669345cb3 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -922,14 +922,14 @@ procfs_breakpoint (CORE_ADDR addr, int type, int size) } static int -procfs_insert_breakpoint (struct gdbarch *gdbarch, +procfs_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { return procfs_breakpoint (bp_tgt->placed_address, _DEBUG_BREAK_EXEC, 0); } static int -procfs_remove_breakpoint (struct gdbarch *gdbarch, +procfs_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { return procfs_breakpoint (bp_tgt->placed_address, _DEBUG_BREAK_EXEC, -1); diff --git a/gdb/record-full.c b/gdb/record-full.c index 41b8a54c03..a44af1014c 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -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; diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 9364b5f2d4..d722876714 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -1144,7 +1144,8 @@ m32r_mourn_inferior (struct target_ops *ops) } static int -m32r_insert_breakpoint (struct gdbarch *gdbarch, +m32r_insert_breakpoint (struct target_ops *ops, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { CORE_ADDR addr = bp_tgt->placed_address; @@ -1188,7 +1189,8 @@ m32r_insert_breakpoint (struct gdbarch *gdbarch, } static int -m32r_remove_breakpoint (struct gdbarch *gdbarch, +m32r_remove_breakpoint (struct target_ops *ops, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { CORE_ADDR addr = bp_tgt->placed_address; diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index adf2643990..6e7d9560fb 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -2363,27 +2363,27 @@ mips_mourn_inferior (struct target_ops *ops) target contents. */ static int -mips_insert_breakpoint (struct gdbarch *gdbarch, +mips_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { if (monitor_supports_breakpoints) return mips_set_breakpoint (bp_tgt->placed_address, MIPS_INSN32_SIZE, BREAK_FETCH); else - return memory_insert_breakpoint (gdbarch, bp_tgt); + return memory_insert_breakpoint (ops, gdbarch, bp_tgt); } /* Remove a breakpoint. */ static int -mips_remove_breakpoint (struct gdbarch *gdbarch, +mips_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { if (monitor_supports_breakpoints) return mips_clear_breakpoint (bp_tgt->placed_address, MIPS_INSN32_SIZE, BREAK_FETCH); else - return memory_remove_breakpoint (gdbarch, bp_tgt); + return memory_remove_breakpoint (ops, gdbarch, bp_tgt); } /* Tell whether this target can support a hardware breakpoint. CNT diff --git a/gdb/remote.c b/gdb/remote.c index 2c0f3ba21e..10aab66767 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8258,7 +8258,8 @@ remote_add_target_side_commands (struct gdbarch *gdbarch, which don't, we insert a traditional memory breakpoint. */ static int -remote_insert_breakpoint (struct gdbarch *gdbarch, +remote_insert_breakpoint (struct target_ops *ops, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { /* Try the "Z" s/w breakpoint packet if it is not already disabled. @@ -8320,11 +8321,12 @@ remote_insert_breakpoint (struct gdbarch *gdbarch, throw_error (NOT_SUPPORTED_ERROR, _("\ Target doesn't support breakpoints that have target side commands.")); - return memory_insert_breakpoint (gdbarch, bp_tgt); + return memory_insert_breakpoint (ops, gdbarch, bp_tgt); } static int -remote_remove_breakpoint (struct gdbarch *gdbarch, +remote_remove_breakpoint (struct target_ops *ops, + struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { CORE_ADDR addr = bp_tgt->placed_address; @@ -8354,7 +8356,7 @@ remote_remove_breakpoint (struct gdbarch *gdbarch, return (rs->buf[0] == 'E'); } - return memory_remove_breakpoint (gdbarch, bp_tgt); + return memory_remove_breakpoint (ops, gdbarch, bp_tgt); } static int diff --git a/gdb/target.c b/gdb/target.c index 5e842884c7..612d909f04 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -90,10 +90,10 @@ static void debug_to_prepare_to_store (struct target_ops *self, static void debug_to_files_info (struct target_ops *); -static int debug_to_insert_breakpoint (struct gdbarch *, +static int debug_to_insert_breakpoint (struct target_ops *, struct gdbarch *, struct bp_target_info *); -static int debug_to_remove_breakpoint (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); @@ -585,8 +585,8 @@ update_current_target (void) INHERIT (to_prepare_to_store, t); INHERIT (deprecated_xfer_memory, t); INHERIT (to_files_info, t); - INHERIT (to_insert_breakpoint, t); - INHERIT (to_remove_breakpoint, t); + /* Do not inherit to_insert_breakpoint. */ + /* Do not inherit to_remove_breakpoint. */ INHERIT (to_can_use_hw_breakpoint, t); INHERIT (to_insert_hw_breakpoint, t); INHERIT (to_remove_hw_breakpoint, t); @@ -726,10 +726,6 @@ update_current_target (void) de_fault (to_files_info, (void (*) (struct target_ops *)) target_ignore); - de_fault (to_insert_breakpoint, - memory_insert_breakpoint); - de_fault (to_remove_breakpoint, - memory_remove_breakpoint); de_fault (to_can_use_hw_breakpoint, (int (*) (int, int, int)) return_zero); @@ -2457,6 +2453,22 @@ get_target_memory_unsigned (struct target_ops *ops, CORE_ADDR addr, return extract_unsigned_integer (buf, len, byte_order); } +/* See target.h. */ + +int +forward_target_insert_breakpoint (struct target_ops *ops, + struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) +{ + for (; ops != NULL; ops = ops->beneath) + if (ops->to_insert_breakpoint != NULL) + return ops->to_insert_breakpoint (ops, gdbarch, bp_tgt); + + return memory_insert_breakpoint (ops, gdbarch, bp_tgt); +} + +/* See target.h. */ + int target_insert_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) @@ -2467,12 +2479,15 @@ target_insert_breakpoint (struct gdbarch *gdbarch, return 1; } - return (*current_target.to_insert_breakpoint) (gdbarch, bp_tgt); + return forward_target_insert_breakpoint (¤t_target, gdbarch, bp_tgt); } +/* See target.h. */ + int -target_remove_breakpoint (struct gdbarch *gdbarch, - struct bp_target_info *bp_tgt) +forward_target_remove_breakpoint (struct target_ops *ops, + struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { /* This is kind of a weird case to handle, but the permission might have been changed after breakpoints were inserted - in which case @@ -2484,7 +2499,20 @@ target_remove_breakpoint (struct gdbarch *gdbarch, return 1; } - return (*current_target.to_remove_breakpoint) (gdbarch, bp_tgt); + for (; ops != NULL; ops = ops->beneath) + if (ops->to_remove_breakpoint != NULL) + return ops->to_remove_breakpoint (ops, gdbarch, bp_tgt); + + return memory_remove_breakpoint (ops, gdbarch, bp_tgt); +} + +/* See target.h. */ + +int +target_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) +{ + return forward_target_remove_breakpoint (¤t_target, gdbarch, bp_tgt); } static void @@ -4549,12 +4577,12 @@ debug_to_files_info (struct target_ops *target) } static int -debug_to_insert_breakpoint (struct gdbarch *gdbarch, +debug_to_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { int retval; - retval = debug_target.to_insert_breakpoint (gdbarch, bp_tgt); + retval = forward_target_insert_breakpoint (&debug_target, gdbarch, bp_tgt); fprintf_unfiltered (gdb_stdlog, "target_insert_breakpoint (%s, xxx) = %ld\n", @@ -4564,12 +4592,12 @@ debug_to_insert_breakpoint (struct gdbarch *gdbarch, } static int -debug_to_remove_breakpoint (struct gdbarch *gdbarch, +debug_to_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { int retval; - retval = debug_target.to_remove_breakpoint (gdbarch, bp_tgt); + retval = forward_target_remove_breakpoint (&debug_target, gdbarch, bp_tgt); fprintf_unfiltered (gdb_stdlog, "target_remove_breakpoint (%s, xxx) = %ld\n", diff --git a/gdb/target.h b/gdb/target.h index 975225977a..79b9886517 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -408,8 +408,10 @@ struct target_ops struct target_ops *target); void (*to_files_info) (struct target_ops *); - int (*to_insert_breakpoint) (struct gdbarch *, struct bp_target_info *); - int (*to_remove_breakpoint) (struct gdbarch *, struct bp_target_info *); + int (*to_insert_breakpoint) (struct target_ops *, struct gdbarch *, + struct bp_target_info *); + int (*to_remove_breakpoint) (struct target_ops *, struct gdbarch *, + struct bp_target_info *); int (*to_can_use_hw_breakpoint) (int, int, int); int (*to_ranged_break_num_registers) (struct target_ops *); int (*to_insert_hw_breakpoint) (struct gdbarch *, struct bp_target_info *); @@ -1137,6 +1139,16 @@ int target_write_memory_blocks (VEC(memory_write_request_s) *requests, #define target_files_info() \ (*current_target.to_files_info) (¤t_target) +/* Insert a hardware breakpoint at address BP_TGT->placed_address in + the target machine. Returns 0 for success, and returns non-zero or + throws an error (with a detailed failure reason error code and + message) otherwise. + Start the target search at OPS. */ + +extern int forward_target_insert_breakpoint (struct target_ops *ops, + struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt); + /* Insert a hardware breakpoint at address BP_TGT->placed_address in the target machine. Returns 0 for success, and returns non-zero or throws an error (with a detailed failure reason error code and @@ -1145,6 +1157,13 @@ int target_write_memory_blocks (VEC(memory_write_request_s) *requests, extern int target_insert_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt); +/* Remove a breakpoint at address BP_TGT->placed_address in the target + machine. Result is 0 for success, non-zero for error. + Start the target search at OPS. */ + +extern int forward_target_remove_breakpoint (struct target_ops *ops, + struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt); /* Remove a breakpoint at address BP_TGT->placed_address in the target machine. Result is 0 for success, non-zero for error. */ @@ -1897,10 +1916,10 @@ extern struct target_section_table *target_get_section_table /* From mem-break.c */ -extern int memory_remove_breakpoint (struct gdbarch *, +extern int memory_remove_breakpoint (struct target_ops *, struct gdbarch *, struct bp_target_info *); -extern int memory_insert_breakpoint (struct gdbarch *, +extern int memory_insert_breakpoint (struct target_ops *, struct gdbarch *, struct bp_target_info *); extern int default_memory_remove_breakpoint (struct gdbarch *, -- 2.34.1