I have a system that uses C methods as functions in a Postgres database. When I try to run gdb with my user account I get this:
ptrace: Operation not permitted
It looks like a permission thing. It seemed to work when I ran gdb as the "postgres" user. I would like to continue running postgres as the "postgres" user and not have to su postgres
when I want to debug. Can I somehow grant my user account "ptrace" permission 开发者_如何学编程for the process in question? Adding myself to the "postgres" group didn't seem to help.
EDIT: I found this on the ptrace man page:
EPERM The specified process cannot be traced. This could be because the parent has insufficient privileges (the required capability is CAP_SYS_PTRACE); non-root processes cannot trace processes that they cannot send signals to or those running set-user- ID/set-group-ID programs, for obvious reasons. Alternatively, the process may already be being traced, or be init(8) (PID 1).
So how can I give CAP_SYS_TRACE privileges to my user?
It seems CAP_SYS_TRACE is controlled by LIDS which may or may not be installed on your computer.
If you are doing heavy development on postgres you might prefer to run an instance of postgres under your own account - this is what I do with a number of servers I work on.
精彩评论