DConf 2014 Day 2 Talk 6: Debugging in D by Iain Buclaw

Johannes Pfau via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Mon Jul 14 23:44:22 PDT 2014


Am Tue, 15 Jul 2014 11:59:42 +1000
schrieb Manu via Digitalmars-d-announce
<digitalmars-d-announce at puremagic.com>:

> On 15 July 2014 00:32, Johannes Pfau via Digitalmars-d-announce <
> digitalmars-d-announce at puremagic.com> wrote:
> 
> > Am Tue, 15 Jul 2014 00:15:01 +1000
> > schrieb Manu via Digitalmars-d-announce
> > <digitalmars-d-announce at puremagic.com>:
> >
> > > I don't see that GDC/GDB will ever be useful in the Windows
> > > environment due to incompatible object and debug formats, but LLVM
> > > are making the push for full MSVC compatibility.
> >
> > Can you provide some more details about this? MinGW uses the
> > standard PE object format, afaik. GCC-4.9 also supports SEH
> > exceptions (on 64 bit, not sure about 32). The mingw 'runtime' is a
> > small layer on top of the microsoft runtime, to provide C99
> > functions and similar stuff. I don't think that should be a problem.
> >
> 
> http://clang.llvm.org/docs/MSVCCompatibility.html
> 
> They emit line numbers so far apparently. But I understand the intent
> is to properly populate the object with cv8 debug data.
> The linker takes care of generating the pdb file.
> 
> So, are you saying that GDC binaries will link successfully against
> the mscrt suite?
> I've used it in the past, and it never wanted to link against the ms
> libs. In addition, when I did try and link C and D code together, I
> got loads of CRT conflicts when trying to link glibc and mscrt
> together.

There's no glibc on windows, mingw links to msvcrt.dll. I think MS
toolchains link to msvcr110.dll, but it's also possible to make mingw
link against msvcr110.dll.
I didn't try to link mingw/msvc object files yet, but according to some
mingw discussions it should work. C DLLs should always work.

(That's only for C, C++ mingw/msvc are not compatible).

> 
> I believe the goal for LLVM is to target the same runtime as MSC does,
> otherwise you're just asking for link trouble.
> 
> The pdb debug format is not supported, AFAIK. But that format is not
> > documented and I don't think you could add D extensions anyway.
> > So does LLVM really support PDB?
> >
> 
> The linker outputs the pdb file, the objects are populated with cv8.
> Can GCC write cv8 output?
> 

No it can't. cv2pdb claims to support converting from dwarf->pdb 
but I never tried that.

> MinGW can use dwarf debug info on windows and I guess you get all
> > benefits of Iain's gdb work on windows. It is annoying if you get
> > crashes in the microsoft C runtime or any other library compiled
> > with microsoft tools though, as there's no dwarf debug info for
> > these.
> >
> 
> I have had problems with the linker when trying to link GDC and MSC
> objects together.
> You lose the debug info for one or the other world. You can't have
> dwarf and cv8/pdb together.
> And to be useful, there would need to be some visual studio
> integration for dwarf debugging :/
> 
> So overall I don't see why mingw should work fine on windows. Of
> > course there's less incentive for GCC devs to support windows, but I
> > doubt that's different for LLVM.
> >
> 
> I think there would be plenty of incentive if it worked.
> I haven't tried it out for a while. I'll give it a whirl and see
> what's changed, but while the dwarf/cv8 conflict remains, I can't see
> it being a practical solution.

I guess getting dwarf and cv8 to work together is almost impossible.
> 
> There's also nobody working actively on the MinGW gdc port right now,
> > afaik. We don't even know the test suite results for mingw. So if
> > you want to contribute...
> >
> 
> This has indeed been my biggest issue with GDC in the past.
> 



More information about the Digitalmars-d-announce mailing list