[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: ptrace problems

On Tue, Feb 29, 2000 at 11:51:26AM +0400, Pramode C.E wrote:
> On Mon, 28 Feb 2000, Shourya Sarcar wrote:
> > Programmerz,
> > This is a little pair of programs I wrote. The father tries to behave
> > like a debugger and get the register values of the child. But I keep on
> > getting incorrect results. Rather no results at all.
> > Help, someone. Anyo
> hello,
> 	i have looked into it a bit more. I think the real solution
> is to call waitpid() after ATTACH (in the parent). When the child is
> stopped, wait returns. After that, you can safely extract the
> register values.

waitpid just waits till a signal is delivered. If it isn't delivered, it
waits till the process exits. The solution is to send SIGSTOP (or any
signal for that matter) which will cause the process to go to TASK_STOPPED.