Skip to content

Commit 101dfd8

Browse files
Do not specify the compilation directory for LLVM modules
In DWARF, the final source code path as determined by the debugger consists of three parts, recorded in .debug_line: 1) The compilation directory (for a compile unit). 2) The "include directory". 3) The file name. If the "include directory" is relative (i. e. does not start with 'C:' or '/'), the final path is going to be the concatenation of all three. We don't control the "include directory" as it comes directly from the managed PDBs, and we can't even know if it's truly relative or an absolute path that just looks like a relative one (e. g. a URL). Concatenating such an absolute path with any compilation directory we might have is going to be wrong, so this change stops emitting it.
1 parent aa8b9b3 commit 101dfd8

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/coreclr/jit/llvmdebuginfo.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,21 +268,18 @@ class TypeDebugInfoModule
268268
DICompileUnit* InitializeCompileUnit()
269269
{
270270
StringRef path = m_context->Module.getName();
271-
StringRef dir;
272271
StringRef name;
273272
size_t dirEnd = path.find_last_of("\\/");
274273
if (dirEnd != StringRef::npos)
275274
{
276-
dir = path.take_front(dirEnd);
277275
name = path.substr(dirEnd + 1);
278276
}
279277
else
280278
{
281-
dir = "";
282279
name = path;
283280
}
284281

285-
DIFile* debugFile = m_diBuilder.createFile(name, dir);
282+
DIFile* debugFile = m_diBuilder.createFile(name, "");
286283
return m_diBuilder.createCompileUnit(DW_LANG_C_plus_plus, debugFile, "ILC", false, "", 1, "",
287284
DICompileUnit::FullDebug, 0, false);
288285
}

0 commit comments

Comments
 (0)