gdb: make inferior::m_args an std::string

With the current code, both a NULL pointer and an empty string can mean
"no arguments".  We don't need this distinction.  Changing to a string
has the advantage that there is now a single state for that (an empty
string), which makes the code a bit simpler in my opinion.

Change-Id: Icdc622820f7869478791dbaa84b4a1c7fec21ced
This commit is contained in:
Simon Marchi
2021-06-25 17:54:55 -04:00
parent 90cc31c9e5
commit fd2dec2a45
6 changed files with 23 additions and 35 deletions

View File

@@ -129,7 +129,7 @@ set_inferior_args_vector (int argc, char **argv)
{
gdb::array_view<char * const> args (argv, argc);
std::string n = construct_inferior_arguments (args);
current_inferior ()->set_args (n.c_str ());
current_inferior ()->set_args (std::move (n));
}
/* Notice when `set args' is run. */
@@ -151,7 +151,7 @@ show_args_command (struct ui_file *file, int from_tty,
/* Note that we ignore the passed-in value in favor of computing it
directly. */
deprecated_show_value_hack (file, from_tty, c,
current_inferior ()->args ());
current_inferior ()->args ().c_str ());
}
/* See gdbsupport/common-inferior.h. */