forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -914,17 +914,14 @@ record_full_close (struct target_ops *self)
|
||||
/* "to_async" target method. */
|
||||
|
||||
static void
|
||||
record_full_async (struct target_ops *ops,
|
||||
void (*callback) (enum inferior_event_type event_type,
|
||||
void *context),
|
||||
void *context)
|
||||
record_full_async (struct target_ops *ops, int enable)
|
||||
{
|
||||
if (callback != NULL)
|
||||
if (enable)
|
||||
mark_async_event_handler (record_full_async_inferior_event_token);
|
||||
else
|
||||
clear_async_event_handler (record_full_async_inferior_event_token);
|
||||
|
||||
ops->beneath->to_async (ops->beneath, callback, context);
|
||||
ops->beneath->to_async (ops->beneath, enable);
|
||||
}
|
||||
|
||||
static int record_full_resume_step = 0;
|
||||
@@ -1006,7 +1003,7 @@ record_full_resume (struct target_ops *ops, ptid_t ptid, int step,
|
||||
/* We are about to start executing the inferior (or simulate it),
|
||||
let's register it with the event loop. */
|
||||
if (target_can_async_p ())
|
||||
target_async (inferior_event_handler, 0);
|
||||
target_async (1);
|
||||
}
|
||||
|
||||
static int record_full_get_sig = 0;
|
||||
@@ -1978,7 +1975,7 @@ record_full_core_resume (struct target_ops *ops, ptid_t ptid, int step,
|
||||
/* We are about to start executing the inferior (or simulate it),
|
||||
let's register it with the event loop. */
|
||||
if (target_can_async_p ())
|
||||
target_async (inferior_event_handler, 0);
|
||||
target_async (1);
|
||||
}
|
||||
|
||||
/* "to_kill" method for prec over corefile. */
|
||||
|
||||
Reference in New Issue
Block a user