获取Android的一个Valgrind的。用`valgrind`的问题寻找`MEMCHECK臂,linux` [英] Getting a valgrind for android. Problems with `valgrind`'s looking for `memcheck-arm-linux`
问题描述
上下文正在开发通过 SH
系统调用使用几个静态可执行二进制代码的Android应用程序。其中一个二进制文件的使用时,三星Galaxy S4手机(但不使用仿真器或索尼Xperia手机TIPO时),所以下面的 http://embetek.blogspot.com.es/2011/10/valgrind-for-arm.html 几个自定义修改(CFLAGS =' - 静态-march =的ARMv7-A),最终得到一个
Context is developing an android app that uses several static executable binaries through sh
syscall. One of the binaries eventually segfaults when using a samsung galaxy s4 cellphone (but not when using emulator or a Sony Xperia tipo cellphone), so following http://embetek.blogspot.com.es/2011/10/valgrind-for-arm.html with several custom modifications (CFLAGS='-static -march=armv7-a') end up getting a
$ ldd valgrind
not a dynamic executable
$ file valgrind
valgrind: ELF 32-bit LSB executable, ARM, version 1 (SYSV),
statically linked, for GNU/Linux 3.2.0, not stripped.
加载的目标手机(Android的版本4.2.2内核3.4 ...), $ C>返回false。 Loaded on the target phone (versioned android 4.2.2 kernel 3.4...), 运行 Running 模拟器似乎运行2.6内核...所以有 Emulator seems to run kernel 2.6... so there 现在 Now 即使 Even a execution of 我这个读是 My read of this is that 其他信息(抽象cwds讨好): Additional info (abstract the cwds please): 有谁知道为什么 Does anybody see why 最后 Finally 不要还是有痕迹,但 Don't still have the trace, but 这暗示了 That hinted the 到 您可以看到 You can see 这篇关于获取Android的一个Valgrind的。用`valgrind`的问题寻找`MEMCHECK臂,linux`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!(context.getFilesDir()+文件分割符+的valgrind)。canExecute()$ c。关于
(context.getFilesDir() + File.separator + "valgrind").canExecute()
returns false.上海-c PATH ...的valgrind
告诉的valgrind:不能执行:权限被拒绝
和状态126上的退出。sh -c PATH...valgrind
tells valgrind: can't execute: Permission denied
and status 126 on exit.亚行外壳
并执行的valgrind
有告诉相似的东西,但更多装饰讲述内核版本不匹配:从字面上adb shell
and executing valgrind
there told something similar but more decorated telling about a kernel version mismatch: literallyllostatic/files/valgrind <
FATAL: kernel too old
Segmentation fault
(context.getFilesDir()+文件分割符+的valgrind)。setExecute()
<击>是由不明原因击>已失败,因为失败它并不是在所有的完成(在做类似 dumpAssetToFile(Valgrind的){/ *许多事情燮$ p $这里pssed。* / argument.setExecute()/ *如果做错了没有文件目录路径问* /}
。(context.getFilesDir() + File.separator + "valgrind").setExecute()
is failing by unknown reason was failing because it wasn't being done at all (was doing something like dumpAssetToFile("valgrind"){/* Many things suppressed here. */ argument.setExecute() /* Done wrong without a files dir path ask */}
.的valgrind
似乎是正确的,要求一个 MEMCHECK臂Linux的
,但我并没有使得它承认它。valgrind
seems to be correctly calling for a memcheck-arm-linux
, but I didn't yet made it recognize it.SH -c \\PATH = $ PATH的执行:+ getFilesDir()+文件分割符++ getFilesDir()+文件分割符+busybox的的valgrind strace的 - v+ BINARY ++ ARGS ++2 - ;&放大器; 1 \\
并没有做什么,我的期望。这不正是这算什么得到执行,但我这个输出到标准错误。"sh -c \"PATH=$PATH:" + getFilesDir() + File.separator + " " + getFilesDir() + File.separator + "busybox strace valgrind -v " + BINARY + " " + ARGS + " " + "2>&1\""
does not do what I expect. It is not exactly this what gets executed, but am outputting this to stderr.W/System.err(6918): commandStrArr[0]: sh
W/System.err(6918): commandStrArr[1]: -c
W/System.err(6918): commandStrArr[2]: PATH=$PATH:/data/data/NAMESPACE/files/ busy
box strace valgrind -v /data/data/NAMESPACE/files/BINARY ARGS 2>&1
W/System.err(6918): strace: applet not found
W/System.err(6918): valgrind: failed to start tool 'memcheck' for platform 'arm-l
inux': No such file or directory
W/System.err(6918): Error: BINARY exited with status nonzero (1).
busybox的
无法模拟 strace的
,但作为一个命令和args无论如何都会执行从它认为是的 ARGS [2] 的到的参数视图的结尾。 的valgrind
加载良好,但无法找到 MEMCHECK
。这里的一个背景是 MEMCHECK臂Linux的
是资产'的 ED 的静态二进制与合作的valgrind
和 busybox的
。我能不能够确保 MEMCHECK臂Linux的
的到底是什么要求,如果我不能得到一个系统调用跟踪。恕我直言的这将是一个疑难杂症的不是 MEMCHECK臂Linux的
什么的valgrind
呼吁这里'MEMCHECK'的平台臂Linux的。busybox
can not emulate strace
, but is anyway executing as a command and args from what it thinks as args[2] to the end of its view of arguments. valgrind
is loading well but can not find memcheck
. A context here is memcheck-arm-linux
is an asset' ed static binary dumped to the files directory together with those working valgrind
and busybox
. I can not be able to be sure memcheck-arm-linux
is exactly what is asking for, if I can't get a system calls trace. IMHO It would be a gotcha not being memcheck-arm-linux
what valgrind
is calling here "'memcheck' for platform 'arm-linux'".$ file busybox
busybox: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for
GNU/Linux 3.2.0, stripped
[...]
$ file coregrind/valgrind
coregrind/valgrind: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically
linked, for GNU/Linux 3.2.0, not stripped
[...]
$ file memcheck/memcheck-arm-linux
memcheck/memcheck-arm-linux: ELF 32-bit LSB executable, ARM, version 1 (SYSV), st
atically linked, not stripped
的valgrind
似乎没有被接受 MEMCHECK臂Linux的
为有效 MEMCHECK
工具? valgrind
seems no to be accepting memcheck-arm-linux
as a valid memcheck
tool?推荐答案
strace的
给解决了这个问题。strace
gave solution to this problem. strace的
说的很清楚,的valgrind
打电话 MEMCHECK臂Linux的
带错了路。期待从主机编译器的机器,显然没有在目标机器上存在的一些路径。strace
told very clearly that valgrind
was calling memcheck-arm-linux
with a wrong path. Was looking some path from the host compiler machine that obviously don't exist in the target machine.的valgrind
打造命令应该从valgrind
build command should be changed from$ export CROSS_COMPILE=arm-unknown-linux-gnueabi- && export CC=${CROSS_COMPILE}gc
c && export CPP=${CROSS_COMPILE}cpp && export CXX=${CROSS_COMPILE}g++ && export L
D=${CROSS_COMPILE}ld && export AR=${CROSS_COMPILE}ar && ./configure --target=arm-
unknown-linux-gnueabi --host=armv7a-none-linux-gnueabi --prefix=$HOME/valgrind-3.
6.1/construct CFLAGS='-static -march=armv7-a' -verbose 2>&1 && make clean && make
-j4 && make
$ export CROSS_COMPILE=arm-unknown-linux-gnueabi- && export CC=${CROSS_COMPILE}gc
c && export CPP=${CROSS_COMPILE}cpp && export CXX=${CROSS_COMPILE}g++ && export L
D=${CROSS_COMPILE}ld && export AR=${CROSS_COMPILE}ar && ./configure --target=arm-
unknown-linux-gnueabi --host=armv7a-none-linux-gnueabi --prefix=/data/data/$APK_P
ACKAGE_NAMESPACE/files CFLAGS='-static -march=armv7-a' -verbose 2>&1 && make clea
n && make -j4 && make
- preFIX
现在正确设置为存在于目标设备,而且是有效的路径。硬codeD。脏。丑陋。但是,现在正在工作。--prefix
is now correctly set to a path that exists in the target device, and is valid. Hardcoded. Dirty. Ugly. But is working now.