2016-10-31 79 views
1

我有一个原本应该在Android设备上运行的C++应用程序。应用程序在启动时崩溃,很可能在从链接库调用函数时崩溃。我正在尝试使用gdb进行调试,但我无法成功。在Android上使用GDB调试本机应用程序

我开始在Android设备上gdbserver的一些随机选取的端口(2000)上:

[email protected]: gdbserver :2000 my_app 
Process my_app created; pid = 3420 
Listening on port 2000 

现在我要附加到这个过程,得到了GDB我的主机系统(Windows 7)在Android-NDK中。

C:\> gdb 
(gdb) attach 3420 
Can't attach to process. 
(gdb) target remote :2000 
:2000: The system tried to join a drive to a directory on a joined drive. 

什么问题?

编辑: 此前运行GDB我使用亚行转发的端口2000:

adb forward tcp:2000 tcp:2000 

这至少帮助我建立一些沟通,但:

(gdb) target remote :2000 
Remote debugging using :2000 
warning: Architecture rejected target-supplied description 
Remote 'g' packet reply is too long: 00000000000000000000000000000... 

在设备方:

Listening on port 2000 
Remote debugging from host 127.0.0.1 
readchar: Got EOF 
Remote side has terminated connection. GDBserver will reopen the connection. 
Listening on port 2000 

回答

0

你很可能使用不同的架构/版本的gdb。当您启动GDB,它会显示一条线一样(我显示我什么GDB显示):

这GDB被配置为“主机= x86_64的Linux的GNU的 --target =手臂Linux的-roid“

检查这是否与您的手机的体系结构相匹配。
下载正确的GDB版本可能会解决您的问题。