Re: [PATCH v2 0/5] Improve ptrace-error detection

Kevin Buettner
2020-03-20T00:53:25Z

Hi Sergio,

I'm still reviewing this patch set, but noticed the following during testing:

< PASS: gdb.base/attach-twice.exp: attach
---
> XFAIL: gdb.base/attach-twice.exp: attach

and:

< PASS: gdb.base/attach.exp: do_attach_failure_tests: fail to attach again
---
> FAIL: gdb.base/attach.exp: do_attach_failure_tests: fail to attach again

For gdb.base/attach-twice.exp, the relevant sections of the log files look
like this:

(gdb) spawn /mesquite2/sourceware-git/f31-ptrace-error-detection/bld/gdb/testsuite/outputs/gdb.base/attach-twice/attach-twice
attach 1113400
Attaching to program: /mesquite2/sourceware-git/f31-ptrace-error-detection/bld/gdb/testsuite/outputs/gdb.base/attach-twice/attach-twice, process 1113400
warning: process 1113400 is already traced by process 1113405
ptrace: Operation not permitted.
(gdb) PASS: gdb.base/attach-twice.exp: attach

Versus:

(gdb) spawn /mesquite2/sourceware-git/f31-ptrace-error-detection/bld/gdb/testsuite/outputs/gdb.base/attach-twice/attach-twice
attach 1113182
Attaching to program: /mesquite2/sourceware-git/f31-ptrace-error-detection/bld/gdb/testsuite/outputs/gdb.base/attach-twice/attach-twice, process 1113182
warning: ptrace: Operation not permitted
process 1113182 is already traced by process 1113187

There might be restrictions preventing ptrace from working. Please see
the appendix "Linux kernel ptrace restrictions" in the GDB documentation
for more details.
If you are debugging the inferior remotely, the ptrace restriction(s) must
be disabled in the target system (e.g., where GDBserver is running).
(gdb) XFAIL: gdb.base/attach-twice.exp: attach

It seems to me that this should still PASS; I think the regex for that
test simply needs to be updated. (You could also add another case.)

I've also looked at the logs for gdb.base/attach.exp. The output is
similar to that shown above. Again, I think that the regex needs to
be updated.

If it's the case that the old output might still be produced by some
platforms, care must be taken to ensure that both cases (still) pass.

Kevin