+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.
+
2015-03-25 Gary Benson <gbenson@redhat.com>
Pedro Alves <palves@redhat.com>
so that when the inferior is not running we don't get
distracted by spurious inferior output. */
if (target_has_execution)
- target_async (NULL, 0);
+ target_async (0);
}
/* Do all continuations associated with the whole inferior (not
attach_proc_task_lwp_callback);
if (target_can_async_p ())
- target_async (inferior_event_handler, 0);
+ target_async (1);
}
/* Get pending status of LP. */
if (target_can_async_p ())
{
- target_async (inferior_event_handler, 0);
+ target_async (1);
/* Tell the event loop we have something to process. */
async_file_mark ();
}
linux_resume_one_lwp (lp, step, signo);
if (target_can_async_p ())
- target_async (inferior_event_handler, 0);
+ target_async (1);
}
/* Send a signal to an LWP. */
async_terminal_is_ours = 1;
}
-static void (*async_client_callback) (enum inferior_event_type event_type,
- void *context);
-static void *async_client_context;
-
/* SIGCHLD handler that serves two purposes: In non-stop/async mode,
so we notice when any child changes state, and notify the
event-loop; it allows us to use sigsuspend in linux_nat_wait_1
static void
handle_target_event (int error, gdb_client_data client_data)
{
- (*async_client_callback) (INF_REG_EVENT, async_client_context);
+ inferior_event_handler (INF_REG_EVENT, NULL);
}
/* Create/destroy the target events pipe. Returns previous state. */
/* target_async implementation. */
static void
-linux_nat_async (struct target_ops *ops,
- void (*callback) (enum inferior_event_type event_type,
- void *context),
- void *context)
+linux_nat_async (struct target_ops *ops, int enable)
{
- if (callback != NULL)
+ if (enable)
{
- async_client_callback = callback;
- async_client_context = context;
if (!linux_async_pipe (1))
{
add_file_handler (linux_nat_event_pipe[0],
}
else
{
- async_client_callback = callback;
- async_client_context = context;
delete_file_handler (linux_nat_event_pipe[0]);
linux_async_pipe (0);
}
{
/* Unregister from the event loop. */
if (linux_nat_is_async_p (self))
- linux_nat_async (self, NULL, NULL);
+ linux_nat_async (self, 0);
if (linux_ops->to_close)
linux_ops->to_close (linux_ops);
/* The to_async method of target record-btrace. */
static void
-record_btrace_async (struct target_ops *ops,
- void (*callback) (enum inferior_event_type event_type,
- void *context),
- void *context)
+record_btrace_async (struct target_ops *ops, int enable)
{
- if (callback != NULL)
+ if (enable)
mark_async_event_handler (record_btrace_async_inferior_event_handler);
else
clear_async_event_handler (record_btrace_async_inferior_event_handler);
- ops->beneath->to_async (ops->beneath, callback, context);
+ ops->beneath->to_async (ops->beneath, enable);
}
/* Adjusts the size and returns a human readable size suffix. */
/* Async support. */
if (target_can_async_p ())
{
- target_async (inferior_event_handler, 0);
+ target_async (1);
mark_async_event_handler (record_btrace_async_inferior_event_handler);
}
}
/* "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;
/* 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;
/* 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. */
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);
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;
}
if (target_can_async_p ())
- target_async (inferior_event_handler, 0);
+ target_async (1);
if (thread_count () == 0)
{
push_stop_reply ((struct stop_reply *) reply);
- target_async (inferior_event_handler, 0);
+ target_async (1);
}
else
{
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
/* 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))
/* 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
}
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. */
}
static void
-delegate_async (struct target_ops *self, async_callback_ftype *arg1, void *arg2)
+delegate_async (struct target_ops *self, int arg1)
{
self = self->beneath;
- self->to_async (self, arg1, arg2);
+ self->to_async (self, arg1);
}
static void
-tdefault_async (struct target_ops *self, async_callback_ftype *arg1, void *arg2)
+tdefault_async (struct target_ops *self, int arg1)
{
tcomplain ();
}
static void
-debug_async (struct target_ops *self, async_callback_ftype *arg1, void *arg2)
+debug_async (struct target_ops *self, int arg1)
{
fprintf_unfiltered (gdb_stdlog, "-> %s->to_async (...)\n", debug_target.to_shortname);
- debug_target.to_async (&debug_target, arg1, arg2);
+ debug_target.to_async (&debug_target, arg1);
fprintf_unfiltered (gdb_stdlog, "<- %s->to_async (", debug_target.to_shortname);
target_debug_print_struct_target_ops_p (&debug_target);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_async_callback_ftype_p (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_void_p (arg2);
+ target_debug_print_int (arg1);
fputs_unfiltered (")\n", gdb_stdlog);
}
TARGET_DEFAULT_RETURN (0);
int (*to_is_async_p) (struct target_ops *)
TARGET_DEFAULT_RETURN (0);
- void (*to_async) (struct target_ops *, async_callback_ftype *, void *)
+ void (*to_async) (struct target_ops *, int)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* This method must be implemented in some situations. See the
comment on 'to_can_run'. */
/* Is the target in asynchronous execution mode? */
#define target_is_async_p() (current_target.to_is_async_p (¤t_target))
-/* Put the target in async mode with the specified callback function. */
-#define target_async(CALLBACK,CONTEXT) \
- (current_target.to_async (¤t_target, (CALLBACK), (CONTEXT)))
+/* Enables/disabled async target events. */
+#define target_async(ENABLE) \
+ (current_target.to_async (¤t_target, (ENABLE)))
#define target_execution_direction() \
(current_target.to_execution_direction (¤t_target))
saved_after_char_processing_hook = NULL;
if (cleanup->target_is_async_orig)
- target_async (inferior_event_handler, 0);
+ target_async (1);
xfree (cleanup);
}
back_to = make_cleanup (gdb_readline_wrapper_cleanup, cleanup);
if (cleanup->target_is_async_orig)
- target_async (NULL, NULL);
+ target_async (0);
/* Display our prompt and prevent double prompt display. */
display_gdb_prompt (prompt);