使用代码块和自定义 make 进行调试 (Boost.Build)
我已经在 WinXP 机器上使用 Code::Blocks 和 MinGW 一段时间了。但自从我开始使用 Boost.Build 作为“自定义构建工具”以来,我在从 Code::Blocks 设置断点时遇到了麻烦。当我启动调试会话时,Code::Blocks 尝试将所有断点发送到 GDB,但 GDB 似乎无法识别源文件名:
Debugger name and version: GNU gdb 6.6
No source file named C:/xxx/CB-Workspace/altomo/src/main.cpp.
Breakpoint 1 ("C:/xxx/CB-Workspace/altomo/src/main.cpp:185) pending.
(xxx 只是缩写)
要查看发生了什么,我手动启动了 GDB 并尝试设置断点:
(gdb) break main.cpp:181
Breakpoint 1 at 0x40231e: file src/main.cpp, line 181.
(gdb) break src/main.cpp:182
Breakpoint 2 at 0x402331: file src/main.cpp, line 182.
(gdb) break "C:/xxx/CB-Workspace/altomo/src/main.cpp:185"
Breakpoint 3 at 0x402513: file src/main.cpp, line 185.
一切看起来都很好。我还确认所有 *.o 文件中都存在完整路径。
奇怪的是,在我切换到 Boost.Build 之前,调试曾经可以工作。所以,我真的不知道该去哪里寻找。谁该受责备?我、Boost.Build、Code::Blocks 还是 GDB?我是否错过了一些明显的编译器选项或 CB 项目设置以及搜索路径之类的东西?
我想继续使用 Boost.Build 作为构建工具,并使用 Code::Blocks 进行编辑和作为 GDB 前端。感谢任何解决此问题的帮助。
I've been using Code::Blocks with MinGW on a WinXP box for a while now. But since I started using Boost.Build as "custom build tool" I'm having trouble setting break points from Code::Blocks. When I start a debugging session Code::Blocks tries to send all break points to GDB but GDB doesn't seem to recognise the sources' filenames:
Debugger name and version: GNU gdb 6.6
No source file named C:/xxx/CB-Workspace/altomo/src/main.cpp.
Breakpoint 1 ("C:/xxx/CB-Workspace/altomo/src/main.cpp:185) pending.
(The xxx is only an abreviation)
To see what's going on I started GDB manually and tried to set a breakpoint:
(gdb) break main.cpp:181
Breakpoint 1 at 0x40231e: file src/main.cpp, line 181.
(gdb) break src/main.cpp:182
Breakpoint 2 at 0x402331: file src/main.cpp, line 182.
(gdb) break "C:/xxx/CB-Workspace/altomo/src/main.cpp:185"
Breakpoint 3 at 0x402513: file src/main.cpp, line 185.
All seems okay. I also veryfied that in all the *.o files the full path was present.
The weird thing is that debugging used to work before I switched to Boost.Build. So, I don't really know where to look. Who's to blame? Me, Boost.Build, Code::Blocks, or GDB? Did I miss some obvious compiler options or CB project settings w.r.t. search paths or something?
I would like to keep using Boost.Build as build tool and Code::Blocks for editing and as GDB front-end. Any help to solve this problem is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我启用了 Code::Block 的调试日志来查看哪些命令传递给了 GDB,看来问题出在 Code::Blocks 上。它
向 GDB 发送一条命令,该命令是“DOS 损坏的”目录名。 GDB 不喜欢这样。所以,对我来说,它看起来像是 Code::Blocks 中的一个错误。
I enabled Code::Block's Debugging log to see what commands are passed to GDB and it seems the problem is with Code::Blocks. It sends a
command to GDB which is the "DOS-mangled" directory name. GDB doesn't like that. So, it looks like a bug in Code::Blocks to me.
试试这个:
如果
GDB
也不知道main.cpp
,那么Boost.Build
就不会构建调试版本。Boost.Build 在编译源代码时很可能没有使用绝对路径名。
Try this:
If
GDB
doesn't knowmain.cpp
either, thenBoost.Build
is not building a debug version.Chances are
Boost.Build
is not using absolute pathnames when it compiles the source.