const char *
get_inferior_args (void)
{
- if (current_inferior ()->argc != 0)
- {
- gdb::array_view<char * const> args (current_inferior ()->argv,
- current_inferior ()->argc);
- std::string n = construct_inferior_arguments (args);
- set_inferior_args (n.c_str ());
- }
-
- if (current_inferior ()->args == NULL)
- current_inferior ()->args = make_unique_xstrdup ("");
+ if (current_inferior ()->args == nullptr)
+ return "";
return current_inferior ()->args.get ();
}
current_inferior ()->args = make_unique_xstrdup (newargs);
else
current_inferior ()->args.reset ();
-
- current_inferior ()->argc = 0;
- current_inferior ()->argv = 0;
}
void
set_inferior_args_vector (int argc, char **argv)
{
- current_inferior ()->argc = argc;
- current_inferior ()->argv = argv;
+ gdb::array_view<char * const> args (argv, argc);
+ std::string n = construct_inferior_arguments (args);
+ set_inferior_args (n.c_str ());
}
/* Notice when `set args' is run. */
if (exec_file)
uiout->field_string ("execfile", exec_file);
uiout->spaces (1);
- /* We call get_inferior_args() because we might need to compute
- the value now. */
uiout->field_string ("infargs", get_inferior_args ());
uiout->text ("\n");
uiout->flush ();
}
- /* We call get_inferior_args() because we might need to compute
- the value now. */
run_target->create_inferior (exec_file,
std::string (get_inferior_args ()),
current_inferior ()->environment.envp (),
/* The arguments string to use when running. */
gdb::unique_xmalloc_ptr<char> args;
- /* The size of elements in argv. */
- int argc = 0;
-
- /* The vector version of arguments. If ARGC is nonzero,
- then we must compute ARGS from this (via the target).
- This is always coming from main's argv and therefore
- should never be freed. */
- char **argv = NULL;
-
/* The current working directory that will be used when starting
this inferior. */
gdb::unique_xmalloc_ptr<char> cwd;