I am trying to detect whether my executable is running in a debugger. Here is a solution using ptrace
.
My problem is that even if my executable is stripped (strip a.out
) I am able to find with gdb the following code snippet:
0x00000000004007e9: mov $0x0,%ecx
0x00000000004007ee: mov $0x1,%edx
0x00000000004007f3: mov $0x0,%esi
0x00000000004007f8: mov $0x0,%edi
0x00000000004007fd: mov $0x0,%eax
0x0000000000400802: callq 0x4006d0 <ptrace@plt>
0x0000000000400807: cmp $0xffffffffffffffff,%rax
I simply run (gdb)info files
, and disassembled the memory location belonging to .text
.
Is there a way to get rid from <ptrace@plt>
, or is there a better way to detect the debugger beside the methods based on software breakpoints or execution time measuring?