From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by sourceware.org (Postfix) with ESMTPS id 95CD43938C15 for ; Tue, 12 May 2020 15:42:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 95CD43938C15 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 1C86516005C for ; Tue, 12 May 2020 17:42:25 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 49M29s24Tsz6tmG; Tue, 12 May 2020 17:42:25 +0200 (CEST) From: Michael Weghorn To: gdb-patches@sourceware.org Cc: Michael Weghorn Subject: [PATCH v3 3/6] gdbserver: Don't add extra NULL to program args Date: Tue, 12 May 2020 17:42:08 +0200 Message-Id: <20200512154211.1311364-3-m.weghorn@posteo.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200512154211.1311364-1-m.weghorn@posteo.de> References: <20200429111638.1327262-1-m.weghorn@posteo.de> <20200512154211.1311364-1-m.weghorn@posteo.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-15.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2020 15:42:28 -0000 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: 2020-05-12 Michael Weghorn * server.cc (captured_main), (handle_v_run): No longer insert extra NULL element to args vector. --- gdbserver/server.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/gdbserver/server.cc b/gdbserver/server.cc index 0672f9bc4d..27d0931f79 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -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); -- 2.26.2