Introduce cleanup to restore current_uiout

Make a globally available cleanup from a pre-existing one in infrun.c.
This is used in a following patch.

gdb/ChangeLog:

	* infrun.c (restore_current_uiout_cleanup): Move to ui-out.c.
	(print_stop_event): Use make_cleanup_restore_current_uiout.
	* python/python.c (execute_gdb_command): Likewise.
	* ui-out.c (restore_current_uiout_cleanup): Move from infrun.c.
	(make_cleanup_restore_current_uiout): New function definition.
	* ui-out.h (make_cleanup_restore_current_uiout): New function
	declaration.
	* utils.c (do_restore_ui_out): Remove.
	(make_cleanup_restore_ui_out): Remove.
	* utils.h (make_cleanup_restore_ui_out): Remove.
This commit is contained in:
Simon Marchi 2016-09-16 15:44:29 -04:00 committed by Simon Marchi
parent 325fac504a
commit cd94f6d535
7 changed files with 38 additions and 38 deletions

View file

@ -8096,16 +8096,6 @@ print_stop_location (struct target_waitstatus *ws)
print_stack_frame (get_selected_frame (NULL), 0, source_flag, 1);
}
/* Cleanup that restores a previous current uiout. */
static void
restore_current_uiout_cleanup (void *arg)
{
struct ui_out *saved_uiout = (struct ui_out *) arg;
current_uiout = saved_uiout;
}
/* See infrun.h. */
void
@ -8118,7 +8108,7 @@ print_stop_event (struct ui_out *uiout)
get_last_target_status (&last_ptid, &last);
old_chain = make_cleanup (restore_current_uiout_cleanup, current_uiout);
old_chain = make_cleanup_restore_current_uiout ();
current_uiout = uiout;
print_stop_location (&last);