Code::Blocks Forums

User forums => Help => Topic started by: Greatwolf on December 23, 2009, 05:13:08 am

Title: How to specify separate debug file to gdb from C::B?
Post by: Greatwolf on December 23, 2009, 05:13:08 am
I separated the debug symbols from my executable using:

Code
strip --keep-only-debug -o myproj.gdb myproj.exe
strip -s myproj.exe

How do I get C::B to pass the file with debug symbols to gdb before it actually starts debugging my executable? I can do this fine if I was using gdb from the commandline though:

Code
gdb -s myproj.gdb -e myproj.exe

Thanks
Title: Re: How to specify separate debug file to gdb from C::B?
Post by: oBFusCATed on December 23, 2009, 09:47:35 pm
Hm, have you tried to place the .gdb file along the .exe file? I think it should be loaded automatically.
Another thing you could do is to find if there is a gdb command you could execute to load the file.

If you have recent C::B there is a entry box for gdb commands in the debug log.
The older versions (8.02) has Debug -> Send Command menu which does the same.
Title: Re: How to specify separate debug file to gdb from C::B?
Post by: Greatwolf on December 23, 2009, 11:41:34 pm
The debug file and executable to be debug both reside in the same directory. The loading is automatically only if I made an explicit link within the executable to the debug file -- a step which I skipped. I suppose I could try that but I was hoping there was a way to specify it to gdb from within C::B.

There is a command to tell gdb to load symbols from another file from it's cli: symbol-file filename. The only problem is I can't find a way to get C::B to relay to gdb. The Debug->Send Command is initially greyed out. If I was debugging a console app, for example, starting a debugging session would just run through the executable with no chance to stop for inputting that command for the symbol file.
Title: Re: How to specify separate debug file to gdb from C::B?
Post by: Jenna on December 24, 2009, 12:46:34 am
It should work if you also run
Code
objcopy --add-gnu-debuglink myproj.gdb myproj.exe

In this case gdb should be able to find the symbols-file automatically.

Only tested on linux, but objcopy also exists in MinGW.