[LLVMdev] Accessing metadata & creating DIVariable

Vedavyas Duggirala vduggira at gmail.com
Tue Mar 29 16:30:22 PDT 2011


>>> I get the filename and directory from  DISubprogram from reading
>>> llvm.dbg.sp and use
>>> that to DIBuiler::.createCompileUnit. This  leads to  "duplicate
>>> symbol" error from llc.

>> If the llvm::Module already has llvm.dbg.sp then you don't need to use DIBuilder::createCompileUnit(). The point, I am missing is how did you get llvm.dbg.sp in module ?
>>
>> It seems you already have generated debug info in llvm::Module using DIBuilder. If that is true then you don't need to use createCompileUnit() for the same translation unit.

 Yes, that was what I said in the first line of my original mail :)  I
 am adding instrumentation code/variables to IR, and I want to add
 debuginfo for the new variables and calls I introduced.

>> If you reading a llvm::Module which already has a debug info and you are trying to add more debug info in the module than DIBuilder is not the tool for you.
>
> :(
>
>> Have you looked at how clang generated debug info ?
 No experience with clang, But  where do I  have to  look ? Is what I
 am looking for even possible. I thought since it is said optimization
 passes update the metadata, it should be simple.

 Vyas




More information about the llvm-dev mailing list