[llvm-dev] Extracting the !dbg property from LLVM IR function calls

Shishir V Jessu via llvm-dev llvm-dev at lists.llvm.org
Wed Jul 8 11:23:32 PDT 2020


Hello,

I am compiling a program with debugging information, and am attempting to
extract !dbg numbers from function calls in LLVM IR. However, I've found a
few inconsistencies. For example, this call exists in my module:

%1 = tail call i1 @llvm.type.test(i8* bitcast (i32 (i32)* @_Z5otheri to
i8*), metadata !"_ZTSFiiE") #5, *!dbg !69*, !nosanitize !2

I would like to extract the 69 from this line in my LLVM pass, but when I
dump() the corresponding CallInst, I see the following:

%1 = tail call i1 @llvm.type.test(i8* bitcast (i32 (i32)* @_Z5otheri to
i8*), metadata !"_ZTSFiiE") #5, *!dbg !29*, !nosanitize !2

And finally, the line *CallInst -> getDebugLoc() -> getLine()* returns *61*
for this call, not 69 or 29.

Am I misunderstanding the purpose of getDebugLoc() for a CallInst? Is there
any way I can extract the correct !dbg for a given line? Thanks for your
help!

Best,
Shishir Jessu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200708/bdc62a4c/attachment.html>


More information about the llvm-dev mailing list