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

@ -27,8 +27,9 @@ typedef void (sig_handler_func) (gdb_client_data);
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
@ -48,10 +49,16 @@ extern void clear_async_signal_handler (struct async_signal_handler *handler);
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. */