diff options
author | Pedro Alves <palves@redhat.com> | 2016-09-06 23:17:14 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2016-09-06 23:52:00 +0100 |
commit | 751b0f7dcfee83f60c1224790b9665c92be50fd8 (patch) | |
tree | 3341d15e46804f3bb8cdf21f7c44be2f38838ceb /gdb | |
parent | ddacf2e67df55cdaea63f8803e70e8367de5815c (diff) | |
download | gdb-751b0f7dcfee83f60c1224790b9665c92be50fd8.zip gdb-751b0f7dcfee83f60c1224790b9665c92be50fd8.tar.gz gdb-751b0f7dcfee83f60c1224790b9665c92be50fd8.tar.bz2 |
Introduce make_cleanup_restore_current_ui
Just a tidy, no functional changes.
gdb/ChangeLog:
2016-09-06 Pedro Alves <palves@redhat.com>
* event-top.c (restore_ui_cleanup): Now static.
(make_cleanup_restore_current_ui): New function.
(switch_thru_all_uis_init): Use it.
* infcall.c (call_thread_fsm_should_stop): Use it.
* infrun.c (fetch_inferior_event): Use it.
* top.c (new_ui_command): Use it.
* top.h (restore_ui_cleanup): Delete declaration.
(make_cleanup_restore_current_ui): New declaration.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 11 | ||||
-rw-r--r-- | gdb/event-top.c | 14 | ||||
-rw-r--r-- | gdb/infcall.c | 2 | ||||
-rw-r--r-- | gdb/infrun.c | 2 | ||||
-rw-r--r-- | gdb/top.c | 2 | ||||
-rw-r--r-- | gdb/top.h | 4 |
6 files changed, 27 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index aba4666..59854dd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2016-09-06 Pedro Alves <palves@redhat.com> + + * event-top.c (restore_ui_cleanup): Now static. + (make_cleanup_restore_current_ui): New function. + (switch_thru_all_uis_init): Use it. + * infcall.c (call_thread_fsm_should_stop): Use it. + * infrun.c (fetch_inferior_event): Use it. + * top.c (new_ui_command): Use it. + * top.h (restore_ui_cleanup): Delete declaration. + (make_cleanup_restore_current_ui): New declaration. + 2016-08-30 Andreas Arnez <arnez@linux.vnet.ibm.com> * thread.c (tp_array_compar): Insert missing parentheses. diff --git a/gdb/event-top.c b/gdb/event-top.c index 91b06e6..576eded 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -447,9 +447,9 @@ struct ui *main_ui; struct ui *current_ui; struct ui *ui_list; -/* See top.h. */ +/* A cleanup handler that restores the current UI. */ -void +static void restore_ui_cleanup (void *data) { current_ui = (struct ui *) data; @@ -457,11 +457,19 @@ restore_ui_cleanup (void *data) /* See top.h. */ +struct cleanup * +make_cleanup_restore_current_ui (void) +{ + return make_cleanup (restore_ui_cleanup, current_ui); +} + +/* See top.h. */ + void switch_thru_all_uis_init (struct switch_thru_all_uis *state) { state->iter = ui_list; - state->old_chain = make_cleanup (restore_ui_cleanup, current_ui); + state->old_chain = make_cleanup_restore_current_ui (); } /* See top.h. */ diff --git a/gdb/infcall.c b/gdb/infcall.c index 8199bdd..988b36a 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -531,7 +531,7 @@ call_thread_fsm_should_stop (struct thread_fsm *self, f->return_value = get_call_return_value (&f->return_meta_info); /* Break out of wait_sync_command_done. */ - old_chain = make_cleanup (restore_ui_cleanup, current_ui); + old_chain = make_cleanup_restore_current_ui (); current_ui = f->waiting_ui; target_terminal_ours (); f->waiting_ui->prompt_state = PROMPT_NEEDED; diff --git a/gdb/infrun.c b/gdb/infrun.c index 90841f4..70d7a09 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3915,7 +3915,7 @@ fetch_inferior_event (void *client_data) /* Events are always processed with the main UI as current UI. This way, warnings, debug output, etc. are always consistently sent to the main console. */ - make_cleanup (restore_ui_cleanup, current_ui); + make_cleanup_restore_current_ui (); current_ui = main_ui; /* End up with readline processing input, if necessary. */ @@ -386,7 +386,7 @@ new_ui_command (char *args, int from_tty) interpreter_name = argv[0]; tty_name = argv[1]; - make_cleanup (restore_ui_cleanup, current_ui); + make_cleanup_restore_current_ui (); failure_chain = make_cleanup (null_cleanup, NULL); @@ -188,8 +188,8 @@ extern void delete_ui (struct ui *todel); /* Cleanup that deletes a UI. */ extern struct cleanup *make_delete_ui_cleanup (struct ui *ui); -/* Cleanup that restores the current UI. */ -extern void restore_ui_cleanup (void *data); +/* Make a cleanup that restores the current UI. */ +extern struct cleanup *make_cleanup_restore_current_ui (void); /* Register the UI's input file descriptor in the event loop. */ extern void ui_register_input_event_handler (struct ui *ui); |