The Visual Studio MI Debug Engine ("MIEngine") provides an open-source Visual Studio Debugger extension that works with MI-enabled debuggers such as gdb and lldb.
MIT License
818
stars
218
forks
source link
`EnsureProperPathSeparators()` causes wrong paths with Cygwin #1418
LinesForFile()
fails to get the source lines for binaries built with Cygwin tools.An incorrect path is returned from
EnsureProperPathSeparators()
: https://github.com/microsoft/MIEngine/blob/ad8e28a50a206ab2beca7c77e6737f6a305f7c12/src/MIDebugEngine/Engine.Impl/SourceLine.cs#L93-L95This is because
EnsureProperPathSeparators()
callsMapWindowsToCygwin()
when debugging with a Cygwin gdb: https://github.com/microsoft/MIEngine/blob/ad8e28a50a206ab2beca7c77e6737f6a305f7c12/src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs#L1525-L1529MapWindowsToCygwin()
callsUnixPathToWindowsPath()
and this is the actual mistake that leads to the incorrect result: https://github.com/microsoft/MIEngine/blob/ad8e28a50a206ab2beca7c77e6737f6a305f7c12/src/MIDebugEngine/Engine.Impl/CygwinFileMapper.cs#L78UnixPathToWindowsPath()
replaces the slashes with backslashes: https://github.com/microsoft/MIEngine/blob/ad8e28a50a206ab2beca7c77e6737f6a305f7c12/src/MICore/PlatformUtilities.cs#L92When
LaunchCygPathAndReadResult()
receives the "Windows" path, it doesn't look like an absolute path anymore, so it prepends the current working drive. https://github.com/microsoft/MIEngine/blob/ad8e28a50a206ab2beca7c77e6737f6a305f7c12/src/MIDebugEngine/Engine.Impl/CygwinFileMapper.cs#L80This fails if, for example, a breakpoint is created,
GetBoundBreakpoint()
gets called, and thefullname
contains a Cygwin path.Expected result for
EnsureProperPathSeparators()
: Input:/c/src/a.cpp
Conversion:/c/src/a.cpp
->/c/src/a.cpp
->/c/src/a.cpp
Output:/c/src/a.cpp
Actual result for
EnsureProperPathSeparators()
: Input:/c/src/a.cpp
Conversion:/c/src/a.cpp
->\c\src\a.cpp
->/c/c/src/a.cpp
Output:/c/c/src/a.cpp