rengolin at systemcall.org
Wed Jul 14 13:04:01 PDT 2010
On 14 July 2010 18:21, Devang Patel <devang.patel at gmail.com> wrote:
> Use Create* methods to create basic debug info. There is not any
> tutorial document explaining how to generated basic debug info.
I got that far... ;)
I could prepare a how-to when I'm finished, if that interests you.
> It is encapsulating how debug info is encoded. Earlier it was using
> GlobalVariable, now it uses MDNode. The idea is that debug info user
> will only rely on DIDescriptor class hierarchy to manipulate debug
> info. The classes in this hierarchy are light weight enough to pass
> around as objects.
The problem with that is that you can't do:
DIDescriptor file = factory->CreateFile(...);
You have to get the type of file to be DIFile.
When creating a Subprogram, you can't pass a DIFile object, but only a
DIDescriptor, so you have to:
DIDescriptor* desc = &file;
Also, because they're not pointers, you can't use cast, as you would
when passing arguments to IRBuilder.
I understand that the objects are lightweight, thus the ability to
pass them as objects, but some casting could be allowed, especially to
DIDescriptor (copy ctor? new and assignment operators?).
> Debug info is encoded in llvm IR as MDNodes. And all MDNodes from a
> Module, just like any other llvm values, are automatically emitted
> when the Module is written to a bitcode file.
Weird, I wasn't getting the metadata before I started forcing
ModuleDebugInfoPrinterPass via PassManager. Could be other changes I
did, too, will check.
Reclaim your digital rights, eliminate DRM, learn more at
More information about the llvm-dev