Code::Blocks Forums

User forums => Help => Topic started by: dsimcha on August 02, 2008, 02:13:07 am

Title: Debugging DMD
Post by: dsimcha on August 02, 2008, 02:13:07 am
I've been trying to use ddbg, a D debugger with CodeBlocks, and the issue I keep running into is that CodeBlocks doesn't seem to want to add the symbolic debugging info to my projects no matter what I do.  I've double-checked several times that the -g switch is set in my debug mode target options, that I'm appending these options to the project build options, that my current build target is debug, etc.  When I compile with CodeBlocks, debugging does not work.  When I run the debugger manually on executables produced by the CodeBlocks build system, it says that there's no symbolic debuggining info.  When I turn off auto rebuilding, compile my executables manually with the -g switch, copy them to my project's bin/Debug folder, and debug from CodeBlocks, it works fine.  It's as if CodeBlocks is simply not passing the -g switch to DMD.  This occurs on both CodeBlocks 8.02 and SVN 5142, and occurs on GDC in addition to DMD.  Note that nothing like this occurs when using GCC for C or C++.
Title: Re: Debugging DMD
Post by: dsimcha on August 02, 2008, 05:07:34 am
After much messing w/ this thing, I've found a simple but ugly workaround.  If I set the -g flag in linker settings instead of compiler settings, then it works.  Also, when I put the -g switch in "other options" instead of checking the checkbox, it magically is not saved.  When I put other options here, they are saved.  Go figure.
Title: Re: Debugging DMD
Post by: doctor_vitus on August 17, 2008, 04:10:53 pm
I spent a lot of efforts trying to get the debugger to work with DMD, but unfortunately I failed.

I use the DMD 1.033 and Tango 0.99.7 bundle from http://www.dsource.org/projects/tango/wiki/DmdDownloads with CB 8.02 (I also tried sv 5177) on Linux (Debian Lenny). I tried the gdb 6.8 version from the Debian package repository as well as a self-compiled gdb with the D patches (http://dsource.org/projects/gdb-patches/browser/downloads/gdb6.8).

-g is passed to the linker. I also tried passing it to the compiler, too.

When I set a breakpoint in the first line of the code and start debugging, I get

Quote
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.8-debian
Child process PID: 4449

But there is no debugging arrow shown. Each time I press F7 then, I get output like

Quote
In _D6dmain24mainUiPPaZi7runMainMFZv () ()
In _D6dmain24mainUiPPaZi7tryExecMFDFZvZv () ()
In _D6dmain24mainUiPPaZi6runAllMFZv () ()
In _D6dmain24mainUiPPaZi7tryExecMFDFZvZv () ()

... and finally...

Quote
In main () ()
In __libc_start_main () (/lib/libc.so.6)
Program exited normally.
Debugger finished with status 0

... but still there is no yellow debugging arrow.

I'm sure that the executable contains the debugging info, because if I don't set a breakpoint, the debugger simply rushes through the code and finishes.

Any ideas?

Thanks in advance,
doctor_vitus