1. 编译PC端的gdb (client)关键点是
./configure --host=i686-pc-linux-gnu --target=mipsel-linux --prefix=/usr/local/mips-gdb
这个时候编译器要用x86版本的, 不是用交叉编译器
2. 编译目标板上的程序gdbserver(先进入gdb/gdbserver目录)
./configure --host=mipsel-linux --target=mipsel-linux --prefix=/...
EXPORT CC=.....
EXPORT CPP=.....
.....
3. 目标板上运行gdbserver发现缺少libthread_db.so.1
将交叉编译器lib目录的libthread_db.so.1指向的libthread_db-0.9.27.so拷贝到目标板/lib目标名称用libthread_db.so.1
4. 目标板运行gdbserver PC机IP:端口 程序
PC端运行mipsel-linux-gdb 程序
PC端进入GDB后运行 target remote 目标板IP:端口
5. 在gdb中设置lib库搜索路径到交叉编译器
set solib-search-path /opt/busybox_build/build_mipsel/staging_dir/lib
否则可能出现类似错误:
Error while mapping shared library sections:
......