Monday, April 20, 2009

How to use jdb on anroid

1. redirect port
adb forward tcp:8000 jdwp: your pid
2. start jdb
jdb -attach localhost:8000
3. set class path
use ~/android/frameworks/base/core/java
4. set breakpoints
stop in android.inputmethodservice.InputMethodService.doStartInput
5. happy debuging :)

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 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 :)

Tuesday, April 14, 2009

SDL init failure

after make sdk
make sdk
android create avd --name jove --target 1
after I execute"./emulator @jove", it reports errors: SDL init failure, reason is: No available video device
I resolve it by
$ export DISPLAY=:0
./emulator @jove