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

Re: ptrace problems



On Mon, Feb 28, 2000 at 11:05:45PM -0500, 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. Anyone .
> 
> I am giving below the souce codes of the two programs and a typescript
> showing strace debug and the output. Note how strace debug shows weird
> stuff for the second ptrace.
> 

The problem is in this code segment in

arch/i386/kernel/ptrace.c:191

	ret = -ESRCH;
	if (!(child->flags & PF_PTRACED))
		goto out;
	if (child->state != TASK_STOPPED) {
		if (request != PTRACE_KILL)
			goto out;
	}
	if (child->p_pptr != current)
		goto out;

The state of your child is not TASK_STOPPED. You need to stop it first.

	-Arun