returned string, do not display it to the screen. BATCH_FLAG will be
temporarily set to true. */
-char *
+std::string
execute_command_to_string (char *p, int from_tty)
{
struct ui_file *str_file;
struct cleanup *cleanup;
- char *retval;
/* GDB_STDOUT should be better already restored during these
restoration callbacks. */
execute_command (p, from_tty);
- retval = ui_file_xstrdup (str_file, NULL);
+ std::string retval = ui_file_as_string (str_file);
do_cleanups (cleanup);
struct cleanup *old_chain;
local_history_filename
- = xstrprintf ("%s-gdb%d~", history_filename, getpid ());
+ = xstrprintf ("%s-gdb%ld~", history_filename, (long) getpid ());
old_chain = make_cleanup (xfree, local_history_filename);
ret = rename (history_filename, local_history_filename);
{
struct ui_file *stb;
struct cleanup *old_chain;
- char *str;
- int qr;
/* Don't even ask if we're only debugging a core file inferior. */
if (!have_live_inferiors ())
iterate_over_inferiors (print_inferior_quit_action, stb);
fprintf_filtered (stb, _("\nQuit anyway? "));
- str = ui_file_xstrdup (stb, NULL);
- make_cleanup (xfree, str);
+ std::string str = ui_file_as_string (stb);
- qr = query ("%s", str);
do_cleanups (old_chain);
- return qr;
+
+ return query ("%s", str.c_str ());
}
/* Prepare to exit GDB cleanly by undoing any changes made to the