1.获取gdbserver
prebuilt/android-arm/gdbserver
2.获取arm-eabi-gdb
prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin
3.启动emulator(即qemu虚拟机,调式linux内核时用到)
$adb remount && adb push gdbserver /system/bin
adb shell
#gdbserver 10.0.2.2:1234 /system/bin/ping
$telnet localhost 5554
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OK
]
KO: unknown command, try 'help'
**cmd**redir add tcp:1234:1234
OK
exit
Connection closed by foreign host.
$cd out/target/product/generic/symbols/system/bin && arm-eabi-gdb ping
(gdb) r
Starting program

本文介绍了如何通过获取gdbserver和arm-eabi-gdb,结合emulator(QEMU虚拟机)来调试Android设备上的C/C++程序。步骤包括将gdbserver推送到设备,启动telnet连接,设置端口重定向,然后在本地使用arm-eabi-gdb进行远程调试。
最低0.47元/天 解锁文章
253

被折叠的 条评论
为什么被折叠?



