]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdbserver: Don't add extra NULL to program args
authorMichael Weghorn <m.weghorn@posteo.de>
Mon, 25 May 2020 15:38:53 +0000 (11:38 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 25 May 2020 15:39:11 +0000 (11:39 -0400)
The vector holding the program args is passed as a parameter
to target_create_inferior, which then passes it to
stringify_argv for all platforms, where any NULL entry in
the vector is ignored, so there seems to be no reason
to actually add one after all.

(Since the intention is to replace uses of stringify_argv with
construct_inferior_arguments in a follow-up commit and that
function doesn't currently handle such NULL arguments, it
would otherwise have to be extended.)

gdbserver/ChangeLog:

* server.cc (captured_main), (handle_v_run): No longer
insert extra NULL element to args vector.

Change-Id: Ia2ef6d36814a6b11ce8b0d6e3b33248a7945e825

gdbserver/ChangeLog
gdbserver/server.cc

index 0bf2bb97635fbbb77fa65bf7d997ceae81602348..b4e6fa66608e7c80e03de3b4ee9595050dd3284c 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-25  Michael Weghorn  <m.weghorn@posteo.de>
+
+       * server.cc (captured_main), (handle_v_run): No longer
+       insert extra NULL element to args vector.
+
 2020-05-23  Pedro Alves  <palves@redhat.com>
 
        * gdb-safe-ctype.h: New.
index 0672f9bc4d10cfccf167c3a0d2d0a1e41302caa0..27d0931f793e32d871f6785cdbb30d07baf4df7c 100644 (file)
@@ -3015,7 +3015,6 @@ handle_v_run (char *own_buf)
       if (*next_p)
        next_p++;
     }
-  new_argv.push_back (NULL);
 
   if (new_program_name == NULL)
     {
@@ -3815,7 +3814,6 @@ captured_main (int argc, char *argv[])
       program_path.set (make_unique_xstrdup (next_arg[0]));
       for (i = 1; i < n; i++)
        program_args.push_back (xstrdup (next_arg[i]));
-      program_args.push_back (NULL);
 
       /* Wait till we are at first instruction in program.  */
       target_create_inferior (program_path.get (), program_args);