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: Liviu Ionescu
Subject: Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument
Date: Thu, 21 May 2015 19:36:23 +0300

> On 21 May 2015, at 18:54, Peter Maydell <address@hidden> wrote:
> 
> On 21 May 2015 at 16:47, Liviu Ionescu <address@hidden> wrote:
>> 
>>> On 21 May 2015, at 18:29, Peter Maydell <address@hidden> wrote:
>>> 
>>> 
>>> There's no way to not offer the choice. In your syntax
>>> this would be
>>> --semihosting-cmdline "foo bar baz"
>> 
>> not exactly. in my implementation this would arrive in the guest
>> code as argc=1, argv[0]="foo bar baz", which will be understood as
>> a weird program name.
> 
> Well, it's the same as --semihosting-options,arg="foo bar baz".
> That will arrive in the guest code as "foo bar baz", which
> the guest code may or may not choose to interpret as a
> program name foo and two arguments.

negative. 

your example: 

        ... --semihosting-options,arg="foo bar baz" ...

will arrive in the guest code as: 

        ['f' 'o' 'o' ' ' 'b' 'a' 'r' ' ' 'b' 'a' 'z']

which any non-brain damaged parser should understand as: 

        argc=3, argv[0]="foo", argv[1]="bar", argv[2]="baz"

while in my implementation a command line like: 

        ... --semihosting-cmdline "foo bar baz" CR 

will arrive as: 

        ['"' 'f' 'o' 'o' ' ' 'b' 'a' 'r' ' ' 'b' 'a' 'z' '"'] 

which a reasonably smart parser (like the one I use) will understand as: 

        argc=1, argv[0]="foo bar baz"

it is true that a dumb parser would return: 

        argc=3, argv[0]="\"foo", argv[1]="bar", argv[2]="baz\""

but from this it is not very difficult to understand that args with spaces 
should be avoided.


regards,

Liviu







reply via email to

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