免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 22672 | 回复: 7
打印 上一主题 下一主题

Valgrind 如何在arm上使用 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-06-27 14:11 |只看该作者 |倒序浏览
程序在arm上跑,但有内存泄漏,由于工程有些大,单纯查代码很难找到,于是想用Valgrind 来查找内存在哪里泄漏的。
但问题是在Linux上编译Valgrind 的时候提示 no arm。
Valgrind 使用的是3.6.1,虚拟机安装的Linux系统的是2.6.23
在Valgrind 目录执行./configure --host=arm-linux ,提示以下错误

[root@localhost valgrind-3.6.1]# ./configure --host=arm-linux
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-strip... arm-linux-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether ln -s works... yes
checking for arm-linux-gcc... arm-linux-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-gcc accepts -g... yes
checking for arm-linux-gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of arm-linux-gcc... gcc3
checking whether arm-linux-gcc and cc understand -c and -o together... yes
checking how to run the C preprocessor... arm-linux-gcc -E
checking for arm-linux-g++... arm-linux-g++
checking whether we are using the GNU C++ compiler... yes
checking whether arm-linux-g++ accepts -g... yes
checking dependency style of arm-linux-g++... gcc3
checking for arm-linux-ranlib... arm-linux-ranlib
checking for a sed that does not truncate output... /bin/sed
checking for ar... /usr/bin/ar
checking for perl... /usr/bin/perl
checking for gdb... /usr/bin/gdb
checking dependency style of arm-linux-gcc... gcc3
checking for diff -u... yes
checking for a supported version of gcc... ok (4.1.2)
checking build system type... arm-unknown-none
checking host system type... arm-unknown-linux-gnu
checking for a supported CPU... no (arm)
configure: error: Unsupported host architecture. Sorry
[root@localhost valgrind-3.6.1]#

是否有哪位大牛用过valgrind在arm上检测内存泄漏,改如何生成这个程序呢,求解。

论坛徽章:
0
2 [报告]
发表于 2011-06-27 15:57 |只看该作者
who can help me?

论坛徽章:
0
3 [报告]
发表于 2011-06-27 16:02 |只看该作者
交叉编译总会遇到这样那样的问题是需要手动去调整和修改的
像楼主这个问题只需要调整configure脚本就可以了
具体应该在检查host_os变量里加入匹配arm条件就行了,如原有的armv7*)改成armv7*|arm)

论坛徽章:
0
4 [报告]
发表于 2011-07-20 11:33 |只看该作者
感谢楼上的好人!

论坛徽章:
0
5 [报告]
发表于 2011-08-03 10:58 |只看该作者
valgrind移植是怎么弄的 方便透漏吗?我查了很多资料都没看到,请问你们是从哪里查到的资料 能告诉我吗

论坛徽章:
0
6 [报告]
发表于 2011-10-13 15:17 |只看该作者
本帖最后由 bxfqing 于 2011-10-13 15:19 编辑
  1. case "${host_cpu}" in
  2.      i?86)
  3.     { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (${host_cpu})" >&5
  4. $as_echo "ok (${host_cpu})" >&6; }
  5.         ARCH_MAX="x86"
  6.         ;;   

  7.      x86_64)
  8.         { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (${host_cpu})" >&5
  9. $as_echo "ok (${host_cpu})" >&6; }
  10.         ARCH_MAX="amd64"
  11.         ;;   

  12.      powerpc64)
  13.         # This value can only happen on Linux, not on AIX
  14.         { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (${host_cpu})" >&5
  15. $as_echo "ok (${host_cpu})" >&6; }
  16.         ARCH_MAX="ppc64"
  17.         ;;   

  18.      powerpc)
  19.         # Complexity.  'powerpc' on AIX implies a 64-bit capable CPU.
  20.         # Whereas in Linux that means only a 32-bit capable CPU.
  21.         { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (${host_cpu})" >&5
  22. $as_echo "ok (${host_cpu})" >&6; }
  23.     case "${host_os}" in
  24.        aix5.*)
  25.           ARCH_MAX="ppc64"
  26.               ;;   
  27.            *)   
  28.               ARCH_MAX="ppc32"
  29.               ;;   
  30.         esac  
  31.         ;;   

  32.      armv7*|arm*)
  33.     { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (${host_cpu})" >&5
  34. $as_echo "ok (${host_cpu})" >&6; }
  35.     ARCH_MAX="arm"
  36.     ;;

  37.      *)
  38.     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (${host_cpu})" >&5
  39. $as_echo "no (${host_cpu})" >&6; }
  40.     as_fn_error "Unsupported host architecture. Sorry" "$LINENO" 5
  41.     ;;
  42. esac
复制代码

论坛徽章:
0
7 [报告]
发表于 2011-10-28 16:31 |只看该作者
这样搞还是不行

论坛徽章:
0
8 [报告]
发表于 2013-08-20 15:27 |只看该作者
按上面的修改configure文件。肯定可以匹配arm目标平台的armv7*|arm)
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP