Re: Trouble with ptrace

2009-01-20 Thread wind_cheng



Timo Juhani Lindfors wrote:
> 
> Bilal Mehdi  writes:
>> Please tell me if you know how to use ptrace for arm architecture
>> ... and if you know any other way to use ptrace ... please tell
> 
> Don't use PEEKUSER. use PTRACE_GETREGS.
> 
> apt-get source strace
> 
> shows that it does
> 
> #elif defined (ARM)
> /*
>  * Read complete register set in one go.
>  */
> if (ptrace(PTRACE_GETREGS, pid, NULL, (void *)®s) == -1)
> return -1;
> 
> 
> ___
> support mailing list
> support@lists.openmoko.org
> https://lists.openmoko.org/mailman/listinfo/support
> 
> 
I want to know system call number, after your method, I print
regs.ARM_ORIG_r0. it's 0
and i find out none of them is the right one.
i make a system call execve, it's system call number is 11, but none of the
regs is 11.
Please tell me how should i do to get system call number .

my code is as follow:
int main()
{
pid_t child;
struct pt_regs reg;
child = fork();
if (child == 0){
ptrace(PTRACE_TRACEME, 0, NULL, NULL);
execl("/bin/ls", "ls", NULL);
}
else {
wait(NULL);
if (ptrace(PTRACE_GETREGS, child, NULL, ®) == -1)
printf("get regs failed\n");
printf("The child make a system call %ld\n", reg.ARM_ORIG_r0);
ptrace(PTRACE_CONT, child, NULL, NULL);
}
return 0;
}
-- 
View this message in context: 
http://n2.nabble.com/Trouble-with-ptrace-tp2162549p2185686.html
Sent from the Openmoko Support mailing list archive at Nabble.com.


___
support mailing list
support@lists.openmoko.org
https://lists.openmoko.org/mailman/listinfo/support


Re: Trouble with ptrace

2009-01-20 Thread wind_cheng

Thanks a lot! :handshake:

> Just curious, why are you trying to reimplement this?

I'm a newbie. 
i am playing with ptrace these days, and it works on my FC8, but it do not
fit ARM.
So ..




-- 
View this message in context: 
http://n2.nabble.com/Trouble-with-ptrace-tp2162549p2186072.html
Sent from the Openmoko Support mailing list archive at Nabble.com.


___
support mailing list
support@lists.openmoko.org
https://lists.openmoko.org/mailman/listinfo/support