mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-05 15:15:42 +00:00
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:
committed by
Simon Marchi
parent
2554f6f564
commit
db20ebdfae
@@ -1,3 +1,21 @@
|
|||||||
|
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>
|
2020-10-02 Simon Marchi <simon.marchi@polymtl.ca>
|
||||||
|
|
||||||
* async-event.c (initialize_async_signal_handlers): Pass name to
|
* async-event.c (initialize_async_signal_handlers): Pass name to
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ struct async_signal_handler
|
|||||||
|
|
||||||
/* Argument to PROC. */
|
/* Argument to PROC. */
|
||||||
gdb_client_data client_data;
|
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
|
/* 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. */
|
/* Argument to PROC. */
|
||||||
gdb_client_data client_data;
|
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
|
/* 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. */
|
whenever the handler is invoked. */
|
||||||
async_signal_handler *
|
async_signal_handler *
|
||||||
create_async_signal_handler (sig_handler_func * proc,
|
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_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->next_handler = NULL;
|
||||||
async_handler_ptr->proc = proc;
|
async_handler_ptr->proc = proc;
|
||||||
async_handler_ptr->client_data = client_data;
|
async_handler_ptr->client_data = client_data;
|
||||||
|
async_handler_ptr->name = name;
|
||||||
if (sighandler_list.first_handler == NULL)
|
if (sighandler_list.first_handler == NULL)
|
||||||
sighandler_list.first_handler = async_handler_ptr;
|
sighandler_list.first_handler = async_handler_ptr;
|
||||||
else
|
else
|
||||||
@@ -236,13 +244,12 @@ delete_async_signal_handler (async_signal_handler ** async_handler_ptr)
|
|||||||
(*async_handler_ptr) = NULL;
|
(*async_handler_ptr) = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create an asynchronous event handler, allocating memory for it.
|
/* See async-event.h. */
|
||||||
Return a pointer to the newly created handler. PROC is the
|
|
||||||
function to call with CLIENT_DATA argument whenever the handler is
|
|
||||||
invoked. */
|
|
||||||
async_event_handler *
|
async_event_handler *
|
||||||
create_async_event_handler (async_event_handler_func *proc,
|
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;
|
async_event_handler *h;
|
||||||
|
|
||||||
@@ -251,6 +258,7 @@ create_async_event_handler (async_event_handler_func *proc,
|
|||||||
h->next_handler = NULL;
|
h->next_handler = NULL;
|
||||||
h->proc = proc;
|
h->proc = proc;
|
||||||
h->client_data = client_data;
|
h->client_data = client_data;
|
||||||
|
h->name = name;
|
||||||
if (async_event_handler_list.first_handler == NULL)
|
if (async_event_handler_list.first_handler == NULL)
|
||||||
async_event_handler_list.first_handler = h;
|
async_event_handler_list.first_handler = h;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ typedef void (async_event_handler_func) (gdb_client_data);
|
|||||||
|
|
||||||
extern struct async_signal_handler *
|
extern struct async_signal_handler *
|
||||||
create_async_signal_handler (sig_handler_func *proc,
|
create_async_signal_handler (sig_handler_func *proc,
|
||||||
gdb_client_data client_data);
|
gdb_client_data client_data,
|
||||||
|
const char *name);
|
||||||
extern void delete_async_signal_handler (struct async_signal_handler **);
|
extern void delete_async_signal_handler (struct async_signal_handler **);
|
||||||
|
|
||||||
/* Call the handler from HANDLER the next time through the event
|
/* 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
|
and set PROC as its callback. CLIENT_DATA is passed as argument to
|
||||||
PROC upon its invocation. Returns a pointer to an opaque structure
|
PROC upon its invocation. Returns a pointer to an opaque structure
|
||||||
used to mark as ready and to later delete this event source from
|
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 *
|
extern struct async_event_handler *
|
||||||
create_async_event_handler (async_event_handler_func *proc,
|
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
|
/* Remove the event source pointed by HANDLER_PTR created by
|
||||||
CREATE_ASYNC_EVENT_HANDLER from the event loop, and release it. */
|
CREATE_ASYNC_EVENT_HANDLER from the event loop, and release it. */
|
||||||
|
|||||||
@@ -916,10 +916,10 @@ async_init_signals (void)
|
|||||||
|
|
||||||
signal (SIGINT, handle_sigint);
|
signal (SIGINT, handle_sigint);
|
||||||
sigint_token =
|
sigint_token =
|
||||||
create_async_signal_handler (async_request_quit, NULL);
|
create_async_signal_handler (async_request_quit, NULL, "sigint");
|
||||||
signal (SIGTERM, handle_sigterm);
|
signal (SIGTERM, handle_sigterm);
|
||||||
async_sigterm_token
|
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
|
/* If SIGTRAP was set to SIG_IGN, then the SIG_IGN will get passed
|
||||||
to the inferior and breakpoints will be ignored. */
|
to the inferior and breakpoints will be ignored. */
|
||||||
@@ -938,23 +938,23 @@ async_init_signals (void)
|
|||||||
to SIG_DFL for us. */
|
to SIG_DFL for us. */
|
||||||
signal (SIGQUIT, handle_sigquit);
|
signal (SIGQUIT, handle_sigquit);
|
||||||
sigquit_token =
|
sigquit_token =
|
||||||
create_async_signal_handler (async_do_nothing, NULL);
|
create_async_signal_handler (async_do_nothing, NULL, "sigquit");
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGHUP
|
#ifdef SIGHUP
|
||||||
if (signal (SIGHUP, handle_sighup) != SIG_IGN)
|
if (signal (SIGHUP, handle_sighup) != SIG_IGN)
|
||||||
sighup_token =
|
sighup_token =
|
||||||
create_async_signal_handler (async_disconnect, NULL);
|
create_async_signal_handler (async_disconnect, NULL, "sighup");
|
||||||
else
|
else
|
||||||
sighup_token =
|
sighup_token =
|
||||||
create_async_signal_handler (async_do_nothing, NULL);
|
create_async_signal_handler (async_do_nothing, NULL, "sighup");
|
||||||
#endif
|
#endif
|
||||||
signal (SIGFPE, handle_sigfpe);
|
signal (SIGFPE, handle_sigfpe);
|
||||||
sigfpe_token =
|
sigfpe_token =
|
||||||
create_async_signal_handler (async_float_handler, NULL);
|
create_async_signal_handler (async_float_handler, NULL, "sigfpe");
|
||||||
|
|
||||||
#ifdef SIGTSTP
|
#ifdef SIGTSTP
|
||||||
sigtstp_token =
|
sigtstp_token =
|
||||||
create_async_signal_handler (async_sigtstp_handler, NULL);
|
create_async_signal_handler (async_sigtstp_handler, NULL, "sigtstp");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
install_handle_sigsegv ();
|
install_handle_sigsegv ();
|
||||||
|
|||||||
@@ -9278,7 +9278,8 @@ _initialize_infrun ()
|
|||||||
|
|
||||||
/* Register extra event sources in the event loop. */
|
/* Register extra event sources in the event loop. */
|
||||||
infrun_async_inferior_event_token
|
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, _("\
|
add_info ("signals", info_signals_command, _("\
|
||||||
What debugger does when program gets various signals.\n\
|
What debugger does when program gets various signals.\n\
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ record_btrace_push_target (void)
|
|||||||
|
|
||||||
record_btrace_async_inferior_event_handler
|
record_btrace_async_inferior_event_handler
|
||||||
= create_async_event_handler (record_btrace_handle_async_inferior_event,
|
= create_async_event_handler (record_btrace_handle_async_inferior_event,
|
||||||
NULL);
|
NULL, "record-btrace");
|
||||||
record_btrace_generating_corefile = 0;
|
record_btrace_generating_corefile = 0;
|
||||||
|
|
||||||
format = btrace_format_short_string (record_btrace_conf.format);
|
format = btrace_format_short_string (record_btrace_conf.format);
|
||||||
|
|||||||
@@ -986,7 +986,7 @@ record_full_open (const char *name, int from_tty)
|
|||||||
/* Register extra event sources in the event loop. */
|
/* Register extra event sources in the event loop. */
|
||||||
record_full_async_inferior_event_token
|
record_full_async_inferior_event_token
|
||||||
= create_async_event_handler (record_full_async_inferior_event_handler,
|
= create_async_event_handler (record_full_async_inferior_event_handler,
|
||||||
NULL);
|
NULL, "record-full");
|
||||||
|
|
||||||
record_full_init_record_breakpoints ();
|
record_full_init_record_breakpoints ();
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ remote_notif_state_allocate (remote_target *remote)
|
|||||||
|
|
||||||
notif_state->get_pending_events_token
|
notif_state->get_pending_events_token
|
||||||
= create_async_event_handler (remote_async_get_pending_events_handler,
|
= create_async_event_handler (remote_async_get_pending_events_handler,
|
||||||
notif_state);
|
notif_state, "remote-notif");
|
||||||
|
|
||||||
return notif_state;
|
return notif_state;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5605,7 +5605,8 @@ remote_target::open_1 (const char *name, int from_tty, int extended_p)
|
|||||||
|
|
||||||
/* Register extra event sources in the event loop. */
|
/* Register extra event sources in the event loop. */
|
||||||
rs->remote_async_inferior_event_token
|
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);
|
rs->notif_state = remote_notif_state_allocate (remote);
|
||||||
|
|
||||||
/* Reset the target state; these things will be queried either by
|
/* Reset the target state; these things will be queried either by
|
||||||
|
|||||||
@@ -576,7 +576,8 @@ tui_initialize_win (void)
|
|||||||
{
|
{
|
||||||
#ifdef SIGWINCH
|
#ifdef SIGWINCH
|
||||||
tui_sigwinch_token
|
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
|
#ifdef HAVE_SIGACTION
|
||||||
|
|||||||
Reference in New Issue
Block a user