From b1a35af2704842ff1a90626b0148c0fc93f995f6 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 2 Jul 2020 08:37:26 -0400 Subject: gdb: remove unused fetch_inferior_event and inferior_event_handler parameters I noticed that fetch_inferior_event receives the client_data parameter from its caller, inferior_event_handler, but doesn't actually need it. This patch removes it. In turn, inferior_event_handler doesn't use its parameter, so remove it too. The `data` argument used when registering remote_async_inferior_event_handler is changed to NULL, to avoid confusion. It could make people think that the value passed is used somewhere, when in fact it's not. gdb/ChangeLog: * inf-loop.c (inferior_event_handler): Remove client_data param. * inf-loop.h (inferior_event_handler): Likewise. * infcmd.c (step_1): Adjust. * infrun.c (proceed): Adjust. (fetch_inferior_event): Remove client_data param. (infrun_async_inferior_event_handler): Adjust. * infrun.h (fetch_inferior_event): Remove `void *` param. * linux-nat.c (handle_target_event): Adjust. * record-btrace.c (record_btrace_handle_async_inferior_event): Adjust. * record-full.c (record_full_async_inferior_event_handler): Adjust. * remote.c (remote_async_inferior_event_handler): Adjust. Change-Id: I3c2aa1eb0ea3e0985df096660d2dcd794674f2ea --- gdb/ChangeLog | 16 ++++++++++++++++ gdb/inf-loop.c | 5 ++--- gdb/inf-loop.h | 3 +-- gdb/infcmd.c | 2 +- gdb/infrun.c | 8 ++++---- gdb/infrun.h | 2 +- gdb/linux-nat.c | 2 +- gdb/record-btrace.c | 2 +- gdb/record-full.c | 2 +- gdb/remote.c | 7 +++---- 10 files changed, 31 insertions(+), 18 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 662e6b9..3d67327 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +2020-07-02 Simon Marchi + + * inf-loop.c (inferior_event_handler): Remove client_data param. + * inf-loop.h (inferior_event_handler): Likewise. + * infcmd.c (step_1): Adjust. + * infrun.c (proceed): Adjust. + (fetch_inferior_event): Remove client_data param. + (infrun_async_inferior_event_handler): Adjust. + * infrun.h (fetch_inferior_event): Remove `void *` param. + * linux-nat.c (handle_target_event): Adjust. + * record-btrace.c (record_btrace_handle_async_inferior_event): + Adjust. + * record-full.c (record_full_async_inferior_event_handler): + Adjust. + * remote.c (remote_async_inferior_event_handler): Adjust. + 2020-07-01 Tom Tromey * tui/tui-data.h (struct tui_win_info) : Now pure virtual. diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c index c40ae23..cf746b8 100644 --- a/gdb/inf-loop.c +++ b/gdb/inf-loop.c @@ -34,13 +34,12 @@ /* General function to handle events in the inferior. */ void -inferior_event_handler (enum inferior_event_type event_type, - gdb_client_data client_data) +inferior_event_handler (enum inferior_event_type event_type) { switch (event_type) { case INF_REG_EVENT: - fetch_inferior_event (client_data); + fetch_inferior_event (); break; case INF_EXEC_COMPLETE: diff --git a/gdb/inf-loop.h b/gdb/inf-loop.h index 4ddbcbc..ed27f52 100644 --- a/gdb/inf-loop.h +++ b/gdb/inf-loop.h @@ -22,7 +22,6 @@ #include "target.h" /* For enum inferior_event_type. */ -extern void inferior_event_handler (enum inferior_event_type event_type, - void* client_data); +extern void inferior_event_handler (enum inferior_event_type event_type); #endif /* #ifndef INF_LOOP_H */ diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 64eea88..cfc3169 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -907,7 +907,7 @@ step_1 (int skip_subroutines, int single_inst, const char *count_string) thr->thread_fsm->clean_up (thr); proceeded = normal_stop (); if (!proceeded) - inferior_event_handler (INF_EXEC_COMPLETE, NULL); + inferior_event_handler (INF_EXEC_COMPLETE); all_uis_check_sync_execution_done (); } } diff --git a/gdb/infrun.c b/gdb/infrun.c index 7bc405f..6b655d4 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2968,7 +2968,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal) /* The target for some reason decided not to resume. */ normal_stop (); if (target_can_async_p ()) - inferior_event_handler (INF_EXEC_COMPLETE, NULL); + inferior_event_handler (INF_EXEC_COMPLETE); return; } @@ -3933,7 +3933,7 @@ all_uis_on_sync_execution_starting (void) necessary cleanups. */ void -fetch_inferior_event (void *client_data) +fetch_inferior_event () { struct execution_control_state ecss; struct execution_control_state *ecs = &ecss; @@ -4050,7 +4050,7 @@ fetch_inferior_event (void *client_data) if (!proceeded) { - inferior_event_handler (INF_EXEC_COMPLETE, NULL); + inferior_event_handler (INF_EXEC_COMPLETE); cmd_done = 1; } @@ -9422,7 +9422,7 @@ static const struct internalvar_funcs siginfo_funcs = static void infrun_async_inferior_event_handler (gdb_client_data data) { - inferior_event_handler (INF_REG_EVENT, NULL); + inferior_event_handler (INF_REG_EVENT); } void _initialize_infrun (); diff --git a/gdb/infrun.h b/gdb/infrun.h index 9808541..49b28f0 100644 --- a/gdb/infrun.h +++ b/gdb/infrun.h @@ -130,7 +130,7 @@ extern void stop_all_threads (void); extern void prepare_for_detach (void); -extern void fetch_inferior_event (void *); +extern void fetch_inferior_event (); extern void init_wait_for_inferior (void); diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 0a2bfdc..fde360f 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -4232,7 +4232,7 @@ sigchld_handler (int signo) static void handle_target_event (int error, gdb_client_data client_data) { - inferior_event_handler (INF_REG_EVENT, NULL); + inferior_event_handler (INF_REG_EVENT); } /* Create/destroy the target events pipe. Returns previous state. */ diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 226d56d..718de62 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -325,7 +325,7 @@ record_btrace_auto_disable (void) static void record_btrace_handle_async_inferior_event (gdb_client_data data) { - inferior_event_handler (INF_REG_EVENT, NULL); + inferior_event_handler (INF_REG_EVENT); } /* See record-btrace.h. */ diff --git a/gdb/record-full.c b/gdb/record-full.c index 9d6e403..1d8f193 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -905,7 +905,7 @@ static struct async_event_handler *record_full_async_inferior_event_token; static void record_full_async_inferior_event_handler (gdb_client_data data) { - inferior_event_handler (INF_REG_EVENT, NULL); + inferior_event_handler (INF_REG_EVENT); } /* Open the process record target for 'core' files. */ diff --git a/gdb/remote.c b/gdb/remote.c index d560c69..f7f99dc 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -5605,8 +5605,7 @@ remote_target::open_1 (const char *name, int from_tty, int extended_p) /* 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, NULL); rs->notif_state = remote_notif_state_allocate (remote); /* Reset the target state; these things will be queried either by @@ -14158,13 +14157,13 @@ remote_async_serial_handler (struct serial *scb, void *context) { /* Don't propogate error information up to the client. Instead let the client find out about the error by querying the target. */ - inferior_event_handler (INF_REG_EVENT, NULL); + inferior_event_handler (INF_REG_EVENT); } static void remote_async_inferior_event_handler (gdb_client_data data) { - inferior_event_handler (INF_REG_EVENT, data); + inferior_event_handler (INF_REG_EVENT); } int -- cgit v1.1