【发布时间】:2016-10-31 09:05:12
【问题描述】:
我有一个本机 C++ 应用程序,它应该在 Android 设备上运行。应用程序在启动时崩溃,很可能是从链接库调用函数时。我正在尝试使用 gdb 对其进行调试,但我无法成功。
我正在 Android 设备上的某个任意选择的端口 (2000) 上启动 gdbserver:
shell@msm8996: gdbserver :2000 my_app
Process my_app created; pid = 3420
Listening on port 2000
现在我正在尝试使用 Android-NDK 中提供的 gdb 在我的主机系统 (Windows 7) 上附加此进程。
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 之前,我使用 adb 转发了端口 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
【问题讨论】: