Mercurial > projects > ldc
comparison gen/todebug.cpp @ 686:363bb6c0cc80
Emit stub debug info for generated functions to work around LLVM bug 2172.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 12 Oct 2008 14:38:55 +0200 |
parents | b411c41a9716 |
children | 8526cf626110 |
comparison
equal
deleted
inserted
replaced
685:8d7e58801c82 | 686:363bb6c0cc80 |
---|---|
147 return gv; | 147 return gv; |
148 } | 148 } |
149 | 149 |
150 ////////////////////////////////////////////////////////////////////////////////////////////////// | 150 ////////////////////////////////////////////////////////////////////////////////////////////////// |
151 | 151 |
152 static LLGlobalVariable* dwarfSubProgram(llvm::GlobalVariable* emitUnit, llvm::GlobalVariable* defineUnit, const char* prettyname, const char* mangledname, uint linenum, bool isprivate) | |
153 { | |
154 std::vector<LLConstant*> vals(11); | |
155 vals[0] = DBG_TAG(DW_TAG_subprogram); | |
156 vals[1] = DBG_CAST(getDwarfAnchor(DW_TAG_subprogram)); | |
157 | |
158 vals[2] = DBG_CAST(emitUnit); | |
159 vals[3] = DtoConstStringPtr(prettyname, "llvm.metadata"); | |
160 vals[4] = vals[3]; | |
161 vals[5] = DtoConstStringPtr(mangledname, "llvm.metadata"); | |
162 vals[6] = DBG_CAST(defineUnit); | |
163 vals[7] = DtoConstUint(linenum); | |
164 vals[8] = DBG_NULL; | |
165 vals[9] = DtoConstBool(isprivate); | |
166 vals[10] = DtoConstBool(emitUnit == defineUnit); | |
167 | |
168 Logger::println("emitting subprogram global"); | |
169 | |
170 return emitDwarfGlobal(getDwarfSubProgramType(), vals, "llvm.dbg.subprogram"); | |
171 } | |
172 | |
173 /* | |
152 static LLGlobalVariable* dwarfSubProgram(FuncDeclaration* fd, llvm::GlobalVariable* compileUnit) | 174 static LLGlobalVariable* dwarfSubProgram(FuncDeclaration* fd, llvm::GlobalVariable* compileUnit) |
153 { | 175 { |
154 std::vector<LLConstant*> vals(11); | 176 std::vector<LLConstant*> vals(11); |
155 vals[0] = DBG_TAG(DW_TAG_subprogram); | 177 vals[0] = DBG_TAG(DW_TAG_subprogram); |
156 vals[1] = DBG_CAST(getDwarfAnchor(DW_TAG_subprogram)); | 178 vals[1] = DBG_CAST(getDwarfAnchor(DW_TAG_subprogram)); |
166 vals[10] = DtoConstBool(fd->getModule() == gIR->dmodule); | 188 vals[10] = DtoConstBool(fd->getModule() == gIR->dmodule); |
167 | 189 |
168 Logger::println("emitting subprogram global"); | 190 Logger::println("emitting subprogram global"); |
169 | 191 |
170 return emitDwarfGlobal(getDwarfSubProgramType(), vals, "llvm.dbg.subprogram"); | 192 return emitDwarfGlobal(getDwarfSubProgramType(), vals, "llvm.dbg.subprogram"); |
171 } | 193 }*/ |
172 | 194 |
173 ////////////////////////////////////////////////////////////////////////////////////////////////// | 195 ////////////////////////////////////////////////////////////////////////////////////////////////// |
174 | 196 |
175 static LLGlobalVariable* dwarfTypeDescription_impl(Type* type, LLGlobalVariable* cu, const char* c_name); | 197 static LLGlobalVariable* dwarfTypeDescription_impl(Type* type, LLGlobalVariable* cu, const char* c_name); |
176 static LLGlobalVariable* dwarfTypeDescription(Type* type, LLGlobalVariable* cu, const char* c_name); | 198 static LLGlobalVariable* dwarfTypeDescription(Type* type, LLGlobalVariable* cu, const char* c_name); |
646 { | 668 { |
647 Logger::println("D to dwarf subprogram"); | 669 Logger::println("D to dwarf subprogram"); |
648 LOG_SCOPE; | 670 LOG_SCOPE; |
649 | 671 |
650 // FIXME: duplicates ? | 672 // FIXME: duplicates ? |
651 return dwarfSubProgram(fd, DtoDwarfCompileUnit(gIR->dmodule)); | 673 return dwarfSubProgram( |
674 DtoDwarfCompileUnit(gIR->dmodule), | |
675 DtoDwarfCompileUnit(fd->getModule()), | |
676 fd->toPrettyChars(), fd->mangle(), | |
677 fd->loc.linnum, | |
678 fd->protection == PROTprivate); | |
679 } | |
680 | |
681 ////////////////////////////////////////////////////////////////////////////////////////////////// | |
682 | |
683 LLGlobalVariable* DtoDwarfSubProgramInternal(const char* prettyname, const char* mangledname) | |
684 { | |
685 Logger::println("D to dwarf subprogram"); | |
686 LOG_SCOPE; | |
687 | |
688 // FIXME: duplicates ? | |
689 return dwarfSubProgram( | |
690 DtoDwarfCompileUnit(gIR->dmodule), | |
691 DtoDwarfCompileUnit(gIR->dmodule), | |
692 prettyname, mangledname, | |
693 0, | |
694 true); | |
652 } | 695 } |
653 | 696 |
654 ////////////////////////////////////////////////////////////////////////////////////////////////// | 697 ////////////////////////////////////////////////////////////////////////////////////////////////// |
655 | 698 |
656 LLGlobalVariable* DtoDwarfGlobalVariable(LLGlobalVariable* ll, VarDeclaration* vd) | 699 LLGlobalVariable* DtoDwarfGlobalVariable(LLGlobalVariable* ll, VarDeclaration* vd) |