User forums > Using Code::Blocks
How to set custom source search path when debugging?
Calmarius:
I'm using CB to compile, debug and develop our company's product using a custom makefile. The source code is somewhere else, not next to the project. Everything is working fine, but
when try to use the Call stack and click on a frame to open source file, it cannot find it because it tries to find the sources relative to the project directory, not at the actual source directory.
Is there way to set custom source directories somehow? (All directory settings seems to affect the compiler tools not the IDE.)
The only rough workaround is making symbolic links to these source directories.
oBFusCATed:
Unfortunately, you can't.
But you can modify your makefile to use full paths, so they will be embedded in the debug info and probably gdb will use full paths instead of relative paths, when generating the backtraces.
ollydbg:
I have the same issue when debug into a wxwidgets-debug-dll.
1, gdb's bt command will return the file-name which is used when you build the target. I mean: if you makefile have some command:
--- Code: ---gcc ../c/a.cpp
--- End code ---
then bt will return something like
--- Code: ---../c/a.cpp:line_number
--- End code ---
if you use some absolute file-name, like
--- Code: ---gcc /f/a.cpp
--- End code ---
then bt will return the same absolute file-name.
2, I believe that our C::B can only handle two situations:
2.1, the returned file path is an absolute file path, so c::b can locate and open the file.
2.2, when a relative file path is returned from bt command, c::b try to locate the file relative to the project file(cbp file). This is your case, then c::b failed to locate the real file.
3, there is a solution:
There is a patch for gdb which can let the "bt" command return three type of filenames: basename, absolute-name, relative-name, see:
http://sourceware.org/ml/gdb-patches/2012-04/msg00106.html
Then you can let the gdb to handle this case, and gdb can always return the absolute-name. By use the command:
--- Code: ---set backtrace filename-display absolute
--- End code ---
My build of gdb (see: [OT] unofficial MinGW GDB gdb with python released) have this file already, but I'm not sure when it will be put in gdb cvs HEAD.
Jenna:
What works for me (if debugging into wxwidgets for example) is to add
--- Code: -----directory=/path/to/the/root/of/the/build/directory
--- End code ---
as argument for my gdb-debugger in "Settings -> Debugger -> GDB/CDB debugger -> [the debugger I use] -> Arguments"
Calmarius:
It works fine when I switch frames, but double clicking on the frame ("jump to this frame") still cannot open the source file.
It would be nice to be able to set these external source paths in the IDE in the future.
Navigation
[0] Message Index
[#] Next page
Go to full version