aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-tdep.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-06-25 17:54:55 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-07-23 15:38:54 -0400
commitfd2dec2a45a73154d9824071ebb8664a39a69174 (patch)
tree2297cdb9fa147b25a87d354a0f7e1452f71a64d3 /gdb/linux-tdep.c
parent90cc31c9e59a75122c2371fdf43f53d91e6ad5d6 (diff)
downloadgdb-fd2dec2a45a73154d9824071ebb8664a39a69174.zip
gdb-fd2dec2a45a73154d9824071ebb8664a39a69174.tar.gz
gdb-fd2dec2a45a73154d9824071ebb8664a39a69174.tar.bz2
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
Diffstat (limited to 'gdb/linux-tdep.c')
-rw-r--r--gdb/linux-tdep.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 99e868e..637d3d3 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1847,12 +1847,12 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
strncpy (p->pr_fname, basename, sizeof (p->pr_fname) - 1);
p->pr_fname[sizeof (p->pr_fname) - 1] = '\0';
- const char *infargs = current_inferior ()->args ();
+ const std::string &infargs = current_inferior ()->args ();
/* The arguments of the program. */
std::string psargs = fname.get ();
- if (infargs != NULL)
- psargs = psargs + " " + infargs;
+ if (!infargs.empty ())
+ psargs += ' ' + infargs;
strncpy (p->pr_psargs, psargs.c_str (), sizeof (p->pr_psargs) - 1);
p->pr_psargs[sizeof (p->pr_psargs) - 1] = '\0';