Incorrect fullname under windows when lldb-mi startup path and source path are not in the same partition
lldb-mi.exe under E:\llvm14\bin\, and source file under K:\Work\cmaketest\hello.c, mingw crt source under E:\Source\git\mingw-w64\mingw-w64-crt, the -stack-list-frames result is
stack: [frame={level=0,addr=0x00007ff6449f148d,func=main,file=hello.c,fullname=/K:/Work/cmaketest/hello.c,line=5},frame={level=1,addr=0x00007ff6449f13d7,func=__tmainCRTStartup,file=crtexe.c,fullname=E:/Source/git/mingw-w64/mingw-w64-crt/crt/crtexe.c,line=321},frame={level=2,addr=0x00007ff6449f1436,func=mainCRTStartup,file=crtexe.c,fullname=E:/Source/git/mingw-w64/mingw-w64-crt/crt/crtexe.c,line=202},frame={level=3,addr=0x00007fff162d244d,func=BaseThreadInitThunk,file=??,fullname=??,line=-1},frame={level=4,addr=0x00007fff16fadf88,func=RtlUserThreadStart,file=??,fullname=??,line=-1}]
when I start lldb-mi.exe from C:\, the -stack-list-frames changed to
stack=[frame={level="0",addr="0x00007ff6449f1486",func="main",file="hello.c",fullname="/K:/Work/cmaketest/hello.c",line="4"},frame={level="1",addr="0x00007ff6449f13d7",func="__tmainCRTStartup",file="crtexe.c",fullname="/E:/Source/git/mingw-w64/mingw-w64-crt/crt/crtexe.c",line="321"},frame={level="2",addr="0x00007ff6449f1436",func="mainCRTStartup",file="crtexe.c",fullname="/E:/Source/git/mingw-w64/mingw-w64-crt/crt/crtexe.c",line="202"},frame={level="3",addr="0x00007fff162d244d",func="BaseThreadInitThunk",file="??",fullname="??",line="-1"},frame={level="4",addr="0x00007fff16fadf88",func="RtlUserThreadStart",file="??",fullname="??",line="-1"}]
-stack-list-frames returned by gdb
stack: [frame={level=0,addr=0x00007ff6449f148d,func=main,file=K:/Work/cmaketest/hello.c,fullname=K:\Work\cmaketest\hello.c,line=5,arch=i386:x86-64}]
CMICmnLLDBDebugSessionInfo::ResolvePath method will check path is accessible.
When the source file E:\Source\git\mingw-w64\mingw-w64-crt\crt\crtexe.c and the lldb-mi startup path are in the same partition, the last detected path is /Source/git/mingw-w64/ mingw-w64-crt/crt/crtexe.c, https://github.com/lldb-tools/lldb-mi/blob/2388bd74133bc21eac59b2e2bf97f2a30770a315/src/MICmnLLDBDebugSessionInfo.cpp#L339 bYesAccessible is true
https://github.com/lldb-tools/lldb-mi/blob/2388bd74133bc21eac59b2e2bf97f2a30770a315/src/MICmnLLDBDebugSessionInfo.cpp#L340-L344
then will put drive letter before path and return it.
But if the source file K:\Work\cmaketest\hello.c and lldb-mi startup path are not in the same partition, /Work/cmaketest/hello.c is not accessible, then will test next path/K:/Work/cmaketest/hello.c and return it.
CMICmnLLDBDebugSessionInfo::ResolvePath has another problem, it also returns the wrong path if the parent directory contains a file with the same name as the source file. For example, my source file path is K:\Work\cmaketest\hello.c. If there is a file in K:\hello.c at this time, according to the current algorithm, /hello.c can be accessed, will directly return K:/hello.c.