Debugging with Code Blocks and a custom make (Boost.Build)
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.
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
directory C:/XXX~1/CB-WOR~1/altomo
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.
Try this:
(gdb) break main.cpp:185
If GDB
doesn't know main.cpp
either, then Boost.Build
is not building a debug version.
Chances are Boost.Build
is not using absolute pathnames when it compiles the source.
精彩评论