【问题标题】:Debugging with Eclipse CDT and GDB: can't find source file使用 Eclipse CDT 和 GDB 进行调试:找不到源文件
【发布时间】:2012-08-03 11:41:34
【问题描述】:

当我尝试使用来自 eclipse CDT 的 GDB 调试我的应用程序时,我收到以下错误:

 Can't find a source file at "../mingw/main.c"
 Locate the file or edit the source lookup path to include its location.

Eclipse 正在../mingw/main.c 中查找源文件位置,但它应该在/edit/src/main.c 中。正如您在下面的屏幕截图中看到的,edit/src 是源查找路径的一部分。为什么要查看../mingw?我找不到任何使它看起来在那里的配置设置。

我正在使用 eclipse Juno、CDT 8.1、Windows 7 64bit

【问题讨论】:

  • 你找出问题所在了吗?
  • 我也需要找到这个问题的答案。
  • 不,我还是不知道解决办法是什么。

标签: eclipse configuration ide eclipse-cdt


【解决方案1】:

这是你的答案http://www.eclipse.org/forums/index.php/t/57027/

如果您在 Windows 下工作,您是否设置了所需的映射? 也许 Eclipse 找不到源,因为缺少到的映射 您的项目/工作区所在的 (cygwin-)drive。

当您启动 Cygwin 时,输入“mount”并查找您拥有的映射: 它们可能看起来像这样:

Admin@bs11-01xp ~
$ mount
D:\cygwin\bin on /usr/bin type system (binmode)
D:\cygwin\lib on /usr/lib type system (binmode)
D:\cygwin on / type system (binmode)
c: on /cygdrive/c type system (binmode,noumount)
d: on /cygdrive/d type system (binmode,noumount)
e: on /cygdrive/e type system (binmode,noumount)
j: on /cygdrive/j type system (binmode,noumount)
n: on /cygdrive/n type system (binmode,noumount)
u: on /cygdrive/u type system (binmode,noumount)
w: on /cygdrive/w type system (binmode,noumount)
x: on /cygdrive/x type system (binmode,noumount)
y: on /cygdrive/y type system (binmode,noumount)
z: on /cygdrive/z type system (binmode,noumount)

我的项目都在J:\Projects 下,所以我的映射需要存在 在 Eclipse 中为:

/cygdrive/j j:/

打开 Eclipse 然后点击
- Windows => 首选项... => C/C++ => 调试 => 通用源查找 路径
- 添加新的路径映射:单击 [添加] => 路径映射 => [确定]
- 选择新的映射 => [Edith] => 更改映射名称“项目” 来源" => [添加]
- 将“编译路径”设置为源(示例 cygwin!)“/cygdrive/j” (不带引号!)
- 设置“本地文件系统路径”和“J:\”(不带引号!)

现在你准备好再试一次......祝你好运!

【讨论】:

  • 不鼓励仅链接的答案。链接可能会被重新定位/删除。请编辑答案以包括实际步骤(除了链接)。
【解决方案2】:

在调试器选项卡的“调试配置”(在调试器弹出图标下)取消选中“启动时停止”,之后它不会在启动时停止,但如果你喜欢,你可以在那里设置断点

【讨论】:

    【解决方案3】:

    没有任何作用。除了以下之外,上述解决方案均无效

    我只是用 msys gdb 替换了 gdb

    即。例如

    当前配置

    ...应用程序配置..调试..调试

    GDB 调试器 gdb

    msys gdb 的 GDB 调试器路径(例如 c:\msys\bin\gdb.exe

    手动

    【讨论】:

    • 与其复制/粘贴您的other answer,不如将​​其与问题联系起来,并详细解释为什么以及如何解决问题?
    猜你喜欢
    • 2010-12-07
    • 2015-11-12
    • 2015-04-06
    • 2013-01-18
    • 2016-03-27
    • 2013-11-20
    • 2015-08-16
    • 2017-09-08
    • 2013-04-01
    相关资源
    最近更新 更多