User forums > Help
Can't set GDB breakpoints in other directories
HillClimber:
Hi,
I haven't been able to successfully use the GDB integration. The main issue seems to be that CodeBlocks is sending a relative path for a source file, which GDB doesn't accept.
I have a workspace with multiple projects in separate directories. If I hit F8 and click in some source to add a breakpoint, cb_gdb sends a command which GDB doesn't like:
--- Code: --->>>>>>cb_gdb:
> break "../Atlas/Exception.cpp:61"
No source file named ../Atlas/Exception.cpp.
Breakpoint 1 ("../Atlas/Exception.cpp:61) pending.
>>>>>>cb_gdb:
--- End code ---
GDB does seem to like just a base filename (which it finds in the source directory serarch paths), or an absolute path to a file. It only chokes on the relative paths.
By the way, I also tried setting breakpoints by hand, and although GDB stops on them, CB_GDB immediately issues a "cont" command so I can't inspect anything :(
I'm running on Ubuntu Edgy, and I've tried the last three or four nightly builds with Edgy packages. I've also tried both the stock GDB unbuntu package (6.4.90-ubuntu) and compiling GDB from the 6.6 source.
TIA for your help, and thanks much for creating a great IDE!
- AC
MortenMacFly:
This is a known issue and is currently being investigated. For a quick (better) solution (and in case you compile C::B yourself) you may want to comment the following lines in debuggerstate.cpp:
--- Code: --- else
{
// for foreign files, we still should use a relative path
wxFileName f(filename);
f.MakeRelativeTo(prj->GetBasePath());
fname = f.GetFullPath();
}
--- End code ---
This isn't complete - there are still cases where this doesn't work properly yet...
Yiannis: Do you remember my PM of the other day (back in the old year 2006)...?! ;-)
With regards, Morten.
HillClimber:
Morten,
Thanks for the tip. I hacked up the source as you suggested, and actually had to make a number of additional changes to get the debugger to work for me. I posted a patch on the developer forum:
http://forums.codeblocks.org/index.php?topic=4896.msg38219#msg38219
Thanks!
- HC
MortenMacFly:
--- Quote from: HillClimber on January 09, 2007, 03:31:30 am ---http://forums.codeblocks.org/index.php?topic=4896.msg38219#msg38219
--- End quote ---
I think it is important to notice why this "else" tree (I believe even the whole method) was actually implemented.
The reason was due to issues with breakpoints in a project where the *project* file is in another sub-directory (not at the project's top-level path).
I wonder if that will still work with your changes applied. Could you give that a try, please?
Thus, have e.g. such a folder structure:
C:\MyProject\src\includes -> header files
C:\MyProject\src\sources -> implementation files
C:\MyProject\src\project -> C::B project (workspace) file
With regards, Morten.
Game_Ender:
Could this all be solved if CB used absolute paths for compiling debug executables? Then the absolute path will be encoded into the binary and when CB sends it an absolute path for the breakpoint it will have no problem finding the proper file. Or does GDB work in some other way?
Navigation
[0] Message Index
[#] Next page
Go to full version