diff options
author | Pedro Alves <palves@redhat.com> | 2015-03-25 11:28:31 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-03-25 11:28:31 +0000 |
commit | 6a3753b34b7b4ff6b12d89ec1f6835799b54ef63 (patch) | |
tree | 05f89037559d7367772ca73dc5305f051ae92936 /gdb/remote.c | |
parent | 1c4b552ba553c4dbbb066c9ef8667209553444ca (diff) | |
download | gdb-6a3753b34b7b4ff6b12d89ec1f6835799b54ef63.zip gdb-6a3753b34b7b4ff6b12d89ec1f6835799b54ef63.tar.gz gdb-6a3753b34b7b4ff6b12d89ec1f6835799b54ef63.tar.bz2 |
Simplify target_async hook interface
All callers of target_async pass it the same callback
(inferior_event_handler). Since both common code and target backends
need to be able to put the target in and out of target async mode at
any given time, there's really no way that a different callback could
be passed. This commit simplifies things, and removes the indirection
altogether. Bonus: with this, gdb's target_async method ends up with
the same signature as gdbserver's.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/ChangeLog:
2015-03-25 Pedro Alves <palves@redhat.com>
* target.h <to_async>: Replace 'callback' and 'context' parameters
with boolean 'enable' parameter.
(target_async): Replace CALLBACK and CONTEXT parameters with
boolean ENABLE parameter.
* inf-loop.c (inferior_event_handler): Adjust.
* linux-nat.c (linux_nat_attach, linux_nat_resume)
(linux_nat_resume): Adjust.
(async_client_callback, async_client_context): Delete.
(handle_target_event): Call inferior_event_handler directly.
(linux_nat_async): Replace 'callback' and 'context' parameters
with boolean 'enable' parameter. Adjust. Remove references to
async_client_callback and async_client_context.
(linux_nat_close): Adjust.
* record-btrace.c (record_btrace_async): Replace 'callback' and
'context' parameters with boolean 'enable' parameter. Adjust.
(record_btrace_resume): Adjust.
* record-full.c (record_full_async): Replace 'callback' and
'context' parameters with boolean 'enable' parameter. Adjust.
(record_full_resume, record_full_core_resume): Adjust.
* remote.c (struct remote_state) <async_client_callback,
async_client_context>: Delete fields.
(remote_start_remote, extended_remote_attach_1, remote_resume)
(extended_remote_create_inferior): Adjust.
(remote_async_serial_handler): Call inferior_event_handler
directly.
(remote_async): Replace 'callback' and 'context' parameters with
boolean 'enable' parameter. Adjust.
* top.c (gdb_readline_wrapper_cleanup, gdb_readline_wrapper):
Adjust.
* target-delegates.c: Regenerate.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r-- | gdb/remote.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index fd677fe..164231c 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -124,10 +124,7 @@ static int remote_can_async_p (struct target_ops *); static int remote_is_async_p (struct target_ops *); -static void remote_async (struct target_ops *ops, - void (*callback) (enum inferior_event_type event_type, - void *context), - void *context); +static void remote_async (struct target_ops *ops, int enable); static void sync_remote_interrupt_twice (int signo); @@ -356,10 +353,6 @@ struct remote_state int use_threadinfo_query; int use_threadextra_query; - void (*async_client_callback) (enum inferior_event_type event_type, - void *context); - void *async_client_context; - /* This is set to the data address of the access causing the target to stop for a watchpoint. */ CORE_ADDR remote_watch_data_address; @@ -3661,7 +3654,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p) } if (target_can_async_p ()) - target_async (inferior_event_handler, 0); + target_async (1); if (thread_count () == 0) { @@ -4590,7 +4583,7 @@ extended_remote_attach_1 (struct target_ops *target, const char *args, push_stop_reply ((struct stop_reply *) reply); - target_async (inferior_event_handler, 0); + target_async (1); } else { @@ -4929,7 +4922,7 @@ remote_resume (struct target_ops *ops, into infcmd.c in order to allow inferior function calls to work NOT asynchronously. */ if (target_can_async_p ()) - target_async (inferior_event_handler, 0); + target_async (1); /* We've just told the target to resume. The remote server will wait for the inferior to stop, and then send a stop reply. In @@ -8112,7 +8105,7 @@ extended_remote_create_inferior (struct target_ops *ops, /* If running asynchronously, register the target file descriptor with the event loop. */ if (target_can_async_p ()) - target_async (inferior_event_handler, 0); + target_async (1); /* Disable address space randomization if requested (and supported). */ if (extended_remote_supports_disable_randomization (ops)) @@ -11962,7 +11955,7 @@ remote_async_serial_handler (struct serial *scb, void *context) /* Don't propogate error information up to the client. Instead let the client find out about the error by querying the target. */ - rs->async_client_callback (INF_REG_EVENT, rs->async_client_context); + inferior_event_handler (INF_REG_EVENT, NULL); } static void @@ -11972,18 +11965,13 @@ remote_async_inferior_event_handler (gdb_client_data data) } static void -remote_async (struct target_ops *ops, - void (*callback) (enum inferior_event_type event_type, - void *context), - void *context) +remote_async (struct target_ops *ops, int enable) { struct remote_state *rs = get_remote_state (); - if (callback != NULL) + if (enable) { serial_async (rs->remote_desc, remote_async_serial_handler, rs); - rs->async_client_callback = callback; - rs->async_client_context = context; /* If there are pending events in the stop reply queue tell the event loop to process them. */ |