gdb: give names to async event/signal handlers

Assign names to async event/signal handlers.  They will be used in debug
messages when file handlers are invoked.

Unlike in the previous patch, the names are not copied in the structure,
since we don't need to (all names are string literals for the moment).

gdb/ChangeLog:

	* 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.

Change-Id: Icd9d9f775542ae5fc2cd148c12f481e7885936d5
This commit is contained in:
Simon Marchi
2020-10-02 14:44:38 -04:00
committed by Simon Marchi
parent 2554f6f564
commit db20ebdfae
10 changed files with 59 additions and 23 deletions

View File

@ -46,6 +46,9 @@ struct async_signal_handler
/* 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
@ -68,6 +71,9 @@ struct async_event_handler
/* 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
@ -127,7 +133,8 @@ initialize_async_signal_handlers (void)
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;
@ -136,6 +143,7 @@ create_async_signal_handler (sig_handler_func * proc,
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
@ -236,13 +244,12 @@ delete_async_signal_handler (async_signal_handler ** async_handler_ptr)
(*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;
@ -251,6 +258,7 @@ create_async_event_handler (async_event_handler_func *proc,
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