Re: [PATCH v2] Improve ptrace-error detection on Linux targets

Pedro Alves
2019-09-04T20:35:25Z

On 9/4/19 9:21 PM, Sergio Durigan Junior wrote:
>> or extended-remote + "(gdb) attach" ?
> I'm trying to come up with a way to test this. The only way would be to
> make gdbserver successfully start so that we could perform an
> extended-remote connection from GDB. However, if gdbserver starts
> without problems, this means that the ptrace check succeeded and that
> there are no ptrace restrictions in place. Therefore, an "attach" would
> succeed as well. Which means that even if we're running GDB in a
> ptrace-restricted system, things will go OK as long as gdbserver is not
> restricted. In this case, we wouldn't see any error messages IIUC.

So

$ gdbserver --multi :9999

exits with error immediately?

You could start gdbserver with the restrictions off (like a long
lived daemon), and then while gdbserver is running enable
restrictions, I suppose.

Thanks,
Pedro Alves