Wednesday, April 15, 2009

How to use gdbserver on android

How to debug c++ library by gdbserver.

1. get and build cupcake
Any issues, please refer

2. make you library debugable (add -g options in makefile)
modify your add below command "LOCAL_CPPFLAGS += -g" for C++ files and "LOCAL_CFLAGS += -G" FOR C files.
rebuild your library and system image

3. redirect debug port
$ telnet localhost 5554
redir add tcp:1234:1234
current release will fail if you redirect in this step, hope final cupcake will fix it.
you can start emulator by below command with debug port redirected.
./emulator @jove -qemu -redir udp:1234::1234

4. push gdbserver to emulator
adb push ./out/target/product/generic/obj/EXECUTABLES/gdbserver_intermediates/gdbserver /data/local

5. run /data/local/gdbserver --attach your-desired-pid

6. run ./prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-gdb ./out/target/product/generic/symbols/system/bin/app_process
set solib-search-path out/target/product/generic/symbols/system/lib
target remote localhost:1234
b xxx.cpp:xx
7. enjoy debuging and life :)


  1. what is the path to I found so many files.

  2. Actual acceptable and informative article absolutely . It helps me a lot to enhance my knowledge, I absolutely like the way the presented presented his views , a lot of thanks for all your admired assignment on this article.

    Android app developer

  3. "LOCAL_CFLAGS += -G" doesn't work. It should be "LOCAL_CFLAGS += -g"

  4. I appreciate very much the effort you put into your writting style, keep up the good work! go home

  5. The Rocket Droid Pc is a HDMI Android TV Dongle on Steroids! Plug it into your TV and experience the Android UI & Gaming like never before.
    Rocket Droid pc