+2020-10-02 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * async-event.h (create_async_signal_handler): Add name
+ parameter.
+ (create_async_event_handler): Likewise.
+ * async-event.c (struct async_signal_handler) <name>: New field.
+ (struct async_event_handler) <name>: New field.
+ (create_async_signal_handler): Assign name.
+ (create_async_event_handler): Assign name.
+ * event-top.c (async_init_signals): Pass name when creating
+ handler.
+ * infrun.c (_initialize_infrun): Likewise.
+ * record-btrace.c (record_btrace_push_target): Likewise.
+ * record-full.c (record_full_open): Likewise.
+ * remote-notif.c (remote_notif_state_allocate): Likewise.
+ * remote.c (remote_target::open_1): Likewise.
+ * tui/tui-win.c (tui_initialize_win): Likewise.
+
2020-10-02 Simon Marchi <simon.marchi@polymtl.ca>
* async-event.c (initialize_async_signal_handlers): Pass name to
/* Argument to PROC. */
gdb_client_data client_data;
+
+ /* User-friendly name of this handler. */
+ const char *name;
};
/* PROC is a function to be invoked when the READY flag is set. This
/* Argument to PROC. */
gdb_client_data client_data;
+
+ /* User-friendly name of this handler. */
+ const char *name;
};
/* All the async_signal_handlers gdb is interested in are kept onto
whenever the handler is invoked. */
async_signal_handler *
create_async_signal_handler (sig_handler_func * proc,
- gdb_client_data client_data)
+ gdb_client_data client_data,
+ const char *name)
{
async_signal_handler *async_handler_ptr;
async_handler_ptr->next_handler = NULL;
async_handler_ptr->proc = proc;
async_handler_ptr->client_data = client_data;
+ async_handler_ptr->name = name;
if (sighandler_list.first_handler == NULL)
sighandler_list.first_handler = async_handler_ptr;
else
(*async_handler_ptr) = NULL;
}
-/* Create an asynchronous event handler, allocating memory for it.
- Return a pointer to the newly created handler. PROC is the
- function to call with CLIENT_DATA argument whenever the handler is
- invoked. */
+/* See async-event.h. */
+
async_event_handler *
create_async_event_handler (async_event_handler_func *proc,
- gdb_client_data client_data)
+ gdb_client_data client_data,
+ const char *name)
{
async_event_handler *h;
h->next_handler = NULL;
h->proc = proc;
h->client_data = client_data;
+ h->name = name;
if (async_event_handler_list.first_handler == NULL)
async_event_handler_list.first_handler = h;
else
typedef void (async_event_handler_func) (gdb_client_data);
extern struct async_signal_handler *
- create_async_signal_handler (sig_handler_func *proc,
- gdb_client_data client_data);
+ create_async_signal_handler (sig_handler_func *proc,
+ gdb_client_data client_data,
+ const char *name);
extern void delete_async_signal_handler (struct async_signal_handler **);
/* Call the handler from HANDLER the next time through the event
and set PROC as its callback. CLIENT_DATA is passed as argument to
PROC upon its invocation. Returns a pointer to an opaque structure
used to mark as ready and to later delete this event source from
- the event loop. */
+ the event loop.
+
+ NAME is a user-friendly name for the handler, used in debug statements. The
+ name is not copied: its lifetime should be at least as long as that of the
+ handler. */
+
extern struct async_event_handler *
create_async_event_handler (async_event_handler_func *proc,
- gdb_client_data client_data);
+ gdb_client_data client_data,
+ const char *name);
/* Remove the event source pointed by HANDLER_PTR created by
CREATE_ASYNC_EVENT_HANDLER from the event loop, and release it. */
signal (SIGINT, handle_sigint);
sigint_token =
- create_async_signal_handler (async_request_quit, NULL);
+ create_async_signal_handler (async_request_quit, NULL, "sigint");
signal (SIGTERM, handle_sigterm);
async_sigterm_token
- = create_async_signal_handler (async_sigterm_handler, NULL);
+ = create_async_signal_handler (async_sigterm_handler, NULL, "sigterm");
/* If SIGTRAP was set to SIG_IGN, then the SIG_IGN will get passed
to the inferior and breakpoints will be ignored. */
to SIG_DFL for us. */
signal (SIGQUIT, handle_sigquit);
sigquit_token =
- create_async_signal_handler (async_do_nothing, NULL);
+ create_async_signal_handler (async_do_nothing, NULL, "sigquit");
#endif
#ifdef SIGHUP
if (signal (SIGHUP, handle_sighup) != SIG_IGN)
sighup_token =
- create_async_signal_handler (async_disconnect, NULL);
+ create_async_signal_handler (async_disconnect, NULL, "sighup");
else
sighup_token =
- create_async_signal_handler (async_do_nothing, NULL);
+ create_async_signal_handler (async_do_nothing, NULL, "sighup");
#endif
signal (SIGFPE, handle_sigfpe);
sigfpe_token =
- create_async_signal_handler (async_float_handler, NULL);
+ create_async_signal_handler (async_float_handler, NULL, "sigfpe");
#ifdef SIGTSTP
sigtstp_token =
- create_async_signal_handler (async_sigtstp_handler, NULL);
+ create_async_signal_handler (async_sigtstp_handler, NULL, "sigtstp");
#endif
install_handle_sigsegv ();
/* Register extra event sources in the event loop. */
infrun_async_inferior_event_token
- = create_async_event_handler (infrun_async_inferior_event_handler, NULL);
+ = create_async_event_handler (infrun_async_inferior_event_handler, NULL,
+ "infrun");
add_info ("signals", info_signals_command, _("\
What debugger does when program gets various signals.\n\
record_btrace_async_inferior_event_handler
= create_async_event_handler (record_btrace_handle_async_inferior_event,
- NULL);
+ NULL, "record-btrace");
record_btrace_generating_corefile = 0;
format = btrace_format_short_string (record_btrace_conf.format);
/* Register extra event sources in the event loop. */
record_full_async_inferior_event_token
= create_async_event_handler (record_full_async_inferior_event_handler,
- NULL);
+ NULL, "record-full");
record_full_init_record_breakpoints ();
notif_state->get_pending_events_token
= create_async_event_handler (remote_async_get_pending_events_handler,
- notif_state);
+ notif_state, "remote-notif");
return notif_state;
}
/* Register extra event sources in the event loop. */
rs->remote_async_inferior_event_token
- = create_async_event_handler (remote_async_inferior_event_handler, remote);
+ = create_async_event_handler (remote_async_inferior_event_handler, remote,
+ "remote");
rs->notif_state = remote_notif_state_allocate (remote);
/* Reset the target state; these things will be queried either by
{
#ifdef SIGWINCH
tui_sigwinch_token
- = create_async_signal_handler (tui_async_resize_screen, NULL);
+ = create_async_signal_handler (tui_async_resize_screen, NULL,
+ "tui-sigwinch");
{
#ifdef HAVE_SIGACTION