My code is as follows:
#include <sys/ptrace.h>
#include <stdio.h>
int
main()
{
printf("PTRACE_CONT: %d\n", PTRACE_CONT);
printf("PTRACE_SYSCALL: %d\n", PTRACE_SYSCALL);
printf("PTRACE_SINGLESTEP: %d\n", PTRACE_SINGLESTEP);
printf("PTRACE_SYSEMU: %d\n", PTRACE_SYSEMU);
printf("PTRACE_SYSEMU_SINGLESTEP: %d\n", PTRACE_SYSEMU_SINGLESTEP);
printf("PTRACE_LISTEN: %d\n", PTRACE_LISTEN);
return 0;
}
I'm compiling with the default flags on Ubuntu16.04 (Linux x86_64 4.40-38), with gcc v5.4.0.
This throws an error that PTRACE_SYSEMU
is undeclared. While the man ptrace
page states it exists. This is repeated for PTRACE_SYSEMU_SINGLESTEP
if the line containing PTRACE_SYSEMU
is commented out. Which the man page states PTRACE_SYSEMU_SINGLESTEP
is only available for x86, except a patch was merged to unify the x86 and x64 handling of PTRACE_SYSEMU_SINGLESTEP
in 2008.
This produces the same error on 32bit (well i686), or 64bit (AMD64). Is this distro specific? What is going on?
I can confirm neither of these values are defined are in my /usr/include/x86_64/linux/sys/ptrace.h
. But they are defined in kernel sources?!?