gdb cannot exec /bin/sh on android local terminal

 

http://letsgoustc.spaces.live.com/Blog/cns!89AD27DFB5E249BA!943.entry

 

Cross-compile GDB 6.8 for Android

Step1: Download gdb and arm cross-compile toolchain.
The following assumes you extract the arm cross-compile toolchain into /usr/local/arm-2008q3/.
$export PATH=$PATH:/usr/local/arm-2008q3/bin
 
Step2: Download and compile ncurses.
$tar zxvf ncurses-5.7.tar.gz
$cd ncurses-5.7
$./configure --host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi --prefix="$HOME/install"
$sudo cp ~/install/lib/libncurses.a /usr/local/arm-2008q3/arm-none-linux-gnueabi/libc/usr/lib
$sudo cp ~/install/include/ncurses/ /usr/local/arm-2008q3/arm-none-linux-gnueabi/libc/usr/include -rf
This step is to fix the compile warning " configure: error: no termcap library found ". Although GDB complain no termcap, actually it needs libncurses. All we did is to let arm-none-linux-gnueabi toolchain can find the library and header files. The misterious directory is found by:
$arm-none-linux-gnueabi-gcc -print-search-dirs
 
Step3: Configure and Make GDB
$tar zxvf gdb-6.8.tar.gz
$cd gdb-6.8
$./configure --host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi LDFLAGS="-static"
$make
Now you should find gdb and gdbserver. It can run on Android. We must add the above LDFLAGS to let gdb statically linked, otherwise it cannot run on Android.

Step4: Run GDB on board
#export SHELL=/system/bin/sh
#gdb XXX
The SHELL env is set to fix the runtime error "Cannot exec /bin/sh: No such file or directory. ", so that GDB can work now.

你可能感兴趣的:(Terminal)