+2014-02-19 Tom Tromey <tromey@redhat.com>
+
+ * 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) <to_stopped_by_watchpoint,
+ to_can_async_p, to_is_async_p, to_async>: Add 'ops' argument.
+ (target_can_async_p, target_is_async_p, target_async)
+ (target_stopped_by_watchpoint): Update.
+
2014-02-19 Yao Qi <yao@codesourcery.com>
PR gdb/16220
/* 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. */
/* 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
}
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.
}
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
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);
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);
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)
{
/* 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);
/* 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.
/* 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.
/* 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)
{
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 ();
register triggered. */
static int
-mips_linux_stopped_by_watchpoint (void)
+mips_linux_stopped_by_watchpoint (struct target_ops *ops)
{
int n;
int num_valid;
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
}
static int
-procfs_stopped_by_watchpoint (void)
+procfs_stopped_by_watchpoint (struct target_ops *ops)
{
return 0;
}
}
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
fault, else returns zero. */
static int
-procfs_stopped_by_watchpoint (void)
+procfs_stopped_by_watchpoint (struct target_ops *ops)
{
procinfo *pi;
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,
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);
}
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
}
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;
}
static int
-m32r_stopped_by_watchpoint (void)
+m32r_stopped_by_watchpoint (struct target_ops *ops)
{
CORE_ADDR addr;
if not. */
static int
-mips_stopped_by_watchpoint (void)
+mips_stopped_by_watchpoint (struct target_ops *ops)
{
return hit_watchpoint;
}
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);
}
static int
-remote_stopped_by_watchpoint (void)
+remote_stopped_by_watchpoint (struct target_ops *ops)
{
struct remote_state *rs = get_remote_state ();
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;
}
static int
-remote_can_async_p (void)
+remote_can_async_p (struct target_ops *ops)
{
struct remote_state *rs = get_remote_state ();
}
static int
-remote_is_async_p (void)
+remote_is_async_p (struct target_ops *ops)
{
struct remote_state *rs = get_remote_state ();
}
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 ();
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;
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 *,
(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 *))
(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);
}
static int
-find_default_can_async_p (void)
+find_default_can_async_p (struct target_ops *ignore)
{
struct target_ops *t;
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;
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;
}
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;
}
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",
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 *);
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);
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 ())
/* 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 */