Re: [PATCH 4/4] [PR gdbserver/25893]: Add gdbserver test for argument with space in it

Simon Marchi
2020-05-10T16:09:31Z

On 2020-05-07 6:15 p.m., Simon Marchi wrote:
> It would be nice to write a test in such a way that it can cover this use case
> when using GDB (without GDBserver) too.
>
> It's possible to run the same test using plain GDB with:
>
> make check TESTS="gdb.base/foo.exp"
>
> or
>
> make check TESTS="gdb.base/foo.exp" RUNTESTFLAGS="--target_board=unix"
>
> unix is the default DejaGNU (runtest) board, so these two are equivalent.
>
> It's also possible to run a test using gdbserver as a target:
>
> make check TESTS="gdb.base/foo.exp" RUNTESTFLAGS="--target_board=native-gdbserver"
> make check TESTS="gdb.base/foo.exp" RUNTESTFLAGS="--target_board=native-extended-gdbserver"
>
> So it should be possible to write a test that runs a process with arguments
> containing spaces. However, it's not currently possible with the testsuite
> to pass arguments to a test program using the native-gdbserver board. These
> arguments would have to be forwarded all the way to gdbserver's command line,
> exactly like when you start gdbserver by hand. This will require a bit of
> testsuite refactoring, I'll try to look into it.
>
> With native-extended-gdbserver, the args could be passed to the `run` command,
> just like the native debugging case. It's by playing with this that I noticed
> gdbserver crashing with this patchset applied when trying to remotely run a
> process with arguments.
>
> Simon

Hi Michael,

Can you please check the patches I proposed for such a test?

https://sourceware.org/pipermail/gdb-patches/2020-May/168262.html
https://sourceware.org/pipermail/gdb-patches/2020-May/168263.html

Your fix should make this work:

make check TESTS="gdb.base/inferior-args.exp" RUNTESTFLAGS="--target_board=native-gdbserver"

But these two should work as well:

make check TESTS="gdb.base/inferior-args.exp" RUNTESTFLAGS="--target_board=unix"
make check TESTS="gdb.base/inferior-args.exp" RUNTESTFLAGS="--target_board=native-extended-gdbserver"

Simon