Mercurial > projects > ldc
comparison gen/todebug.cpp @ 718:72ee105be27b
Make sure debug info has correct file name and path.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Wed, 22 Oct 2008 20:00:57 +0200 |
parents | 353d9d184091 |
children | 50d01791859c |
comparison
equal
deleted
inserted
replaced
717:a26b0c5d5942 | 718:72ee105be27b |
---|---|
133 std::vector<LLConstant*> vals(6); | 133 std::vector<LLConstant*> vals(6); |
134 vals[0] = DBG_TAG(DW_TAG_compile_unit); | 134 vals[0] = DBG_TAG(DW_TAG_compile_unit); |
135 vals[1] = DBG_CAST(getDwarfAnchor(DW_TAG_compile_unit)); | 135 vals[1] = DBG_CAST(getDwarfAnchor(DW_TAG_compile_unit)); |
136 | 136 |
137 vals[2] = DtoConstUint(DW_LANG_C);// _D)); // doesn't seem to work | 137 vals[2] = DtoConstUint(DW_LANG_C);// _D)); // doesn't seem to work |
138 vals[3] = DtoConstStringPtr(m->srcfile->name->toChars(), "llvm.metadata"); | 138 vals[3] = DtoConstStringPtr(FileName::name(m->srcfile->name->toChars()), "llvm.metadata"); |
139 std::string srcpath(FileName::path(m->srcfile->name->toChars())); | 139 std::string srcpath(FileName::path(m->srcfile->name->toChars())); |
140 if (srcpath.empty()) | 140 if (!FileName::absolute(srcpath.c_str())) { |
141 srcpath = llvm::sys::Path::GetCurrentDirectory().toString(); | 141 llvm::sys::Path tmp = llvm::sys::Path::GetCurrentDirectory(); |
142 tmp.appendComponent(srcpath); | |
143 srcpath = tmp.toString(); | |
144 } | |
142 vals[4] = DtoConstStringPtr(srcpath.c_str(), "llvm.metadata"); | 145 vals[4] = DtoConstStringPtr(srcpath.c_str(), "llvm.metadata"); |
143 vals[5] = DtoConstStringPtr("LDC (http://www.dsource.org/projects/ldc)", "llvm.metadata"); | 146 vals[5] = DtoConstStringPtr("LDC (http://www.dsource.org/projects/ldc)", "llvm.metadata"); |
144 | 147 |
145 LLGlobalVariable* gv = emitDwarfGlobal(getDwarfCompileUnitType(), vals, "llvm.dbg.compile_unit"); | 148 LLGlobalVariable* gv = emitDwarfGlobal(getDwarfCompileUnitType(), vals, "llvm.dbg.compile_unit"); |
146 m->ir.irModule->dwarfCompileUnit = gv; | 149 m->ir.irModule->dwarfCompileUnit = gv; |