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

@ -49,9 +49,9 @@ elf_none_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd,
fname = lbasename (exe);
psargs = std::string (exe);
const char *infargs = current_inferior ()->args ();
if (infargs != nullptr)
psargs += " " + std::string (infargs);
const std::string &infargs = current_inferior ()->args ();
if (!infargs.empty ())
psargs += ' ' + infargs;
/* All existing targets that handle writing out prpsinfo expect the
fname and psargs strings to be at least 16 and 80 characters long