2002-09-10 17:56:44

by Frank Peters

[permalink] [raw]
Subject: ptrace probs?

Kernel: 2.4.18

If I ptrace-Attach to some program I cannot immediately peek values!
( I can but they are all 0) if I insert a sleep(1) after the ATTACH
it works?

Can somebody explain?

Frank



2002-09-10 18:18:17

by Daniel Jacobowitz

[permalink] [raw]
Subject: Re: ptrace probs?

On Tue, Sep 10, 2002 at 07:54:46PM +0100, Frank Peters wrote:
> Kernel: 2.4.18
>
> If I ptrace-Attach to some program I cannot immediately peek values!
> ( I can but they are all 0) if I insert a sleep(1) after the ATTACH
> it works?
>
> Can somebody explain?

I don't see any problems here... can you post test code, showing
exactly where something goes wrong?

--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer

2002-09-10 20:36:29

by Daniel Jacobowitz

[permalink] [raw]
Subject: Re: ptrace probs?

On Tue, Sep 10, 2002 at 10:31:00PM +0100, Frank Peters wrote:
> Kernel: 2.4.18
> maybe it's a glibc prob.

Try waitpid (PID, &status, 0) first. You can't do anything until the
process stops, that's normal.


--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer