On Wed, Mar 9, 2022 at 8:28 AM Rob Whitlock <rwhitloc...@gmail.com> wrote:

> I'm trying to attach gdb to an already running cwm but I get the following
> error:
>
> ptrace: Invalid argument.
>
> Why am I getting this error? Also, I have already set kern.global_ptrace=1,
> and both cwm and gdb are being run by the same user. This problem occurs
> both with the gdb in base and the gdb/egdb in ports.
>

Let me guess: the cwm process is an ancestor of the shell where you're
invoking gdb.  We don't permit that as the reparenting done by ptrace()
would create a loop in the process tree, which breaks assumptions by both
kernel and userspace programs.  If that's the case, run gdb from an ssh
session or something like that.

Hmm, I guess I never updated the ptrace(2) manpage to mention that...

Philip Guenther

Reply via email to