Re: gdb/ptrace problem

Mike Coleman (mkc@mathdogs.com)
04 Jun 2001 22:39:21 -0500


Stanislav Malyshev <stas@zend.com> writes:
> Since installing 2.2.19, I have the following problem: each time I try to
> attach to a running program with gdb, the result is:
>
> ptrace: Operation not permitted.
>
> and attaching fails. No problem with 2.2.18. Have I missed something? Any
> advice on how this can be fixed?
>
> gdb version:
> GNU gdb 5.0
> Copyright 2000 Free Software Foundation, Inc.

I did a cursory look throught the 18->19 patch and didn't see anything obvious
that could be causing this. Are you talking about an i386 box? Are you
running any other special patches on it?

You could try running gdb itself under strace. Perhaps this will show some
info on exactly how this ptrace call is failing.

The EPERM would suggest that gdb doesn't have permission to attach. You can't
attach to setuid/setgid processes unless you're root. Otherwise, you can
generally attach to processes you're allowed to send signals to (unless
something has changed). So you could try running gdb as root as see if you
can attach then. Or, you could try doing a 'kill -STOP' on the process
instead of attaching to it. Does it work?

Also, check for operator error. :-)

--Mike

-- 
Mike Coleman, mkc@mathdogs.com
  http://www.mathdogs.com -- problem solving, expert software development
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/