lkml.org 
[lkml]   [2000]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: ptrace : newbie problem
From
Date
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/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.028 / U:1.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site