一、gdb ./test的方法进行调试
- 在开发环境中编译应用程序
首先需要解压t113源码,并进行配置和编译,然后我们去out路径下找其所需要使用的交叉编译链
/home/forlinx/work/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/bin/arm-linux-gnueabi-gcc
编译要调试的应用程序:必须要加-g 选项
forlinx@ubuntu:~# /home/forlinx/work/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/bin/arm-linux-gnueabi-gcc -g test1.c -o test1
将编译好的程序拷贝到开发板上
2.设置开发板IP和端口号
root@ok113i:~# ifconfig eth0 172.16.0.155
root@ok113i:/usr/bin# gdbserver 172.16.0.155:6666 test1
3.给虚拟机设置同网段IP并保证可以ping通开发板IP ping 172.16.0.155
4.调试
在开发环境中执行如下命令
/home/forlinx/work/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/bin/arm-linux-gnueabi-gdb test1
此时可能会出现报错,报错信息为:
error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file
如出现该报错:请执行如下指令(报错原因是开发环境中缺少libpython2.7这个库)
apt-get install libpython2.7
sudo apt-get install libatlas3-base
执行成功后继续执行上方调试指令 开发环境中进入gdb后执行target remote 172.16.0.155:6666 然后去串口终端查看现象,可以接收到remote debugging from host 172.16.0.156字眼证明链接成功 接下来我们就可以使用gdb去进行调试了。 相关qdb命令: (gdb) l
(gdb) b 35
(gdb) c
(gdb) n
|