I am trying to detect whether my process is being run in a debugger or not and, while in Windows there are many solutions and in Linux I use:
ptrace(PTRACE_ME,0,0,0)
and check its return value, I did not manage to perform the same basic check on Mac OS X. I tried to use the
ptrace(PT_TRACE_ME,0,0,0)
call but it always returns 0 even when run under gdb.
If I change the request to PT_DENY_ATTACH
it correctly stops the debugging but that is not what I want to achieve. Any ideas?