c++ - GDB 找不到源文件

标签 c++ c linux debugging gdb

我将 GDB 与“Open On-Chip Debugger”项目一起使用,以调试远程 MIP 目标的交叉编译项目,但出于某种原因,GDB 无法找到源文件。

这里我在目标 elf 文件上调用 GDB。

development@ubuntu:~/vitessesdk/CEServices/build$ mipsel-vtss-elf-gdb obj/CEServices.elf
GNU gdb (crosstool-NG 1.20.0 - vtss-eCos-toolchain-v2) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_unknown-linux-gnu --target=mipsel-vtss-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:
For help, type "help".
Type "apropos word" to search for commands related to "word"...
****Reading symbols from obj/CEServices.elf...done.****
(gdb)

此时我输入目标远程命令进行连接

(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0xa0000000 in ?? ()
(gdb) step

找不到当前函数的边界

(gdb) list
78  /home/development/vitesseSDK/CEServices/build/../third_party/eCos/packages/language/c/libc/startup/current/src/main.cxx: No such file or directory.
(gdb) 

我将列出目录和文件。

development@ubuntu:~/vitessesdk/CEServices/build$ ls ../third_party/eCos/packages/language/c/libc/startup/current/src/main.cxx
../third_party/eCos/packages/language/c/libc/startup/current/src/main.cxx
development@ubuntu:~/vitessesdk/CEServices/build$

关于为什么会发生这种情况有什么想法吗?

最佳答案

阅读 GDB documentation 中有关源路径的部分.您需要使用 dir 命令,例如:

(gdb) dir path/to/sources

关于c++ - GDB 找不到源文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31035124/

相关文章:

linux - 在 RHEL7.4 上合并(SUM)来自 4 个文件的数据

linux - 在unix中运行expect时出错

c++ - 通过快捷方式启动程序时 WM_SETICON 不起作用

c++ - fgetwc EOF 循环测试失败,但 65535 OK

c++ - 将 `bool` 添加到 `float`

c - 为什么 Ken Thompson 在 "Reflections on Trusting Trust"中提到的 C quine 不起作用?

命名空间和包含文件的 C++ 链接错误

c - C语言二维数组

c - 如何将测量值发送到服务器并同时从传感器接收数据?

linux - 每 2 秒检查一次目录内容,如果 bash 中存在某个文件,则复制其内容