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.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值