aboutsummaryrefslogtreecommitdiff
path: root/gdb/elf-none-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/elf-none-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/elf-none-tdep.c')
-rw-r--r--gdb/elf-none-tdep.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/elf-none-tdep.c b/gdb/elf-none-tdep.c
index 0d94dc4..1802ffb 100644
--- a/gdb/elf-none-tdep.c
+++ b/gdb/elf-none-tdep.c
@@ -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