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  <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.
This commit is contained in:
Tom Tromey
2013-07-30 10:36:07 -06:00
parent 7d4c687d56
commit 6a109b6b2c
18 changed files with 123 additions and 71 deletions

View File

@@ -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 ();