Mobile/Fennec/Android/GDB

From MozillaWiki
< Mobile‎ | Fennec‎ | Android
Revision as of 07:28, 8 August 2011 by Nchen (talk | contribs)
Jump to navigation Jump to search

Building custom gdb

Building gdb

Get required packages:

sudo apt-get install bison flex libncurses5-dev texinfo python2.7-dev

Get source:

git clone git://github.com/darchons/android-gdb.git

Run configure and make:

mkdir android-gdb-objdir
cd android-gdb-objdir
export prefix=/nonexistent
../android-gdb/configure --target=arm-elf-linux \
  --prefix=$prefix --bindir=$prefix/ --with-separate-debug-dir=$prefix/debug \
  --with-gdb-datadir=$prefix/data --with-system-gdbinit=$prefix/utils/gdbinit \
  --with-python=yes
make -j4

The gdb binary will be located at android-gdb-objdir/gdb/gdb

Building gdbserver

Make sure NDK toolchain is in PATH:

export PATH=$PATH:/PATH/TO/NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin

Run configure and make for gdbserver:

mkdir android-gdbserver-objdir
cd android-gdbserver-objdir
../android-gdb/gdb/gdbserver/configure --host=arm-linux-androideabi \
  --with-sysroot=/PATH/TO/NDK/platforms/android-9/arch-arm
make -j4

The gdbserver binary will be located at android-gdbserver-objdir/gdbserver