From 6a109b6b2c98b949e490791ae57c100bb53be57e Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 30 Jul 2013 10:36:07 -0600 Subject: [PATCH] add "this" pointers to more target APIs A subsequent pass introduces delegation helper functions to the target API. This delegation is much cleaner if the target_ops pointer is directly available at delegation time. This patch adds the "this" pointer to various to_* methods for this purpose. This updates a number of ports which I am unable to test. Please give them a look-over. Any possible problem here is trivial, though, as all that is required is adding an argument to a function. 2014-02-19 Tom Tromey * aarch64-linux-nat.c (aarch64_linux_stopped_by_watchpoint): Add 'ops' argument. * arm-linux-nat.c (arm_linux_stopped_by_watchpoint): Add 'ops' argument. * i386-nat.c (i386_stopped_by_watchpoint): Add 'ops' argument. * ia64-linux-nat.c (ia64_linux_stopped_by_watchpoint): Add 'ops' argument. * inf-ttrace.c (inf_ttrace_stopped_by_watchpoint): Add 'ops' argument. * linux-nat.c (save_sigtrap): Update. (linux_nat_stopped_by_watchpoint, linux_nat_is_async_p) (linux_nat_can_async_p, linux_nat_async): Add 'ops' argument. (linux_nat_close): Update. * mips-linux-nat.c (mips_linux_stopped_by_watchpoint): Add 'ops' argument. * ppc-linux-nat.c (ppc_linux_stopped_by_watchpoint): Add 'ops' argument. * procfs.c (procfs_stopped_by_watchpoint): Add 'ops' argument. * record-full.c (record_full_beneath_to_stopped_by_watchpoint) (record_full_beneath_to_async, tmp_to_stopped_by_watchpoint) (tmp_to_async): Add 'ops' argument. (record_full_stopped_by_watchpoint, record_full_async) (record_full_can_async_p, record_full_is_async_p): Add 'ops' argument. * remote-m32r-sdi.c (m32r_insert_breakpoint, m32r_remove_breakpoint) (m32r_stopped_by_watchpoint): Add 'ops' argument. * remote-mips.c (mips_stopped_by_watchpoint): Add 'ops' argument. * remote.c (remote_stopped_by_watchpoint_p, remote_can_async_p) (remote_is_async_p, remote_async): Add 'ops' argument. (remote_stopped_data_address): Update. * s390-nat.c (s390_stopped_by_watchpoint): Add 'ops' argument. * target.c (update_current_target) (find_default_can_async_p, find_default_is_async_p): Update. (init_dummy_target): Update. (debug_to_stopped_by_watchpoint): Add 'ops' argument. * target.h (struct target_ops) : Add 'ops' argument. (target_can_async_p, target_is_async_p, target_async) (target_stopped_by_watchpoint): Update. --- gdb/ChangeLog | 42 +++++++++++++++++++++++++++++++++++++++++ gdb/aarch64-linux-nat.c | 4 ++-- gdb/arm-linux-nat.c | 4 ++-- gdb/i386-nat.c | 4 ++-- gdb/ia64-linux-nat.c | 4 ++-- gdb/inf-ttrace.c | 2 +- gdb/linux-nat.c | 22 ++++++++++----------- gdb/mips-linux-nat.c | 2 +- gdb/nto-procfs.c | 4 ++-- gdb/ppc-linux-nat.c | 4 ++-- gdb/procfs.c | 2 +- gdb/record-full.c | 28 ++++++++++++++++----------- gdb/remote-m32r-sdi.c | 2 +- gdb/remote-mips.c | 2 +- gdb/remote.c | 24 +++++++++++++---------- gdb/s390-linux-nat.c | 2 +- gdb/target.c | 23 +++++++++++----------- gdb/target.h | 19 ++++++++++--------- 18 files changed, 123 insertions(+), 71 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5b61324d35..770a534cfd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,45 @@ +2014-02-19 Tom Tromey + + * aarch64-linux-nat.c (aarch64_linux_stopped_by_watchpoint): + Add 'ops' argument. + * arm-linux-nat.c (arm_linux_stopped_by_watchpoint): Add + 'ops' argument. + * i386-nat.c (i386_stopped_by_watchpoint): Add 'ops' argument. + * ia64-linux-nat.c (ia64_linux_stopped_by_watchpoint): Add + 'ops' argument. + * inf-ttrace.c (inf_ttrace_stopped_by_watchpoint): Add 'ops' + argument. + * linux-nat.c (save_sigtrap): Update. + (linux_nat_stopped_by_watchpoint, linux_nat_is_async_p) + (linux_nat_can_async_p, linux_nat_async): Add 'ops' argument. + (linux_nat_close): Update. + * mips-linux-nat.c (mips_linux_stopped_by_watchpoint): Add 'ops' + argument. + * ppc-linux-nat.c (ppc_linux_stopped_by_watchpoint): Add 'ops' + argument. + * procfs.c (procfs_stopped_by_watchpoint): Add 'ops' argument. + * record-full.c (record_full_beneath_to_stopped_by_watchpoint) + (record_full_beneath_to_async, tmp_to_stopped_by_watchpoint) + (tmp_to_async): Add 'ops' argument. + (record_full_stopped_by_watchpoint, record_full_async) + (record_full_can_async_p, record_full_is_async_p): Add 'ops' + argument. + * remote-m32r-sdi.c (m32r_insert_breakpoint, m32r_remove_breakpoint) + (m32r_stopped_by_watchpoint): Add 'ops' argument. + * remote-mips.c (mips_stopped_by_watchpoint): Add 'ops' argument. + * remote.c (remote_stopped_by_watchpoint_p, remote_can_async_p) + (remote_is_async_p, remote_async): Add 'ops' argument. + (remote_stopped_data_address): Update. + * s390-nat.c (s390_stopped_by_watchpoint): Add 'ops' argument. + * target.c (update_current_target) + (find_default_can_async_p, find_default_is_async_p): Update. + (init_dummy_target): Update. + (debug_to_stopped_by_watchpoint): Add 'ops' argument. + * target.h (struct target_ops) : Add 'ops' argument. + (target_can_async_p, target_is_async_p, target_async) + (target_stopped_by_watchpoint): Update. + 2014-02-19 Yao Qi PR gdb/16220 diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 31c26c63cc..703c4ed96e 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -1476,11 +1476,11 @@ aarch64_linux_stopped_data_address (struct target_ops *target, /* Implement the "to_stopped_by_watchpoint" target_ops method. */ static int -aarch64_linux_stopped_by_watchpoint (void) +aarch64_linux_stopped_by_watchpoint (struct target_ops *ops) { CORE_ADDR addr; - return aarch64_linux_stopped_data_address (¤t_target, &addr); + return aarch64_linux_stopped_data_address (ops, &addr); } /* Implement the "to_watchpoint_addr_within_range" target_ops method. */ diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 6f56634e98..9fa5f5b166 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -1171,10 +1171,10 @@ arm_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p) /* Has the target been stopped by hitting a watchpoint? */ static int -arm_linux_stopped_by_watchpoint (void) +arm_linux_stopped_by_watchpoint (struct target_ops *ops) { CORE_ADDR addr; - return arm_linux_stopped_data_address (¤t_target, &addr); + return arm_linux_stopped_data_address (ops, &addr); } static int diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c index 034bf5126b..23edc38a40 100644 --- a/gdb/i386-nat.c +++ b/gdb/i386-nat.c @@ -756,10 +756,10 @@ i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) } static int -i386_stopped_by_watchpoint (void) +i386_stopped_by_watchpoint (struct target_ops *ops) { CORE_ADDR addr = 0; - return i386_stopped_data_address (¤t_target, &addr); + return i386_stopped_data_address (ops, &addr); } /* Insert a hardware-assisted breakpoint at BP_TGT->placed_address. diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c index 072c8fd90d..ea575c8bba 100644 --- a/gdb/ia64-linux-nat.c +++ b/gdb/ia64-linux-nat.c @@ -669,10 +669,10 @@ ia64_linux_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) } static int -ia64_linux_stopped_by_watchpoint (void) +ia64_linux_stopped_by_watchpoint (struct target_ops *ops) { CORE_ADDR addr; - return ia64_linux_stopped_data_address (¤t_target, &addr); + return ia64_linux_stopped_data_address (ops, &addr); } static int diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c index 2eec951c21..e219fb8bdb 100644 --- a/gdb/inf-ttrace.c +++ b/gdb/inf-ttrace.c @@ -374,7 +374,7 @@ inf_ttrace_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) by hitting a "hardware" watchpoint. */ static int -inf_ttrace_stopped_by_watchpoint (void) +inf_ttrace_stopped_by_watchpoint (struct target_ops *ops) { pid_t pid = ptid_get_pid (inferior_ptid); lwpid_t lwpid = ptid_get_lwp (inferior_ptid); diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 1dac44d906..6c31c3b2fd 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -262,10 +262,6 @@ async_file_mark (void) be awakened anyway. */ } -static void linux_nat_async (void (*callback) - (enum inferior_event_type event_type, - void *context), - void *context); static int kill_lwp (int lwpid, int signo); static int stop_callback (struct lwp_info *lp, void *data); @@ -2484,7 +2480,7 @@ save_sigtrap (struct lwp_info *lp) old_chain = save_inferior_ptid (); inferior_ptid = lp->ptid; - lp->stopped_by_watchpoint = linux_ops->to_stopped_by_watchpoint (); + lp->stopped_by_watchpoint = linux_ops->to_stopped_by_watchpoint (linux_ops); if (lp->stopped_by_watchpoint) { @@ -2502,7 +2498,7 @@ save_sigtrap (struct lwp_info *lp) /* See save_sigtrap. */ static int -linux_nat_stopped_by_watchpoint (void) +linux_nat_stopped_by_watchpoint (struct target_ops *ops) { struct lwp_info *lp = find_lwp_pid (inferior_ptid); @@ -4536,7 +4532,7 @@ linux_trad_target (CORE_ADDR (*register_u_offset)(struct gdbarch *, int, int)) /* target_is_async_p implementation. */ static int -linux_nat_is_async_p (void) +linux_nat_is_async_p (struct target_ops *ops) { /* NOTE: palves 2008-03-21: We're only async when the user requests it explicitly with the "set target-async" command. @@ -4547,7 +4543,7 @@ linux_nat_is_async_p (void) /* target_can_async_p implementation. */ static int -linux_nat_can_async_p (void) +linux_nat_can_async_p (struct target_ops *ops) { /* NOTE: palves 2008-03-21: We're only async when the user requests it explicitly with the "set target-async" command. @@ -4707,8 +4703,10 @@ linux_async_pipe (int enable) /* target_async implementation. */ static void -linux_nat_async (void (*callback) (enum inferior_event_type event_type, - void *context), void *context) +linux_nat_async (struct target_ops *ops, + void (*callback) (enum inferior_event_type event_type, + void *context), + void *context) { if (callback != NULL) { @@ -4793,8 +4791,8 @@ static void linux_nat_close (void) { /* Unregister from the event loop. */ - if (linux_nat_is_async_p ()) - linux_nat_async (NULL, 0); + if (linux_nat_is_async_p (NULL)) + linux_nat_async (NULL, NULL, 0); if (linux_ops->to_close) linux_ops->to_close (); diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index ce0d135e5c..627241fa81 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -553,7 +553,7 @@ mips_linux_can_use_hw_breakpoint (int type, int cnt, int ot) register triggered. */ static int -mips_linux_stopped_by_watchpoint (void) +mips_linux_stopped_by_watchpoint (struct target_ops *ops) { int n; int num_valid; diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 4669345cb3..7739197c18 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -75,7 +75,7 @@ static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type, static int procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type, struct expression *cond); -static int procfs_stopped_by_watchpoint (void); +static int procfs_stopped_by_watchpoint (struct target_ops *ops); /* These two globals are only ever set in procfs_open(), but are referenced elsewhere. 'nto_procfs_node' is a flag used to say @@ -1508,7 +1508,7 @@ procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type, } static int -procfs_stopped_by_watchpoint (void) +procfs_stopped_by_watchpoint (struct target_ops *ops) { return 0; } diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 8d57b9d89d..b38b33ef25 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -2283,10 +2283,10 @@ ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p) } static int -ppc_linux_stopped_by_watchpoint (void) +ppc_linux_stopped_by_watchpoint (struct target_ops *ops) { CORE_ADDR addr; - return ppc_linux_stopped_data_address (¤t_target, &addr); + return ppc_linux_stopped_data_address (ops, &addr); } static int diff --git a/gdb/procfs.c b/gdb/procfs.c index 13a71aac7b..9cdbdd53e8 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -4858,7 +4858,7 @@ procfs_can_use_hw_breakpoint (int type, int cnt, int othertype) fault, else returns zero. */ static int -procfs_stopped_by_watchpoint (void) +procfs_stopped_by_watchpoint (struct target_ops *ops) { procinfo *pi; diff --git a/gdb/record-full.c b/gdb/record-full.c index b223a1bde0..1d3750be61 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -252,11 +252,12 @@ static int 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_by_watchpoint) (struct target_ops *); static int (*record_full_beneath_to_stopped_data_address) (struct target_ops *, CORE_ADDR *); static void - (*record_full_beneath_to_async) (void (*) (enum inferior_event_type, void *), + (*record_full_beneath_to_async) (struct target_ops *, + void (*) (enum inferior_event_type, void *), void *); static void record_full_goto_insn (struct record_full_entry *entry, @@ -824,10 +825,10 @@ 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_by_watchpoint) (struct target_ops *); static int (*tmp_to_stopped_data_address) (struct target_ops *, CORE_ADDR *); -static int (*tmp_to_stopped_data_address) (struct target_ops *, CORE_ADDR *); -static void (*tmp_to_async) (void (*) (enum inferior_event_type, void *), void *); +static void (*tmp_to_async) (struct target_ops *, + void (*) (enum inferior_event_type, void *), void *); static void record_full_restore (void); @@ -1523,12 +1524,16 @@ record_full_wait (struct target_ops *ops, } static int -record_full_stopped_by_watchpoint (void) +record_full_stopped_by_watchpoint (struct target_ops *ops) { if (RECORD_FULL_IS_REPLAY) return record_full_hw_watchpoint; else - return record_full_beneath_to_stopped_by_watchpoint (); + { + struct target_ops *beneath = find_target_beneath (ops); + + return record_full_beneath_to_stopped_by_watchpoint (beneath); + } } static int @@ -1909,25 +1914,26 @@ record_full_goto_bookmark (gdb_byte *raw_bookmark, int from_tty) } static void -record_full_async (void (*callback) (enum inferior_event_type event_type, +record_full_async (struct target_ops *ops, + void (*callback) (enum inferior_event_type event_type, void *context), void *context) { /* If we're on top of a line target (e.g., linux-nat, remote), then set it to async mode as well. Will be NULL if we're sitting on top of the core target, for "record restore". */ if (record_full_beneath_to_async != NULL) - record_full_beneath_to_async (callback, context); + record_full_beneath_to_async (find_target_beneath (ops), callback, context); } static int -record_full_can_async_p (void) +record_full_can_async_p (struct target_ops *ops) { /* We only enable async when the user specifically asks for it. */ return target_async_permitted; } static int -record_full_is_async_p (void) +record_full_is_async_p (struct target_ops *ops) { /* We only enable async when the user specifically asks for it. */ return target_async_permitted; diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index d722876714..48c4b4bd27 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -1477,7 +1477,7 @@ m32r_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p) } static int -m32r_stopped_by_watchpoint (void) +m32r_stopped_by_watchpoint (struct target_ops *ops) { CORE_ADDR addr; diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 6e7d9560fb..6109e64bf6 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -2450,7 +2450,7 @@ mips_remove_watchpoint (CORE_ADDR addr, int len, int type, if not. */ static int -mips_stopped_by_watchpoint (void) +mips_stopped_by_watchpoint (struct target_ops *ops) { return hit_watchpoint; } diff --git a/gdb/remote.c b/gdb/remote.c index 4a46740255..e6fd8b3517 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -125,12 +125,14 @@ static void remote_serial_write (const char *str, int len); static void remote_kill (struct target_ops *ops); -static int remote_can_async_p (void); +static int remote_can_async_p (struct target_ops *); -static int remote_is_async_p (void); +static int remote_is_async_p (struct target_ops *); -static void remote_async (void (*callback) (enum inferior_event_type event_type, - void *context), void *context); +static void remote_async (struct target_ops *ops, + void (*callback) (enum inferior_event_type event_type, + void *context), + void *context); static void sync_remote_interrupt_twice (int signo); @@ -8294,7 +8296,7 @@ remote_check_watch_resources (int type, int cnt, int ot) } static int -remote_stopped_by_watchpoint (void) +remote_stopped_by_watchpoint (struct target_ops *ops) { struct remote_state *rs = get_remote_state (); @@ -8307,7 +8309,7 @@ remote_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p) struct remote_state *rs = get_remote_state (); int rc = 0; - if (remote_stopped_by_watchpoint ()) + if (remote_stopped_by_watchpoint (target)) { *addr_p = rs->remote_watch_data_address; rc = 1; @@ -11493,7 +11495,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya)."; } static int -remote_can_async_p (void) +remote_can_async_p (struct target_ops *ops) { struct remote_state *rs = get_remote_state (); @@ -11506,7 +11508,7 @@ remote_can_async_p (void) } static int -remote_is_async_p (void) +remote_is_async_p (struct target_ops *ops) { struct remote_state *rs = get_remote_state (); @@ -11541,8 +11543,10 @@ remote_async_inferior_event_handler (gdb_client_data data) } static void -remote_async (void (*callback) (enum inferior_event_type event_type, - void *context), void *context) +remote_async (struct target_ops *ops, + void (*callback) (enum inferior_event_type event_type, + void *context), + void *context) { struct remote_state *rs = get_remote_state (); diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c index ee9b617dee..8cc9060bae 100644 --- a/gdb/s390-linux-nat.c +++ b/gdb/s390-linux-nat.c @@ -433,7 +433,7 @@ struct watch_area static struct watch_area *watch_base = NULL; static int -s390_stopped_by_watchpoint (void) +s390_stopped_by_watchpoint (struct target_ops *ops) { per_lowcore_bits per_lowcore; ptrace_area parea; diff --git a/gdb/target.c b/gdb/target.c index 92d5e3943a..990dc5e361 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -110,8 +110,6 @@ static int debug_to_insert_watchpoint (CORE_ADDR, int, int, static int debug_to_remove_watchpoint (CORE_ADDR, int, int, struct expression *); -static int debug_to_stopped_by_watchpoint (void); - static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *); static int debug_to_watchpoint_addr_within_range (struct target_ops *, @@ -742,7 +740,7 @@ update_current_target (void) (int (*) (CORE_ADDR, int, int, struct expression *)) return_minus_one); de_fault (to_stopped_by_watchpoint, - (int (*) (void)) + (int (*) (struct target_ops *)) return_zero); de_fault (to_stopped_data_address, (int (*) (struct target_ops *, CORE_ADDR *)) @@ -820,7 +818,9 @@ update_current_target (void) (char *(*) (int)) return_null); de_fault (to_async, - (void (*) (void (*) (enum inferior_event_type, void*), void*)) + (void (*) (struct target_ops *, + void (*) (enum inferior_event_type, void*), + void*)) tcomplain); de_fault (to_thread_architecture, default_thread_architecture); @@ -3231,7 +3231,7 @@ find_default_create_inferior (struct target_ops *ops, } static int -find_default_can_async_p (void) +find_default_can_async_p (struct target_ops *ignore) { struct target_ops *t; @@ -3241,12 +3241,12 @@ find_default_can_async_p (void) connected yet. */ t = find_default_run_target (NULL); if (t && t->to_can_async_p) - return (t->to_can_async_p) (); + return (t->to_can_async_p) (t); return 0; } static int -find_default_is_async_p (void) +find_default_is_async_p (struct target_ops *ignore) { struct target_ops *t; @@ -3256,7 +3256,7 @@ find_default_is_async_p (void) connected yet. */ t = find_default_run_target (NULL); if (t && t->to_is_async_p) - return (t->to_is_async_p) (); + return (t->to_is_async_p) (t); return 0; } @@ -3864,7 +3864,8 @@ init_dummy_target (void) dummy_target.to_has_registers = (int (*) (struct target_ops *)) return_zero; dummy_target.to_has_execution = (int (*) (struct target_ops *, ptid_t)) return_zero; - dummy_target.to_stopped_by_watchpoint = return_zero; + dummy_target.to_stopped_by_watchpoint + = (int (*) (struct target_ops *)) return_zero; dummy_target.to_stopped_data_address = (int (*) (struct target_ops *, CORE_ADDR *)) return_zero; dummy_target.to_magic = OPS_MAGIC; @@ -4743,11 +4744,11 @@ debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw, } static int -debug_to_stopped_by_watchpoint (void) +debug_to_stopped_by_watchpoint (struct target_ops *ops) { int retval; - retval = debug_target.to_stopped_by_watchpoint (); + retval = debug_target.to_stopped_by_watchpoint (&debug_target); fprintf_unfiltered (gdb_stdlog, "target_stopped_by_watchpoint () = %ld\n", diff --git a/gdb/target.h b/gdb/target.h index 9fa56f237d..83e3b590e1 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -435,7 +435,7 @@ struct target_ops CORE_ADDR, CORE_ADDR, int); int (*to_remove_mask_watchpoint) (struct target_ops *, CORE_ADDR, CORE_ADDR, int); - int (*to_stopped_by_watchpoint) (void); + int (*to_stopped_by_watchpoint) (struct target_ops *); int to_have_steppable_watchpoint; int to_have_continuable_watchpoint; int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *); @@ -500,9 +500,10 @@ struct target_ops int to_has_thread_control; /* control thread execution */ int to_attach_no_wait; /* ASYNC target controls */ - int (*to_can_async_p) (void); - int (*to_is_async_p) (void); - void (*to_async) (async_callback_ftype *, void *); + int (*to_can_async_p) (struct target_ops *); + int (*to_is_async_p) (struct target_ops *); + void (*to_async) (struct target_ops *, + async_callback_ftype *, void *); int (*to_supports_non_stop) (void); /* find_memory_regions support method for gcore */ int (*to_find_memory_regions) (find_memory_region_ftype func, void *data); @@ -1469,16 +1470,16 @@ extern int default_child_has_execution (struct target_ops *ops, extern int target_async_permitted; /* Can the target support asynchronous execution? */ -#define target_can_async_p() (current_target.to_can_async_p ()) +#define target_can_async_p() (current_target.to_can_async_p (¤t_target)) /* Is the target in asynchronous execution mode? */ -#define target_is_async_p() (current_target.to_is_async_p ()) +#define target_is_async_p() (current_target.to_is_async_p (¤t_target)) int target_supports_non_stop (void); /* Put the target in async mode with the specified callback function. */ #define target_async(CALLBACK,CONTEXT) \ - (current_target.to_async ((CALLBACK), (CONTEXT))) + (current_target.to_async (¤t_target, (CALLBACK), (CONTEXT))) #define target_execution_direction() \ (current_target.to_execution_direction ()) @@ -1552,8 +1553,8 @@ extern char *target_thread_name (struct thread_info *); /* Returns non-zero if we were stopped by a hardware watchpoint (memory read or write). Only the INFERIOR_PTID task is being queried. */ -#define target_stopped_by_watchpoint \ - (*current_target.to_stopped_by_watchpoint) +#define target_stopped_by_watchpoint() \ + ((*current_target.to_stopped_by_watchpoint) (¤t_target)) /* Non-zero if we have steppable watchpoints */ -- 2.34.1