Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect fullname under windows when lldb-mi startup path and source path are not in the same partition #98

Open
SquallATF opened this issue Apr 22, 2022 · 0 comments

Comments

@SquallATF
Copy link

SquallATF commented Apr 22, 2022

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,

if (bYesAccessible) {
bYesAccessible is true
#ifdef _WIN32
if (nFoldersBack == (vecPathFolders.size() - 1)) {
// First folder is probably a Windows drive letter ==> must be returned
vwrResolvedPath = vecPathFolders[0] + strTestPath;
} else {

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.

@SquallATF SquallATF changed the title Incorrect fullname under windows when lldb-mi and the source code are not in the same partition Incorrect fullname under windows when lldb-mi startup path and source path are not in the same partition Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant