Simone Atzeni via llvm-dev
2015-Aug-06 15:58 UTC
[llvm-dev] [LLVMdev] DebugInfo from LLVM Instruction
Hi all, I used to extract the debug information from an LLVM Instruction in the following way: if (MDNode *N = I->getMetadata("dbg")) { // Here 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(); } As specified also at http://llvm.org/docs/SourceLevelDebugging.html <http://llvm.org/docs/SourceLevelDebugging.html> However, looks like that the instruction " DILocation Loc(N);” is not valid anymore, Since the DILocation class is changed. Is that right? How can I extract debug info (line, filename, etc.) from an instruction? Thanks. Best Regards, Simone -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150806/da745daa/attachment.html>
David Blaikie via llvm-dev
2015-Aug-06 17:58 UTC
[llvm-dev] [LLVMdev] DebugInfo from LLVM Instruction
+Duncan because I don't remember exactly how things shifted On Thu, Aug 6, 2015 at 8:58 AM, Simone Atzeni via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi all, > > I used to extract the debug information from an LLVM Instruction in the > following way: > > if (MDNode *N = I->getMetadata("dbg")) { // Here 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(); > } > > As specified also at http://llvm.org/docs/SourceLevelDebugging.html > > However, looks like that the instruction " DILocation Loc(N);” is not > valid anymore, > Since the DILocation class is changed. > Is that right? > How can I extract debug info (line, filename, etc.) from an instruction? > > Thanks. > Best Regards, > Simone > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org http://llvm.cs.uiuc.edu > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150806/a0acac9b/attachment-0001.html>
Duncan P. N. Exon Smith via llvm-dev
2015-Aug-06 18:16 UTC
[llvm-dev] [LLVMdev] DebugInfo from LLVM Instruction
> On 2015-Aug-06, at 10:58, David Blaikie <dblaikie at gmail.com> wrote: > > +Duncan because I don't remember exactly how things shifted > > On Thu, Aug 6, 2015 at 8:58 AM, Simone Atzeni via llvm-dev <llvm-dev at lists.llvm.org> wrote: > Hi all, > > I used to extract the debug information from an LLVM Instruction in the following way: > > if (MDNode *N = I->getMetadata("dbg")) { // Here 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(); > } > > As specified also at http://llvm.org/docs/SourceLevelDebugging.htmlFixed the docs in r244238. Probably what you want these days is something like: if (DILocation *Loc = I->getDebugLoc()) { unsigned Line = Loc->getLine(); StringRef File = Loc->getFilename(); StringRef Dir = Loc->getDirectory(); }> > However, looks like that the instruction " DILocation Loc(N);” is not valid anymore, > Since the DILocation class is changed. > Is that right? > How can I extract debug info (line, filename, etc.) from an instruction? > > Thanks. > Best Regards, > Simone > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org http://llvm.cs.uiuc.edu > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >