Enable NDK debug on Eclipse , Ubuntu

Summary

  • Push compiled binary to phone via adb push
    push gdb server to phone
    on phone: run gdb server with given TCP port

    on unbuntu: set TCP port forwarding
    on eclipse: set debug configuration to use TCP connection.

  • Details:

  • Push compiled binary to phone via adb push
    push gdb server to phone
    adb shell push $ANDROID_NDK_ROOT/prebuilt/android-arm/gdbserver/gdbserver /data
    Push compiled binary to phone via adb push

    adb push /home/victor/workspace/xxx/obj/local/armeabi/testPcap /data/app
    on phone: run gdb server with given TCP port
    adb shell
    On phone: /data/gdbserver :5039 /data/app/testPcap

    on unbuntu: set TCP port forwarding 在本地把本地TCP端口forward到设备的TCP端口

    adb forward tcp:5039 tcp:5039

    on eclipse: set debug configuration to use TCP connection.


  • Eclipse 设置调试
    程序为 /home/victor/workspace/xxx/obj/local/armeabi/testPcap
    DEBUGER: gdbserver

    gdb debuger: /home/victor/dev/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gdb
    gdb commandline: /home/victor/workspace/xxxx/libs/armeabi/droidsheep
    Connection localhost 5039