#include "top.h"
#include "version.h"
#include "serial.h"
-#include "doublest.h"
#include "main.h"
#include "event-loop.h"
#include "gdbthread.h"
}
#endif
-struct cleanup *
-prepare_execute_command (void)
+scoped_value_mark
+prepare_execute_command ()
{
- struct value *mark;
- struct cleanup *cleanup;
-
- mark = value_mark ();
- cleanup = make_cleanup_value_free_to_mark (mark);
-
/* With multiple threads running while the one we're examining is
stopped, the dcache can get stale without us being able to detect
it. For the duration of the command, though, use the dcache to
if (non_stop)
target_dcache_invalidate ();
- return cleanup;
+ return scoped_value_mark ();
}
/* Tell the user if the language has changed (except first time) after
void
execute_command (char *p, int from_tty)
{
- struct cleanup *cleanup_if_error, *cleanup;
+ struct cleanup *cleanup_if_error;
struct cmd_list_element *c;
char *line;
cleanup_if_error = make_bpstat_clear_actions_cleanup ();
- cleanup = prepare_execute_command ();
+ scoped_value_mark cleanup = prepare_execute_command ();
/* Force cleanup of any alloca areas if using C alloca instead of
a builtin alloca. */
/* This can happen when command_line_input hits end of file. */
if (p == NULL)
{
- do_cleanups (cleanup);
discard_cleanups (cleanup_if_error);
return;
}
check_frame_language_change ();
- do_cleanups (cleanup);
discard_cleanups (cleanup_if_error);
}
gdb_safe_append_history (void)
{
int ret, saved_errno;
- char *local_history_filename;
- struct cleanup *old_chain;
- local_history_filename
- = xstrprintf ("%s-gdb%ld~", history_filename, (long) getpid ());
- old_chain = make_cleanup (xfree, local_history_filename);
+ std::string local_history_filename
+ = string_printf ("%s-gdb%ld~", history_filename, (long) getpid ());
- ret = rename (history_filename, local_history_filename);
+ ret = rename (history_filename, local_history_filename.c_str ());
saved_errno = errno;
if (ret < 0 && saved_errno != ENOENT)
{
warning (_("Could not rename %s to %s: %s"),
- history_filename, local_history_filename,
+ history_filename, local_history_filename.c_str (),
safe_strerror (saved_errno));
}
else
to move it back anyway. Otherwise a global history file would
never get created! */
gdb_assert (saved_errno == ENOENT);
- write_history (local_history_filename);
+ write_history (local_history_filename.c_str ());
}
else
{
- append_history (command_count, local_history_filename);
+ append_history (command_count, local_history_filename.c_str ());
if (history_is_stifled ())
- history_truncate_file (local_history_filename, history_max_entries);
+ history_truncate_file (local_history_filename.c_str (),
+ history_max_entries);
}
- ret = rename (local_history_filename, history_filename);
+ ret = rename (local_history_filename.c_str (), history_filename);
saved_errno = errno;
if (ret < 0 && saved_errno != EEXIST)
warning (_("Could not rename %s to %s: %s"),
- local_history_filename, history_filename,
+ local_history_filename.c_str (), history_filename,
safe_strerror (saved_errno));
}
-
- do_cleanups (old_chain);
}
/* Read one line from the command input stream `instream' into a local
}
void
-set_history (char *args, int from_tty)
+set_history (const char *args, int from_tty)
{
printf_unfiltered (_("\"set history\" must be followed "
"by the name of a history subcommand.\n"));
}
void
-show_history (char *args, int from_tty)
+show_history (const char *args, int from_tty)
{
cmd_show_list (showhistlist, from_tty, "");
}