> On 08 Apr 2015, at 19:20, Leon Alrae <leon.al...@imgtec.com> wrote: > > ... I do understand > however that in your particular case cmdline is more convenient, thus I > personally don’t mind having both options: the user-friendly cmdline and > more flexible arg.
I was a bit optimistic with the first implementation of "--semihosting-cmdline string", since this approach complicates things when calling the emulator from a script. a normal script might do something like ~~~ # identify own args and use shift to 'eat' them exec qemu ... --semihosting-cmdline $@ ~~~ the first thought was to transform the $@ array into a single string with quotes, like "$@", but this does not work properly if the arguments already include spaces. so, after long considerations, I had to revert to the very first idea, to use a variable number args option, which, obviously, cannot be placed anywhere else but at the end. the new implementation is available from: https://sourceforge.net/p/gnuarmeclipse/qemu/ci/gnuarmeclipse-dev/tree/vl.c the option is identified in the first parsing loop, args are stored and argc is diminished accordingly, for the second pass to work without any changes. one more thing to note is the concatenate_semihosting_cmdline() function, which is not as simple as Leon suggested in the original post, since it has to add quotes to arguments containing spaces. I updated the Eclipse plug-in to use this mechanism and there were no problems. passing the args from a script is also pretty easy, so to me this looks like the right solution. any comments? Livius