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;
factory->CreateSubprogram(*desc, ...);
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.
--
cheers,
--renato
http://systemcall.org/
Reclaim your digital rights, eliminate DRM, learn more at
http://www.defectivebydesign.org/what_is_drm