#include "frame.h"
#include "buffer.h"
#include "gdb_select.h"
+#include "common/scope-exit.h"
/* readline include files. */
#include "readline/readline.h"
void
execute_command (const char *p, int from_tty)
{
- struct cleanup *cleanup_if_error;
struct cmd_list_element *c;
const char *line;
const char *cmd_start = p;
- cleanup_if_error = make_bpstat_clear_actions_cleanup ();
+ auto cleanup_if_error = make_scope_exit (bpstat_clear_actions);
scoped_value_mark cleanup = prepare_execute_command ();
/* Force cleanup of any alloca areas if using C alloca instead of
/* This can happen when command_line_input hits end of file. */
if (p == NULL)
{
- discard_cleanups (cleanup_if_error);
+ cleanup_if_error.release ();
return;
}
if (has_stack_frames () && inferior_thread ()->state != THREAD_RUNNING)
check_frame_language_change ();
- discard_cleanups (cleanup_if_error);
+ cleanup_if_error.release ();
}
/* Run execute_command for P and FROM_TTY. Capture its output into the