feat: mvp
This commit is contained in:
@ -14,9 +14,7 @@ struct user_regs_struct regs;
|
||||
void continue_execution(pid_t pid)
|
||||
{
|
||||
ptrace(PTRACE_CONT, pid, DONT_CARE, DONT_CARE);
|
||||
int wait_status;
|
||||
int options = 0;
|
||||
waitpid(pid, &wait_status, options);
|
||||
waitpid(pid, &stats, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -30,6 +28,7 @@ void print_rax(pid_t pid)
|
||||
void step(pid_t pid)
|
||||
{
|
||||
ptrace(PTRACE_SINGLESTEP, pid, DONT_CARE, DONT_CARE);
|
||||
waitpid(pid, &stats, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -49,16 +48,18 @@ int main()
|
||||
{
|
||||
char buff;
|
||||
printf(" -- parrent\n");
|
||||
continue_execution(pid); // to start app
|
||||
continue_execution(pid);
|
||||
do {
|
||||
waitpid(pid, &stats, 0);
|
||||
printf("stats - %d", stats);
|
||||
print_rax(pid);
|
||||
ptrace(PTRACE_SINGLESTEP, pid, DONT_CARE, DONT_CARE);
|
||||
printf("enter any: ");
|
||||
read(0, &buff, 1);
|
||||
printf("\n");
|
||||
} while(stats);
|
||||
if (stats & SIGTRAP)
|
||||
{
|
||||
while (stats != 0)
|
||||
{
|
||||
read(0, &buff, 1);
|
||||
print_rax(pid);
|
||||
step(pid);
|
||||
}
|
||||
}
|
||||
|
||||
printf("____AFTER_TRACE_PARRENT____\n");
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user