How to debug c++ library by gdbserver.
1. get and build cupcake
Any issues, please refer sources.android.com
2. make you library debugable (add -g options in makefile)
modify your Android.mk 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
exit
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 10.0.2.2:1234 --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 :)