diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2020-10-02 14:44:38 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-10-02 14:47:06 -0400 |
commit | db20ebdfae432f23def32f0b9bbf6e023c926235 (patch) | |
tree | b11102a43affccf7bcb740972c51bc2c4212832e /gdb/async-event.c | |
parent | 2554f6f564097e4e3a4132d3af8ef78d588d13d1 (diff) | |
download | binutils-gdb-db20ebdfae432f23def32f0b9bbf6e023c926235.tar.gz |
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
Diffstat (limited to 'gdb/async-event.c')
-rw-r--r-- | gdb/async-event.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gdb/async-event.c b/gdb/async-event.c index e5cd63e309e..55be014484e 100644 --- a/gdb/async-event.c +++ b/gdb/async-event.c @@ -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 |