Re: [PATCH 3/4] [PR gdbserver/25893]: Use construct_inferior_arguments which handles special chars

Michael Weghorn
2020-05-12T16:10:56Z

On 08/05/2020 00.09, Simon Marchi wrote:
> While trying out stuff to review patch 4, I noticed a crash introduced by this patch.
>
> In one terminal, run gdbserver with:
>
> $ ./gdbserver --once --multi :1234
>
> In another, run GDB with:
>
> $ ./gdb /bin/ls -ex 'set pagination off' -ex 'set remote exec-file /bin/ls' -ex 'target extended-remote :1234' -ex 'run hello'
>
> Doing so segfaults gdbserver for me. Could you look into it?

This is fixed in the next version of the parent commit,
https://sourceware.org/pipermail/gdb-patches/2020-May/168348.html

I had previously missed another instance where a NULL element was passed
into the argument vector.

> The commands above try to run a new process through gdbserver. The args are passed
> to GDB using the remote protocol. You can add -ex 'set debug remote 1' before the run
> part to see the exchanged packets, the args are hex-encoded in the vRun packet.

Thanks, those commands also helped a lot in analyzing the test failures
I experienced with my patch series for the new test you have created.

Michael