qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config ar


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument
Date: Thu, 21 May 2015 16:06:03 +0100

On 21 May 2015 at 15:57, Liviu Ionescu <address@hidden> wrote:
>
>> On 21 May 2015, at 17:33, Peter Maydell <address@hidden> wrote:
>>
>> On 21 May 2015 at 15:28, Liviu Ionescu <address@hidden> wrote:
>>> from what I understood, for MIPS the emulator must be called with a
>>> sequence of ,arg=xxx, while for ARM it needs to be called with a single
>>> long string including the entire command line.
>>
>> You can use a sequence of ,arg=xxx on ARM too. It's just that it might
>> be easier not to bother, because the guest can't tell the difference
>> between:
>> (1) the user specified three arguments "foo", "bar" and "baz", which
>> QEMU concatenated together with spaces in order to give the guest
>> the semihosting commandling string "foo bar baz"
>> (2) the user specified a single argument "foo bar baz" with spaces in it
>>
>>> as such, in my opinion there should be either a single string,
>>> split internally by the parser when needed, or an array of
>>> substrings, concatenated internally when needed.
>>
>> I agree that we should not require the target code to do the
>> splitting and concatenation. I think we're heading towards
>> the array-of-substrings approach.
>
> a few lines before you presented two examples. I guess the users
> will choose most of the time the second one, which is not an array
> of substrings approach.

That's their choice... It is still an array of substrings,
but if the user only provides one string then we have an
array of length 1.

> regarding splitting on the target, for ARM semihosting you cannot avoid
> it, but this is implemented anyway in the startup code, not in user code.

This is the guest code. QEMU has no say in what the guest does,
so it's not relevant to the discussion.

>>> unless these things get clarified, for GNU ARM Eclipse QEMU, I'm inclined 
>>> to keep my "--semihosting-cmdline arg0 arg1 ... argn" as it is easier to 
>>> use and understand.
>>
>> This won't work for MIPS, because there's no way to
>> specify different arguments properly.
>
> I'm afraid you are missing something.

Sorry, I misinterpreted those quotes. Anyway, this
is just different syntax, it's the same effectively
as arg=x,arg=y,arg=z.

> implemented this, I can tell you that this was the
> cleanest method, there was no intermediate parsing on
> the way, I just copied the pointers from the tail of
> the qemu argv[] to an internal array, and this array
> was passed unchanged to semihosting, the emulated process
> receiving *exactly* what the qemu receives, without any
> processing. for ARM, the substrings were concatenated,
> using quotes or apostrophes for args containing spaces.

Adding quotes and apostrophes seems wrong to me,
because it's making assumptions about the guest's
handling of the semihosting string.

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]