Messages in this thread | | | Subject | Re: ptrace : newbie problem | From | Mike Coleman <> | Date | 14 Mar 2000 04:04:41 -0600 |
| |
Shourya Sarcar <sarcar@vsnl.com> writes: > The following piece of code gives me and error while doing the ptrace > (PTRACE_PEEKDATA,....) call. Why ? strace shows an EIO error.
> int st,err; > long data[20]; ... > waitpid(cpid,&st,WUNTRACED); > err=ptrace(PTRACE_PEEKDATA,cpid,st,data);
The third arg should be "&st" rather than "st". This is the address that you're peeking, and the value in st is likely nonsense as a pointer. See a recent ptrace(2) for more info.
Note also that the value peeked will show up in 'err' here. The fourth argument is ignored in the PEEKDATA case. This is because of the way the libc wrapper works.
--Mike
-- Any sufficiently adverse technology is indistinguishable from Microsoft.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |