}
}
-/* A cleanup that restores the execution direction to the value saved
- in *ARG. */
-
-static void
-restore_execution_direction (void *arg)
-{
- enum exec_direction_kind *save_exec_dir = (enum exec_direction_kind *) arg;
-
- execution_direction = *save_exec_dir;
-}
-
/* Asynchronous version of wait_for_inferior. It is called by the
event loop whenever a change of state is detected on the file
descriptor corresponding to the target. It can be called more than
struct execution_control_state *ecs = &ecss;
struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
struct cleanup *ts_old_chain;
- enum exec_direction_kind save_exec_dir = execution_direction;
int cmd_done = 0;
ptid_t waiton_ptid = minus_one_ptid;
/* 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_current_ui ();
- current_ui = main_ui;
+ scoped_restore save_ui = make_scoped_restore (¤t_ui, main_ui);
/* End up with readline processing input, if necessary. */
make_cleanup (reinstall_readline_callback_handler_cleanup, NULL);
event. */
target_dcache_invalidate ();
- make_cleanup (restore_execution_direction, &save_exec_dir);
- execution_direction = target_execution_direction ();
+ scoped_restore save_exec_dir
+ = make_scoped_restore (&execution_direction, target_execution_direction ());
ecs->ptid = do_target_wait (waiton_ptid, &ecs->ws,
target_can_async_p () ? TARGET_WNOHANG : 0);
}
gdb_flush (gdb_stdout);
- target_mourn_inferior ();
+ target_mourn_inferior (inferior_ptid);
stop_print_frame = 0;
stop_waiting (ecs);
return;