/* Environment to use for running inferior,
in format described in environ.h. */
-struct environ *inferior_environ;
+struct gdb_environ *inferior_environ;
\f
/* Accessor routines. */
/* Notice when `show args' is run. */
static void
-notice_args_read (char *args, int from_tty, struct cmd_list_element *c)
+notice_args_read (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
+ deprecated_show_value_hack (file, from_tty, c, value);
/* Might compute the value. */
get_inferior_args ();
}
}
}
+/* Implement the "run" command. If TBREAK_AT_MAIN is set, then insert
+ a temporary breakpoint at the begining of the main program before
+ running the program. */
+
static void
-run_command (char *args, int from_tty)
+run_command_1 (char *args, int from_tty, int tbreak_at_main)
{
char *exec_file;
reopen_exec_file ();
reread_symbols ();
+ /* Insert the temporary breakpoint if a location was specified. */
+ if (tbreak_at_main)
+ tbreak_command (main_name (), 0);
+
exec_file = (char *) get_exec_file (0);
/* We keep symbols from add-symbol-file, on the grounds that the
}
+static void
+run_command (char *args, int from_tty)
+{
+ run_command_1 (args, from_tty, 0);
+}
+
static void
run_no_args_command (char *args, int from_tty)
{
if (!have_minimal_symbols ())
error (_("No symbol table loaded. Use the \"file\" command."));
- /* If the inferior is already running, we want to ask the user if we
- should restart it or not before we insert the temporary breakpoint.
- This makes sure that this command doesn't have any side effect if
- the user changes its mind. */
- kill_if_already_running (from_tty);
-
- /* Insert the temporary breakpoint, and run... */
- tbreak_command (main_name (), 0);
- run_command (args, from_tty);
+ /* Run the program until reaching the main procedure... */
+ run_command_1 (args, from_tty, 1);
}
void
_("Set terminal for future runs of program being debugged."));
set_cmd_completer (c, filename_completer);
- c = add_set_cmd ("args", class_run, var_string_noescape,
- (char *) &inferior_args,
- "Set argument list to give program being debugged when it is started.\n\
-Follow this command with any number of args, to be passed to the program.",
- &setlist);
- set_cmd_completer (c, filename_completer);
- set_cmd_sfunc (c, notice_args_set);
- c = deprecated_add_show_from_set (c, &showlist);
- set_cmd_sfunc (c, notice_args_read);
+ add_setshow_optional_filename_cmd ("args", class_run,
+ &inferior_args, _("\
+Set argument list to give program being debugged when it is started."), _("\
+Show argument list to give program being debugged when it is started."), _("\
+Follow this command with any number of args, to be passed to the program."),
+ notice_args_set,
+ notice_args_read,
+ &setlist, &showlist);
c = add_cmd ("environment", no_class, environment_info, _("\
The environment to give the program, or one variable's value.\n\