using gdb with android emulator.

One of the biggest challenge ,I face while working on Browser in Android Platform is ‘GDB’. Many time I have to check the stack strace of the call to native function.

Here is one method which make your debugging native easy on android emulator.

1) First of all customize you .gdbinit file, so that till will include the essensial libs at the time you start you gdb.

file out/target/product/generic/symbols/system/bin/app_process
set solib-absolute-prefix out/target/product/generic/symbols
set solib-search-path out/target/product/generic/symbols/system/lib

2) Create a script for lunch arm-gdb  and gdbserver.

echo ‘Usage :bash gdbemu.sh <browser-pid>’
echo ‘———————————————–‘
echo ‘TCP forward done…’
echo adb forward tcp:5039 tcp:5039
adb forward tcp:5039 tcp:5039
echo ‘———————————————–‘
echo adb shell ps | grep browser
VAR=`adb shell ps | grep browser | awk ‘{print $2}’`
echo $VAR
echo ‘Starting gdbserver….’
echo adb shell gdbserver :5039 –attach $VAR &
adb shell gdbserver :5039 –attach $VAR &
echo ‘Starting gdb………..’
./prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gdb

 

Note:- This script working only then you script is in the root folder of the android code.

 

All is set now lunch the emulator , then browser and  run this script. If you feel any problem while setup this enviroment please comment.

 

 

Advertisements
This entry was posted in android, Debugging Native Libary. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s