views:

20

answers:

0

Hello ALL,

i am using ptrace() call to walk the Stack on Linux x86_64 a 64 bit m/c. my requirement was to Walk the stack of a Process(ABC) periodically. so i created a separate process which is child of Process(ABC). this Child Process should walk the Stack of its parent after every 1 sec, so both the process should run simultaneously. i am able to walk the stack and read relevant instruction pointers at once. but when i do it in a loop my parent process(ABC) gets Blocked and not getting resumed. the steps i am following in loop are.

1) ptrace_attach(); 2) wait(); 3) ptrace_cont;

4) continuous loop { 5) kill(pid, SIGSTOP) 6) wait(); 7) ptrace(read registers); 8) ptrace(pid , ptrace_cont); 9) sleep() } 10) ptrace_detach();

here the Child Process is executing continuously reading the registers, but the Parent process is blocked and not getting resumed.

Could someone help?

Thanks in Advance. Sandeep