diff options
-rw-r--r-- | gdb/ChangeLog | 33 | ||||
-rw-r--r-- | gdb/inf-loop.c | 2 | ||||
-rw-r--r-- | gdb/linux-nat.c | 25 | ||||
-rw-r--r-- | gdb/record-btrace.c | 11 | ||||
-rw-r--r-- | gdb/record-full.c | 13 | ||||
-rw-r--r-- | gdb/remote.c | 28 | ||||
-rw-r--r-- | gdb/target-delegates.c | 14 | ||||
-rw-r--r-- | gdb/target.h | 8 | ||||
-rw-r--r-- | gdb/top.c | 4 |
9 files changed, 70 insertions, 68 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 591a114..febc377 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,36 @@ +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> diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c index 429cd73..eed881d 100644 --- a/gdb/inf-loop.c +++ b/gdb/inf-loop.c @@ -74,7 +74,7 @@ inferior_event_handler (enum inferior_event_type event_type, 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 diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 660dc8f..0376299 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -1341,7 +1341,7 @@ linux_nat_attach (struct target_ops *ops, const char *args, int from_tty) attach_proc_task_lwp_callback); if (target_can_async_p ()) - target_async (inferior_event_handler, 0); + target_async (1); } /* Get pending status of LP. */ @@ -1789,7 +1789,7 @@ linux_nat_resume (struct target_ops *ops, 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 (); } @@ -1810,7 +1810,7 @@ linux_nat_resume (struct target_ops *ops, 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. */ @@ -4625,10 +4625,6 @@ linux_nat_terminal_ours (struct target_ops *self) 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 @@ -4656,7 +4652,7 @@ sigchld_handler (int signo) 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. */ @@ -4700,15 +4696,10 @@ linux_async_pipe (int enable) /* 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], @@ -4720,8 +4711,6 @@ linux_nat_async (struct target_ops *ops, } else { - async_client_callback = callback; - async_client_context = context; delete_file_handler (linux_nat_event_pipe[0]); linux_async_pipe (0); } @@ -4789,7 +4778,7 @@ linux_nat_close (struct target_ops *self) { /* 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); diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 5eb5cf4..240a8dc 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -278,17 +278,14 @@ record_btrace_close (struct target_ops *self) /* 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. */ @@ -1789,7 +1786,7 @@ record_btrace_resume (struct target_ops *ops, ptid_t ptid, int step, /* 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); } } diff --git a/gdb/record-full.c b/gdb/record-full.c index 0fbb264..43e8be2 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -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. */ 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. */ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 0c1309a..b29abaf 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -1692,29 +1692,27 @@ debug_is_async_p (struct target_ops *self) } 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); } diff --git a/gdb/target.h b/gdb/target.h index 05dcd9f..19254d6 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -629,7 +629,7 @@ struct target_ops 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'. */ @@ -1686,9 +1686,9 @@ extern int target_async_permitted; /* 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)) @@ -806,7 +806,7 @@ gdb_readline_wrapper_cleanup (void *arg) saved_after_char_processing_hook = NULL; if (cleanup->target_is_async_orig) - target_async (inferior_event_handler, 0); + target_async (1); xfree (cleanup); } @@ -829,7 +829,7 @@ gdb_readline_wrapper (const char *prompt) 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); |