From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdZzL-0007sL-2m for qemu-devel@nongnu.org; Thu, 02 Apr 2015 03:56:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YdZzF-0002Zc-6U for qemu-devel@nongnu.org; Thu, 02 Apr 2015 03:56:31 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:48333) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdZzF-0002ZH-0L for qemu-devel@nongnu.org; Thu, 02 Apr 2015 03:56:25 -0400 Message-ID: <551CF623.7040506@imgtec.com> Date: Thu, 2 Apr 2015 08:56:19 +0100 From: Leon Alrae MIME-Version: 1.0 References: <1427894283-31953-1-git-send-email-leon.alrae@imgtec.com> <9DE872C8-4AE3-48FC-B4A1-61ADE4DB7F32@livius.net> In-Reply-To: <9DE872C8-4AE3-48FC-B4A1-61ADE4DB7F32@livius.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH] vl.c: add -semihosting-config "arg" sub-argument List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liviu Ionescu Cc: peter.maydell@linaro.org, christopher.covington@linaro.org, qemu-devel@nongnu.org, matthew.fortune@imgtec.com On 01/04/2015 16:21, Liviu Ionescu wrote: > >> On 01 Apr 2015, at 16:18, Leon Alrae wrote: >> >> ... This simple patch adds "arg" sub-argument which in my opinion is flexible >> enough to satisfy semi-hosting interfaces which allocate buffers at runtime >> (so it is possible to pass any number of strings of any length) as well as the >> ones which have limited buffer for a single input string. > > I'm not sure I understand this. > > the ARM semihosting interface (see below for the specs) uses a single buffer, usually of 80 bytes for embedded applications, that must be entirely allocated before the call, and in this buffer a single null terminated string is returned, assuming the buffer is large enough, otherwise -1 is returned. > > what the semihosting debugger (qemu in our case) must do, is to get this string from somewhere, preferably from the command line, and pass it to the debugged application. > > > to me, the natural implementation is to use a single string. > > can you explain what are the advantages of handling multiple strings that must be later concatenated with spaces separators, to compose the full command line? > > in other words, why is it better to define something like > > "gcm --gtest_output=xml:gcm.xml --gtest_filter=FooTest.* --gtest_repeat=10" > > as > > -semihosting-config target=native,arg="gcm",arg="--gtest_output=xml:gcm.xml",arg="--gtest_filter=FooTest.*",arg="--gtest_repeat=10" > > instead of > > -semihosting-config target=native,cmdline="gcm --gtest_output=xml:gcm.xml --gtest_filter=FooTest.* --gtest_repeat=10" The ARM semihosting supports SYS_GET_CMDLINE syscall which returns a single string containing all arguments (whitespace separated I presume). The UHI semihosting supports Argn syscall which returns single argument, and Argn is called multiple times to build argv (each argument can contain whitespaces). I believe having just one flexible command line option in QEMU satisfying these two cases would be ideal. But if arg doesn't suit your needs then as Matthew already mentioned we probably should go for having cmdline and arg mutually exclusive. Leon