strace 移植到 arm

#!/bin/bash
#对于arm平台要打下边的补丁syscall.c
#download source from http://sourceforge.net/projects/strace/files/strace/4.6/
./configure --host=arm-linux CC=arm-none-linux-gnueabi-gcc LD=arm-none-linux-gnueabi-ld
make CFLAGS+="-static"
arm-none-linux-gnueabi-strip strace

strace工具是一个非常强大的工具,是调试程序的好工具。要移植到arm平台,就需要使用交叉编译工具编译生成静态链接的可执行文件。具体步骤如下:




strace的使用介绍可以参考以下两篇文章:
1.http://www.ibm.com/developerworks/cn/aix/library/au-unix-strace.html。
2.http://blog.chinaunix.net/u1/38279/showart_367248.html


 

--- strace-4.5.16-orig/syscall.c    2005-06-08 21:45:28.000000000+0100
+++ strace-4.5.16/syscall.c    2005-10-25 19:26:39.000000000+0100
@@ -1045,6 +1045,15 @@ struct tcb *tcp;
         /*
          * Note: we only deal with only 32-bit CPUs here.
          */

+
+        if(!(tcp->flags& TCB_INSYSCALL)&&
+         (tcp->flags& TCB_WAITEXECVE)){
+            /* caught a fake syscall from the execve's exit */
+            tcp->flags&= ~TCB_WAITEXECVE;
+            return 0;
+        }
+
+
         if (regs.ARM_cpsr & 0x20) {
             /*
              * Get the Thumb-mode system call number    

 


你可能感兴趣的:(arm)