我有一个段错误,但我完全不知道如何找到它.
I've got a segfault but I have absolutely no idea how to locate it.
提示?
可以使用Android NDK Stacktrace Analyzer.
这些步骤在 wiki 上,但是基本上你需要从 logcat 获取堆栈跟踪到一个文件 (adb logcat > mycrash.log
),然后将你的库转储到一个文本文件,然后在它们两个上运行程序.这是我用来做很多事情的 shell 脚本:
The steps are on the wiki, but basically you need to get the stack trace from logcat into a file (adb logcat > mycrash.log
), then dump your library to a text file, then run the program on the two of them. Here's the shell script I use to do the lot:
#!/bin/sh
if test $# -lt 2 ; then
echo "Extract readable stack trace from Android logcat crash"
echo "Usage $0 lib.so crash.log"
exit 1
fi
of=$(mktemp)
echo "Disassemble $1"
~/tools/android-ndk-r5/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-objdump -S $1 > $of
echo "Parse stack trace in $2"
~/bin/parse_stack.py $of $2
根据需要更改 Android NDK 和 parse_stack.py 文件的路径.
Change the paths to the Android NDK and parse_stack.py file as you need.
这篇关于如何在 Eclipse 中有效地调试用 JNI 包装的 C 代码?(安卓开发)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!