Interested in generating .PDBs without using LINK.EXE?

Hi all,

I’m cross-posting from the llvm-dev list so I apologize in advance if that’s a faux pas, I just wanted to be sure and snag the appropriate audiences.

I work on a novel language that uses LLVM for machine-code generation. My primary experience (and interest) is on Windows. One thing I really have been wanting for my project is a good debugging experience. On Windows, this means some combination of Visual Studio and WinDbg.

Of course I’m familiar with the lldb/VS integration efforts and I know clang can emit .obj files that link to debuggable images via LINK.EXE. However, for my own personal goals, relying on LINK to generate debug data is a non-starter.

Thus I set out to build a PDB emitter that enables debugging of binaries compiled with my toolchain. As of this weekend I’ve successfully generated PDBs for a few test programs. My criteria for success are:

  • Functions are locatable by address in VS and WinDbg alike
  • Callstacks include accurate names of functions
  • Source indexing works to some extent (my front-end is a bit crippled in this regard right now so I’m faking it, but the fakery looks pretty good!)

I lifted a technique from the open-source CV2PDB project which originated with the D language community: I’m interfacing with MSPDB140.DLL to write the actual MSF file to disk. This is purely a bootstrapping technique though and I plan to fabricate “whole cloth” PDBs next.

A tiny bit of documentation on this can be found at [0].

My question (which again I also posed to the LLVM-dev list) - is there any interest from the Clang community in this work? Is PDB emission a valuable goal for anyone else? If so, how best can I contribute what I’ve assembled to the greater effort?


  • Mike

[0] -—Debugging-Epoch-Programs