Debugging D on Windows
The Microsoft Windows debugger \windows\bin\windbg.exe can be used to symbolically debug D programs, even though it is a C++ debugger. Versions of windbg.exe other than the one supplied may not work with D. (Jascha Wetzel's Ddbg for Windows is also available.)
To prepare a program for symbolic debugging, compile with the -gc switch:
dmd myprogram -gc
To invoke the debugger on it:
windbg myprogram args...
where args... are the command line arguments to myprogram.exe.
When the debugger comes up, entering the command in the command window:
will execute the program up until the entry into main(). From thence, pressing the F10 key will single step each line of code.
- Go until breakpoint, an exception is thrown, or the end of the program.
- Continue until cursor.
- Single step, stepping into function calls.
- Single step, stepping over function calls.
For more comprehensive information on windbg, consult the file \windows\bin\windbg.hlp.