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 B5184395A00C for ; Wed, 29 Apr 2020 11:16:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B5184395A00C Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 62EA5160064 for ; Wed, 29 Apr 2020 13:16:57 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 49BwvX6BX4z6tml; Wed, 29 Apr 2020 13:16:56 +0200 (CEST) From: Michael Weghorn To: gdb-patches@sourceware.org Subject: [PATCH 4/4] [PR gdbserver/25893]: Add gdbserver test for argument with space in it Date: Wed, 29 Apr 2020 13:16:38 +0200 Message-Id: <20200429111638.1327262-6-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.8 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, KAM_SHORT, 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:12 -0000 This adds a test to call gdbserver with a program that is passed an argument containing a space and checks that argv[1] actually contains the value of this arg. gdb/testsuite/ChangeLog: 2020-04-29 Michael Weghorn PR gdbserver/25893 * gdb.server/arg-with-space.exp: New test that covers running program with arg containing a space with gdbserver --- gdb/testsuite/gdb.server/arg-with-space.exp | 41 +++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 gdb/testsuite/gdb.server/arg-with-space.exp diff --git a/gdb/testsuite/gdb.server/arg-with-space.exp b/gdb/testsuite/gdb.server/arg-with-space.exp new file mode 100644 index 0000000000..d768b7ca0f --- /dev/null +++ b/gdb/testsuite/gdb.server/arg-with-space.exp @@ -0,0 +1,41 @@ +# This testcase is part of GDB, the GNU debugger. +# +# Copyright 2020 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test gdbserver to properly handle a program arg with a space in it +# as a single argument. + +load_lib gdbserver-support.exp + +standard_testfile "normal.c" + +if {[skip_gdbserver_tests]} { + return 0 +} + +if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { + return -1 +} +clean_restart ${testfile} + +gdbserver_run "\"hello world\"" + +gdb_breakpoint main +gdb_continue main + +# check that program arg was passed properly +gdb_test "print argc" "2" +gdb_test "print argv\[1\]" "\"hello world\"" -- 2.26.2