diff options
author | Markus Metzger <markus.t.metzger@intel.com> | 2013-12-17 10:49:03 +0100 |
---|---|---|
committer | Markus Metzger <markus.t.metzger@intel.com> | 2014-01-16 13:06:13 +0100 |
commit | 3db08215d47b576303a8cbaf6195b5f4a3bb9a13 (patch) | |
tree | 6f4326579cd045cb61883082447975fa62461a36 /gdb/target.c | |
parent | cecac1aba0917b4f87837e3037a84954ac013b5c (diff) | |
download | gdb-3db08215d47b576303a8cbaf6195b5f4a3bb9a13.zip gdb-3db08215d47b576303a8cbaf6195b5f4a3bb9a13.tar.gz gdb-3db08215d47b576303a8cbaf6195b5f4a3bb9a13.tar.bz2 |
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.
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 60 |
1 files changed, 44 insertions, 16 deletions
diff --git a/gdb/target.c b/gdb/target.c index 5e84288..612d909 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", |