在android中生成核心转储
我正在开发一个 Android 的应用程序,使用一些共享的 我编写并使用 ndk-r5b 编译的库。该应用程序有效, y 和对库的调用也有效,但我检测到一些错误, 分段错误,我需要调试它,但是,我不知道如何调试 来自 android 的本机代码,我不知道是否可以生成核心转储, 就像在 Linux 中一样,用于调试我的库。
有什么想法吗?
I'm developping a android's aplication using some shared
libraries written by me and compiled with ndk-r5b. The application works,
y and the calls to the libraries works too, but I detected some errors,
segmentations faults, and I need to debug it, but, I don't know how debug
native code from android and I don't know if I can generate core dumps,
as in linux, for debug my libraries.
Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ndk 附带 ndk-gdb,据称它允许您调试本机应用程序。另外,如果你下载整个andriod开源项目,他们也有一些版本的gdb用于调试。查看 ndk 的 docs/ 文件夹以了解如何使用它。本教程也可能会有所帮助: http://vilimpoc.org/blog/2010/09/23/hello-gdbserver-a-debuggable-jni-example-for-android/
但是,正如我最近提出的一个问题所示:< a href="https://stackoverflow.com/questions/6158953/running-ndk-gdb-with-package-not-found-error-on-motorola-phone">在 motorola 上运行 ndk-gdb 并出现找不到包错误电话我仍然无法让它工作。
编辑:您在评论中说您使用的是三星设备:三星决定对本机调试所需的一些关键内部结构造成严重破坏,但如果您拥有设备的根访问权限,则很容易修复。如果您使用 --verbose 标志,您可能会发现错误与包未知错误不同。这是因为它正在查找 /data/system/packages.list,但三星将该文件重命名为 /dbdata/system/packages.list。因此,如果您在 /data/system/packages.list 中创建指向该文件的符号链接(需要 root 访问权限),它应该可以工作。或者至少 ndk 邮件列表是这样声明的:http://osdir。 com/ml/android-ndk/2011-03/msg00036.html
The ndk comes with ndk-gdb, which supposedly allows you to debug native applications. Also, if you download the whole andriod open source project, they also have some version of gdb used for debugging. Look in the docs/ folder of the ndk to learn about using it. This tutorial might also prove helpful: http://vilimpoc.org/blog/2010/09/23/hello-gdbserver-a-debuggable-jni-example-for-android/
However, as shown in a recent question I asked: Running ndk-gdb with package not found error on motorola phone I still can't get it to work.
Edit: You said in the comments you were using a Samsung Device: Samsung decide to wreck havoc on some of the crucial internals required for native debugging, but it's easily fixable if you have root access to the device. If you use the --verbose flag, you'll probably find that the error is different than that, a package unknown error. That's because it's looking in /data/system/packages.list, but samsung renamed that file to /dbdata/system/packages.list. So if you make a symlink to that file in /data/system/packages.list, (requires root access) it should work. Or at least so claims the ndk mailing list: http://osdir.com/ml/android-ndk/2011-03/msg00036.html
十二年来,我尝试构建和编辑 aosp,我发现了
build/envsetup.sh
文件内容coredump_*
函数。aosp崩溃将在
/cores
上生成核心文件(关于核心文件路径尝试检查 envsetup.sh 代码)我正在使用 aosp_6.0.0_r1
twelve years over , I'm try to build and edit aosp , I found
build/envsetup.sh
file contentcoredump_*
function .aosp crash will generate core file on
/cores
(about core file path try check envsetup.sh code)I'm using aosp_6.0.0_r1