【发布时间】:2014-12-05 17:08:19
【问题描述】:
软件:官方 TI android 版本(源代码包),用于 AM335x 的 Jelly bean 4.2.2,(是的,arago/rowboat/TI 开发人员添加了对 vanilla aosp 的修改,但与我的问题无关。)
硬件:am335xevm_sk(基于 AM335x Cortex A8 SOC 的 TI 开发板)
我做什么:
构建系统并使用 sd 卡启动硬件。一切正常。
adb 拉取 init.am335xevm.rc 文件,注释掉 rild 服务并将其推回,重启目标系统。我这样做是因为我想使用交叉调试器来远程调试 rild。
-
设置远程调试:adb forward tcp ports。并在目标系统上启动 gdbserver,如下:
root@android:/ # gdbserver localhost:2345 system/bin/rild Process system/bin/rild created; pid = 829 Listening on port 2345 Remote debugging from host 127.0.0.1 -
远程调试,如:
ma@ma-aspire:~/devkit/JB422$ PATH=$PATH:/home/ma/devkit/JB422/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin ma@ma-aspire:~/devkit/JB422$ arm-linux-androideabi-gdb GNU gdb (GDB) 7.3.1-gg2 Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-linux-gnu --target=arm-linux-android". For bug reporting instructions, please see: <xxxx://www.gnu.org/software/gdb/bugs/>. (gdb) file /home/ma/devkit/JB422/out/target/product/am335xevm_sk/symbols/system/bin/rild Reading symbols from /home/ma/devkit/JB422/out/target/product/am335xevm_sk/symbols/system/bin/rild...done. (gdb) set sysroot /home/ma/devkit/JB422/out/target/product/am335xevm_sk/symbols (gdb) target remote localhost:2345 Remote debugging using localhost:2345 __dl__start () at bionic/linker/arch/arm/begin.S:35 35 mov r0, sp (gdb) n 36 mov r1, #0 (gdb) n 37 bl __linker_init (gdb) n Program received signal SIGILL, Illegal instruction. 0x4013a89e in __linker_init (elfdata=0xbee7bae0) at bionic/linker/linker.cpp:2030 2030 extern "C" unsigned __linker_init(unsigned **elfdata) { (gdb) c Continuing. Program terminated with signal SIGILL, Illegal instruction. The program no longer exists. (gdb)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
我对低级工具链问题不是很熟悉。我用谷歌搜索了这个问题,似乎很少有人遇到同样的问题。
我下载了aosp源码(Android 4.2.2_r1,JDQ39),对比了预建的工具链和NDK内容,没有发现明显的差异。
我还尝试了最新的 NDK (r10b)。使用NDK中预建的工具链重建整个目标系统并进行调试,结果是一样的。
我也尝试生成平台设置为android-17和android-18的独立工具链,并重复上述步骤,结果相同。
我也尝试重新构建 NDK 工具链,没有任何区别。
我还尝试了更新版本的 gdbserver(在 NDK r10b 包中预建),问题仍然存在。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
但是如果我使用 NDK 工具链来调试一个简单的 hello-world 程序(动态链接 liblog),如本页所建议的:
www dot srombauts dot fr/2011/03/06/standalone-toolchain/
并进行调试,我可以进入 main(),但是在程序退出后,目标系统上的进程得到了类似的 SIGILL 终止,而不是正常退出。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
我很困惑为什么会出现这种情况,因为许多开发人员使用 gdb 来调试本机代码,而 google 的平台开发人员也应该严重依赖 gdb 调试。问题似乎不太可能是由 gdb 或 gdbserver 中的错误引起的。也许它与 am335x 内核相关且特定于 am335x 内核?或者我错过了使用 gdb 的重要内容?比如说,目标架构选项?或者应该为这种本机调试指定某些编译器选项?我仔细阅读了很多关于android本地远程调试的在线文章,没有发现任何特别指出的内容。
我真的很想使用远程 GDB 来调试一些本机程序,包括 ril 和其他一些包装 HAL 库的测试用例。请帮忙!
【问题讨论】:
标签: android native remote-debugging