[LLVMdev] PDB debug info

Manu turkeyman at gmail.com
Wed Sep 12 13:49:06 PDT 2012

On 12 September 2012 23:09, Nathan Jeffords <blunted2night at gmail.com> wrote:

> On Wed, Sep 12, 2012 at 12:19 PM, Manu <turkeyman at gmail.com> wrote:
>> On 12 September 2012 20:49, Nathan Jeffords <blunted2night at gmail.com>wrote:
>>> On Wed, Sep 12, 2012 at 9:46 AM, Manu <turkeyman at gmail.com> wrote:
>>>> /Z7, that's the one. Maybe this approach can be used by LLVM? I presume
>>>> LLVM is capable of producing CV info already? Maybe this configuration is
>>>> already possible?
>>>>  It'd be interesting to try it out, CV in the COFF objects, and see if
>>>> the linker makes sense of it at link time...
>>> I was able to get clang to produce COFF files with embedded DWARF
>>> debug relatively easily, which produces executables debuggable via the
>>> MinGW tool-chain.
>> This sounds effectively identical to what I have now using MinGW GCC to
>> produce COFF binaries with DWARF debug info, and then running cv2pdb after
>> linking to extract a PDB from the binary. It works, but it means I can't
>> link against MSVC libs/objects because of the conflicting debug info
>> formats. :/
>> To support another debug format would be difficult I think, though I'm no
>>> expert on the subject. Currently LLVM internally represents everything more
>>> or less directly in DWARF. All of the debug meta-data attached to the IR is
>>> a slightly higher representation of DWARF data-structures. While there is a
>>> debug info builder class the insulates front ends from the details of DWARF
>>> to some extent, it is not complete isolation. I think the
>>> only feasible approach is to translate the DWARF info into CV info at a
>>> lower level, perhaps after the initial COFF object file containing DWARF
>>> has been emitted.
>> Okay, so CV isn't supported, not sure where I got that idea >_<
>> Hmmm, okay, well I think I'm back where I started using the MinGW
>> toolchain in that case...
>> Oh, it's all so problematic ;)
> It might be feasible to convert DWARF to CV within the object file prior
> to linking, then you should be able to link against MSVC libraries.

Yeah okay. So short of a concerted effort to properly support PDB, this
sounds like the most plausible option going forwards.
I'll dig around tomorrow, I wonder if there are any tools to do this
already, or if cv2pdb can be adapted perhaps.

 I'd also argue that the VS debugger is possibly the single biggest
>>>> productivity enhancement offered by the IDE ;)
>>>> And yeah, I'm in the situation where I need to link against MSVC built
>>>> code, so I need PDB at the end of the day.
>>>> Your approach would be really handy in other cases though, DWARF plugin
>>>> for VisualStudio would be a generally useful tool.
>>> From what I was able to gather while looking into a debugger plugin, the
>>> existing user interface would drive all debuggers, thus the user should
>>> have more or less the same debugging experience with any fully
>>> implemented plugin.
>> This sounds like what WinGDB does. As I understood it, there is a problem
>> with WinGDB, where they said they weren't able to actually implement their
>> debugger plugin without implementing a custom project type, which mutually
>> excludes the Visual Studio build architecture.
> This maybe why google seems to have abandoned the idea of building a
> debugger plugin.

Possibly. You might be interested to take a quick look at WinGDB. It may be
interesting how they were able to integrate their debugger, and what they
had to do to the project stuff to make it work.
WinGDB for Android shows the situation very well :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120912/e35673c7/attachment.html>

More information about the llvm-dev mailing list