Timo Juhani Lindfors wrote:
> 
> Bilal Mehdi <bilal.me...@yahoo.com> 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 *)&regs) == -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, &reg) == -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

Reply via email to