C++ 在zynq zc702上使用gdbserver进行GDB远程调试:未列出正确的源代码
我试图使用gdbserver进行GDB远程调试,但无法使调试器在处中断并列出正确的源代码。我不确定我可能做错了什么,所以我写下了我所做的一切。两周前我刚刚开始使用linux和所有这些东西C++ 在zynq zc702上使用gdbserver进行GDB远程调试:未列出正确的源代码,c++,linux,gdb,remote-debugging,gdbserver,C++,Linux,Gdb,Remote Debugging,Gdbserver,我试图使用gdbserver进行GDB远程调试,但无法使调试器在处中断并列出正确的源代码。我不确定我可能做错了什么,所以我写下了我所做的一切。两周前我刚刚开始使用linux和所有这些东西 GDB的主机系统正在我基于windows 7的笔记本电脑上使用virtualbox运行Debian 运行gdbserver的远程目标是使用Debian的xilinx zynq zc702 目标代码是使用CodeSoucery编译器arm none linux gnueabi gcc编译的,相应地,我使用的GDB
root@zynq:/path/on/target# gdbserver localhost:3278 my_app.elf
Process my_app.elf created; pid = 2083
Listening on port 3278
b51957@B51957debian:~$ arm-none-linux-gnueabi-gdb /path/on/host/my_app.elf
target remote *target IP address*:3278
(gdb) break main.cpp:23
root@zynq:/path/on/target# gdbserver localhost:3278 my_app.elf
Process my_app.elf created; pid = 2083
Listening on port 3278
b51957@B51957debian:~$ arm-none-linux-gnueabi-gdb /path/on/host/my_app.elf
target remote *target IP address*:3278
(gdb) break main.cpp:23
GDB在没有任何警告的情况下正常启动,并显示此行:
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi".
在主机终端中,我得到以下响应:
Remote debugging using *target IP address*:3278
Reading symbols from remote:/lib/ld-linux.so.3...(no debugging symbols found)...done.
Loaded symbols for remote:/lib/ld-linux.so.3
Remote debugging from host *host IP address*
在目标终端,我得到以下响应:
Remote debugging using *target IP address*:3278
Reading symbols from remote:/lib/ld-linux.so.3...(no debugging symbols found)...done.
Loaded symbols for remote:/lib/ld-linux.so.3
Remote debugging from host *host IP address*
root@zynq:/path/on/target# gdbserver localhost:3278 my_app.elf
Process my_app.elf created; pid = 2083
Listening on port 3278
b51957@B51957debian:~$ arm-none-linux-gnueabi-gdb /path/on/host/my_app.elf
target remote *target IP address*:3278
(gdb) break main.cpp:23
(gdb) c
Continuing.
Breakpoint 1, 0x00009bdc in main ()
(gdb) l
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
等等-g
和-o0
选项进行编译,也在使用链接器的-g
选项。我还尝试使用“directory”命令将包含源文件的文件夹添加到GDB源路径。源路径已包含$cwd
和$cdir
。我不明白为什么我仍然无法看到我的源代码。使用backtrace“bt”命令查看当前执行的位置。另外,将telnet/ssh导入目标并检查/proc/pid/maps和相关文件,以查看在您所在的地址上实际加载了什么-是程序中的代码,还是库中的代码?