[LLVMdev] Debug Info Documentation State

Eric Christopher echristo at gmail.com
Wed Mar 20 14:33:36 PDT 2013

On Wed, Mar 20, 2013 at 2:21 PM, Erkki Lindpere <villane at gmail.com> wrote:

> Hi,
> I wanted to add debug info to my language (compiler written in Scala,
> outputs .ll files), but I found it really hard to do based on the
> documentation provided at http://llvm.org/docs/SourceLevelDebugging.html(I looked at the specific doc for LLVM 3.0 though)
> With LLVM 3.0, DI version 8 (which is documented there) seemed to work,
> except DW_TAG_auto_variable for which I used version tag 11 and imitated
> what clang was doing.
> Got that working for simple programs, but now I switched to LLVM 3.2 and
> that debug info doesn't work any more. My best bet seems to be looking at
> how Clang/LLVM does it internally.
> PS. For anyone else looking for this, lib/VMCore/DIBuilder.cpp seems to be
> the best place to look what the structures should look like.
Yes. You should use DIBuilder if at all possible or construct something
that does the same thing if you need bindings. But I'd probably just do
bindings, producing the text is the least portable way.

> My question is, any plans to updating the documentation? Documenting
> different versions of the debug info is probably too much, but the docs
> should at least be of a working version (of course it's possible that
> Version 8 works fine and I was just doing something wrong).

We've removed the versioning on debug info recently and it will continue to
be an unstable format for the foreseeable future. Updating the
documentation is definitely possible, and should be happening as we move
around fields and change things. It's possible it hasn't happened of late
and so that should probably be fixed. A good chunk of the layout still
looks correct - but will be incorrect against any released version even if
it was updated. It should reflect top of tree.

That said, looking at how clang emits debug information is guaranteed to be
the current correct way to emit it so that what you emit is understood by
the backend and if you've got any specific questions the mailing list
should work well.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130320/28dce4af/attachment.html>

More information about the llvm-dev mailing list