Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Debugging

Thanks to cv2pdb, debugging in Visual Studio integrates well. Here is an example debugging session

source:wiki/debug.png

Using cv2pdb has a few quirks, like displaying '@' instead of '.'. This is happening because the C++ debugger that comes with Visual Studio is used.

Exceptions

As of version 0.3.21, the installer adds an entry "D Exception" to the list of Win32 exceptions that can be found in the Debug->Exceptions dialog. This allows the debugger to stop execution when an exception is thrown by the debuggee. With earlier versions, you'll have to add an entry with code 0xE0440001 yourself.

Mago Debugger

As of version 0.3.16 Visual D comes with the option to install the Mago debugger. This debug engine is dedicated to the D programming language and avoids the work-arounds needed when using the native debug engine. It also features D specific expressions like dynamic array slicing.

To enable debugging with the Mago debugger select it on the project conifguration page "Debugging". This will also disable cv2pdb conversion as Mago directly operates on the debug info emitted by DMD.

source:wiki/prop_debug.png

Please note that Mago is under development and might lack a few features that you find in the native debugger.

Exceptions

Mago displays exceptions thrown by the debuggee in the output window. You can also stop execution by enabling the respective box in the Debug->Exception dialog. Due to a bug, you currently cannot simply enable the "D Exceptions" entry, but must select the specific exceptions while keeping the "D Exceptions" entry unchecked. So, the dialog should look something like this:

source:wiki/d_exceptions.png

Visual Studio 2012

Visual Studio 2012 introduced a new debug engine that loses some of the capabilities of the preceding debug engine. This includes displaying variables in the Watch Window. You can switch back to the old debug engine by going to Tools->Options and then under the debugger settings, turn on native edit and continue. This will also reenable the visualizer macros in autoexp.dat.