User Tools

Site Tools


android:gdb-debug

Android上如何用arm-eabi-gdb调试程序

1.安装gdbserver到模拟器

 adb push gdbserver /system/bin
 或者
 adb push gdbserver /data/
 adb shell chmod 777 /data/gdbserver

2.运行gdbserver

adb shell
cd /data
gdbserver 10.0.2.2:1234 /data/hello
或者gdbserver :1234 /data/hello

其中hello是需要調試的程序

3.用telnet設置端口轉發

telnet localhost 5554
redir add tcp:1234:1234

4. arm-eabi-gdb 調試程序

arm-eabi-gdb hello
(gdb) r
Starting program:  
Don't know how to run.  Try "help target".
(gdb) target remote localhost:1234

之後連接上了就和一般的gdb調試一樣了。

ndk-gdb调试

添加Symbols命令:

add-symbol-file /cygdrive/d/workspace/DDTui/libs/armeabi/libslpi.so
/var/www/dokuwiki/wiki/data/pages/android/gdb-debug.txt · Last modified: 2016/05/05 13:07 by 127.0.0.1