Debugging support for D - wiki

Rainer Schuetze r.sagitario at gmx.de
Thu Sep 26 01:06:14 PDT 2013



On 25.09.2013 17:12, Bruno Medeiros wrote:
> On 24/09/2013 07:16, Rainer Schuetze wrote:
>>
>>
>> On 23.09.2013 21:50, Bruno Medeiros wrote:
>>> For DMD+Windows, is there only good debugger support with VisualD? :-(
>>> And how well does that work with 32/64 bit platform variations?
>>
>> Current options that I know of for Windows:
>>
>> - DMD/Win32+windbg(1996): This is a version of windbg from 1996 with
>> very basic debugging support and is an embarrassment to be delivered
>> with dmd.
>>
>> - DMD/Win32+cv2pdb: cv2pdb allows conversion of the (often no longer
>> supported) CodeView 4 debug info into pdb files and makes debugging
>> available by most C/C++ debuggers. This is also used by Visual D when
>> using the VS debugger. You can see a list features that work or don't
>> work here: http://dsource.org/projects/cv2pdb/wiki/Features
>> For non-VS debuggers, most of the visualization extras for displaying
>> strings, dynamic and associative arrays will not be available.
>>
>> - DMD/Win32+mago: mago is a debug engine for Visual Studio explicitely
>> for D. Most notably, it has watch support for D expressions whereas in
>> other debuggers you usually have to know the C-representation. It can be
>> used with/without Visual D, but things like the "Auto" window only work
>> with language support by Visual D.
>>
>> - DMD/Win64: dmd emits MS compatible debug information so that the
>> appropriate PDB file is generated during linking and debugging is
>> possible with most C/C++ debuggers. Debug info is not yet optimal,
>> mostly because the VS debugger does not like '.' in names. (cv2pdb
>> defaults to replacing it with '@').
>>
>> - DMD/Win32+ddbg: ddbg is linked from the web site to
>> http://ddbg.mainia.de/releases.html but this seems a dead link. Last
>> time I tried ddbg some years ago it didn't work out too well for me
>> (maybe it's mostly for D1).
>>
>
> Thanks for the info, that is quite helpful.
>
> Though, it does mean that the path for good debugging support in Windows
> for DMD generated executables, without being tied to an specific IDE
> (VisualD), doesn't look good.

I'm not that pessimistic. Every decent debugger on Windows understands 
PDB as there are standard libraries to use them. I guess they can be 
used (after conveting debug information with cv2pdb for win32) as much 
as Visual Studio. The visualization addons are specific to VS, though.

>
> ddbg looks quite dead. I haven't tried it myself recently but I think I
> recall seing some comments for other people as well that it wasn't
> working properly anymore with newer D versions, or something.
>
> It might be feasable to adapt mago to be used from another IDE. Can a
> command-line interface for it be written? Or is mago too closely tied to
> VisualStudio?
>

AFAIU the debug engine interface implemented by mago is not strictly 
tied to Visual Studio, but I'm not sure if other debuggers support it as 
well. Maybe it is possible to add it as an extension to WinDbg and its 
friends CDB, NTSD, and KD. It's definitely possible to write your own 
debugger using it, it's a COM component.

>
> How about having DMD generate DWARF info on Windows? Is that feasable?
> Is it a lot of work? If DMD does it for Linux, it doesn't seem like it
> should be a lot of work to have that done in Windows as well. I guess it
> would it would have to use GNU tooling on Windows (Cygwin or MSys), but
> that seems quite an acceptable requirement.
> (might that adress some Optlink bugs/limitations as well?)
>

It's not so difficult to compile dmd to output ELF object files with 
DWARF debug info instead of OMF though I have never tried to link the 
result with anything else. I guess there are still OS specifics like 
calling conventions that are currently tied to the output format.


More information about the Digitalmars-d mailing list