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