我尝试使用gdb和gdbserver远程调试程序 . 我使用ssh登录远程PC并运行 gdbserver --multi :4444 在我的本地,我使用 /path/init 命令 /path/init ,其中 /path/init 文件的内容是:

symbol-file /home/username/workspace/piCCompileProj/Debug/main
target extended-remote 192.168.0.100:4444
set remote exec-file /home/username/cppSandbox/main

如果我尝试使用 (gdb) b 6 设置断点,gdb将输出错误:

无法访问地址0x86c8的内存

如果我输入 file /home/username/workspace/piCCompileProj/Debug/main 然后输入 run ,则输出为:

启动程序:/ home / username / workspace / piCCompileProj / Debug / main程序接收信号SIGSEGV,分段故障 . 0x76fe6c00在?? ?? ()来自/home/username/pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/libc/lib/ld-linux-armhf.so.3

如何在gdb和debug中加载符号?