Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1942364
  • 博文数量: 185
  • 博客积分: 10707
  • 博客等级: 上将
  • 技术积分: 1777
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-19 17:31
文章分类

全部博文(185)

文章存档

2014年(1)

2012年(6)

2011年(27)

2010年(13)

2009年(75)

2008年(63)

分类: LINUX

2008-11-22 18:44:06

--------------------------------------------
本文系本站原创,欢迎转载!
转载请注明出处:http://zhiqiang0071.cublog.cn
--------------------------------------------

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

1.下载 strace-4.5.16.tar.bz2,不要下载最新的strace-4.5.18.tar.bz2,因为后者编译会出错。下载网址是:;

2.解压。对于ARM平台,必须打上一个补丁,补丁在文章的最后面;

3.配置。./configure --host=arm-linux CC=arm_v5t_le-gcc LD=arm_v5t_le-ld


4.编译。make CFLAGS+="-static",生成strace静态可执行文件,2M多;

5.strip。arm_v5t_le-stip strace,这样可执行文件就减小到600多K。

以上采用的是达芬奇平台的arm工具,也可以直接使用通用的arm-linux-gcc工具,版本3.4.1的我试过,可以编译通过,其他版本的不清楚。



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    

阅读(3363) | 评论(1) | 转发(2) |
给主人留下些什么吧!~~

chinaunix网友2010-12-07 10:31:45

http://blog.chinaunix.net/u1/38279/showart_367248.html 看不到啊!!!!