Vedavyas Duggirala
2011-Mar-29 18:18 UTC
[LLVMdev] Accessing metadata & creating DIVariable
Hi,> You need to call di.createCompileUnit() once for your translation unit in the beginning. You don't need to keep track of CU yourself. DIBuilder will take care of it. After words, you can call di.createBasicType(..) and it will work.Actually it doesn't. But if I call di.createCompileUnit(file, dir, producer, ...) with file or dir different from that of CU already in the file, then it works. It isn't sufficient if the producer is different. That fixes my problem, so many thanks. If DIBuiler constructor would pick existing CU from the Module, we can retain original CU entry. But, I do no have enough knowledge of DWARF or LLVM, to know if it is valid/reasonable thing to do. thanks, Vyas
On Mar 29, 2011, at 11:18 AM, Vedavyas Duggirala wrote:> Hi, > >> You need to call di.createCompileUnit() once for your translation unit in the beginning. You don't need to keep track of CU yourself. DIBuilder will take care of it. After words, you can call di.createBasicType(..) and it will work. > > Actually it doesn't. But if I call di.createCompileUnit(file, dir, > producer, ...) with file or dir different from that of CU already in > the file, then it works. It isn't sufficient if the producer is > different. That fixes my problem, so many thanks. > > If DIBuiler constructor would pick existing CU from the Module, we > can retain original CU entry. But, I do no have enough knowledge of > DWARF or LLVM, to know if it is valid/reasonable thing to do.Either you have not answered my earlier question OR I missed your reply. In any case, how did you get (or create) your pre existing CU from the Module ? What did you do to construct it ? - Devang
Vedavyas Duggirala
2011-Mar-29 22:58 UTC
[LLVMdev] Accessing metadata & creating DIVariable
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.>>> You need to call di.createCompileUnit() once for your translation unit in the beginning. You don't need to keep track of CU yourself. DIBuilder will take care of it. After words, you can call di.createBasicType(..) and it will work. >> >> Actually it doesn't. But if I call di.createCompileUnit(file, dir, >> producer, ...) with file or dir different from that of CU already in >> the file, then it works. It isn't sufficient if the producer is >> different. That fixes my problem, so many thanks. >> >> If DIBuiler constructor would pick existing CU from the Module, we >> can retain original CU entry. But, I do no have enough knowledge of >> DWARF or LLVM, to know if it is valid/reasonable thing to do. > > Either you have not answered my earlier question OR I missed your reply. In any case, how did you get (or create) your pre existing CU from the Module ? What did you do to construct it ? > - > Devang >
Possibly Parallel Threads
- [LLVMdev] Accessing metadata & creating DIVariable
- [LLVMdev] Accessing metadata & creating DIVariable
- [LLVMdev] Accessing metadata & creating DIVariable
- [LLVMdev] Accessing metadata & creating DIVariable
- [LLVMdev] Fwd: Accessing metadata & creating DIVariable