मैं ट्यूटोरियल here अनुसरण कर रहा हूँ, और (मूल रूप से, Rax को eax की जगह आदि) इतना है कि यह संकलित x86-64
के लिए एक छोटे से संशोधित:x86-64 पर ptrace के साथ कैसे खेलें?
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/user.h>
#include <sys/reg.h>
#include <unistd.h>
int main()
{ pid_t child;
long orig_eax;
child = fork();
if(child == 0) {
ptrace(PTRACE_TRACEME, 0, NULL, NULL);
execl("/bin/ls", "ls", NULL);
}
else {
wait(NULL);
orig_eax = ptrace(PTRACE_PEEKUSER,
child, 4 * ORIG_RAX,
NULL);
printf("The child made a "
"system call %ld\n", orig_eax);
ptrace(PTRACE_CONT, child, NULL, NULL);
}
return 0;
}
लेकिन यह वास्तव में अपेक्षा के अनुरूप काम नहीं करता है, यह हमेशा कहते हैं :
The child made a system call -1
कोड में क्या गलत है?
मुझे समझ नहीं आता तुम क्या मतलब है ... –