sync: что-то химичу с точками останова
This commit is contained in:
@ -14,4 +14,4 @@ testee.o: testee.asm
|
||||
nasm -felf64 $^ -o $@ -g
|
||||
|
||||
clean:
|
||||
rm *.o test *.gch
|
||||
rm *.o test *.gch testee
|
||||
|
||||
@ -11,6 +11,28 @@
|
||||
int stats;
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
void print_rax(pid_t pid)
|
||||
{
|
||||
ptrace(PTRACE_GETREGS, pid, DONT_CARE, ®s);
|
||||
printf("rax = %llu\n", regs.rax);
|
||||
return;
|
||||
}
|
||||
|
||||
void step(pid_t pid)
|
||||
{
|
||||
ptrace(PTRACE_SINGLESTEP, pid, DONT_CARE, DONT_CARE);
|
||||
return;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("procces is run ");
|
||||
@ -25,15 +47,18 @@ int main()
|
||||
}
|
||||
else if(pid > 0)
|
||||
{
|
||||
char buff;
|
||||
printf(" -- parrent\n");
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
continue_execution(pid);
|
||||
do {
|
||||
waitpid(pid, &stats, 0);
|
||||
printf("____PARENT_STAT: %d____\n", stats);
|
||||
ptrace(PTRACE_GETREGS, pid, DONT_CARE, ®s);
|
||||
printf("rax = %llu\n", regs.rax);
|
||||
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);
|
||||
printf("____AFTER_TRACE_PARRENT____\n");
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -8,7 +8,11 @@ section .text
|
||||
_start:
|
||||
xor rax, rax,
|
||||
add rax, 1
|
||||
int3
|
||||
add rax, 12
|
||||
;int3
|
||||
mov rax, 33
|
||||
;int3
|
||||
|
||||
mov rax, 1
|
||||
mov rdi, 1
|
||||
|
||||
Reference in New Issue
Block a user