首页 > 技术知识 > 正文

使用场景

在某些资源不足以运行 gdb 本地调试的设备上,可以通过 gdbserver 在PC端进行远程调试

设备端

启动开发板,进行 nfs 连接,进入 nfs 需要调试的程序所在目录,执行 gdbserver 命令,启动 gdbserver,设置端口号 6666,并装载 app 程序

$ mount -t nfs -o nolock ip:/nfs /nfsroot

$ cd /nfsroot/debug/

$ gdbserver :6666 ./app PC端

在主机启动 arm-hisiv400-linux-gdb 程序,并装载 app 程序:

$ cd /nfs/debug/

$ arm-hisiv400-linux-gdb app

$ target remote 192.168.1.12:6666

$ b main

$ c

$ set solib-search-path /nfs/debug

此时,即可在 PC 端进行 gdb 调试

猜你喜欢