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 9F6933893649 for ; Wed, 29 Apr 2020 11:16:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9F6933893649 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 6F3C1160063 for ; Wed, 29 Apr 2020 13:16:55 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 49BwvV6Xflz6tmF; Wed, 29 Apr 2020 13:16:54 +0200 (CEST) From: Michael Weghorn To: gdb-patches@sourceware.org Subject: [PATCH 2/4] gdbserver: Don't add extra NULL to program args Date: Wed, 29 Apr 2020 13:16:36 +0200 Message-Id: <20200429111638.1327262-4-m.weghorn@posteo.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200429111638.1327262-1-m.weghorn@posteo.de> References: <20200429111638.1327262-1-m.weghorn@posteo.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-23.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, 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: Wed, 29 Apr 2020 11:17:07 -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-04-29 Michael Weghorn * server.cc (captured_main): No longer insert extra NULL element to args vector. --- gdbserver/server.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/gdbserver/server.cc b/gdbserver/server.cc index 0672f9bc4d..239511c104 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -3815,7 +3815,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