[LLVMdev] Mapping bitcode to source code
Devang Patel
devang.patel at gmail.com
Wed Feb 10 09:34:26 PST 2010
On Tue, Feb 9, 2010 at 11:16 PM, Trevor Harmon <Trevor.W.Harmon at nasa.gov> wrote:
> On Feb 9, 2010, at 11:13 AM, Trevor Harmon wrote:
>
>> Is there any information about these changes and why they were
>> necessary?
>
> I think I found it:
>
> http://nondot.org/~sabre/LLVMNotes/EmbeddedMetadata.txt
>
> Still looking for an API to access the metadata...
If you want to map llvm instruction to the source location then try
if (MDNode *N = I->getMetadata("dbg")) { // Where I is an LLVM instruction
DILocation Loc(N); // DILocation is
in DebugInfo.h
unsigned Line = Loc.getLineNumber();
StringRef File = Loc.getFilename();
StringRef Dir = Loc.getDirectory();
}
Note, this is new and it won't work in llvm2.6.
-
Devang
More information about the llvm-dev
mailing list