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 :)
Wednesday, April 15, 2009
Subscribe to:
Post Comments (Atom)
what is the path to Android.mk? I found so many Android.mk files.
ReplyDeleteActual 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.
ReplyDeleteAndroid app developer
"LOCAL_CFLAGS += -G" doesn't work. It should be "LOCAL_CFLAGS += -g"
ReplyDeleteI appreciate very much the effort you put into your writting style, keep up the good work! go home
ReplyDeleteThe 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.
ReplyDeleteRocket Droid pc