-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
Fix forward-slash path seperator in lldb and add lldb-vscode.exe to release #266
Comments
Thanks for looking into this and providing a provisional patch! Sure, I can try to upstream these changes. They seem straightforward and correct to me. The unittests for Is it possible to trigger and notice the same issue with commandline lldb? I tried to compile a file with a hardcoded path to the source with both path styles, e.g. Btw when poking around with this, I noticed another similar-looking issue. If you build a C++ test example (I built test/hello-exception.cpp from this repo) and inspect the executable with
So something, somewhere, fails to realize that the appended path is absolute. The same issue seems to be present both with the LLVM 13 based release and with the 14 based release (where path separators have been changed to generally prefer forward slashes). If you'd happen to have time, can you manage to pinpoint where this happens? If not I can try to look into it at some point...
Sure, I can do that. It's been discussed before, but last comment on that topic I heard was that it shouldn't be needed as the lldb-vscode extension comes with its own binary. But if there's a usecase for setting up that extension manually, it's quite straightforward to include lldb-vscode.exe in the packages. |
I did some tests and I cannot reproduce this issue. Did you build it with a 13.x release? It mixes forward and backslashes, but all of the paths are valid and correct. |
I tried both with a 13.x and a 14.x based release. But it seems rather elusive. I can reproduce it on a machine running Windows 11 on ARM64, running both the aarch64 and x86_64 versions of the toolchain (with the x86_64 version of the toolchain running emulated). But it doesn't reproduce on a VM running Windows 10 (21H2) on x86_64, nor does it reproduce on Windows Server 2019 (1809) on x86_64. To reproduce it, on the one system where it happens, the key seems to be running the compile process from a directory that isn't parent of the toolchain - i.e. having the toolchain unpacked as e.g. One exact procedure to reproduce it is e.g. this:
So apparently this is some case of code trying to deduce whether two paths share a common path prefix or not, which apparently behaves differently depending on version/platform of Windows. So I guess I'll have to dig in myself if others can't reproduce this... |
In practice, Windows paths can use either backslashes or forward slashes. This fixes an issue reported downstream at mstorsjo/llvm-mingw#266. Differential Revision: https://reviews.llvm.org/D122389
I pushed the LLDB fix upstream in llvm/llvm-project@b548f58. In 0a23956 I pushed a commit to keep the lldb-vscode.exe executable in the distribution packages. |
Very nice. I spent some more time implementing missing windows features in lldb-vsode and fixing issues. I will see if I can get my changes reviewed and merged the official way once I managed to test my changes at least on linux x64 and windows x64. |
Some basics work (so if you're debugging a crash or similar, you can probably use it to get hints about what's happening), but I'm not so sure about anything more fancy, and it probably has quite little real-world testing. Backtraces on crashes, breakpoints, stepping do work, at least in simple tests. Watchpoints - most probably not.
Awesome! I probably don't have much to add in reviews about such patches (and I'm not authoritative to approve them), but feel free to include me as subscriber to follow the progress. |
Actually, this was a total red herring, sorry for the noise. The issue was that I was inspecting the object files with the version of llvm-dwarfdump that ships with Ubuntu 18.04 (in WSL), and that's a rather ancient LLVM 6.0.0. With a more modern version of llvm-dwarfdump it looks ok. |
Anyway, I think this issue can be closed now? The LLDB bugfix has been upstreamed, llvm-mingw is modified to include lldb-vscode in releases, and my red herring has been analyzed and dismissed. |
In practice, Windows paths can use either backslashes or forward slashes. This fixes an issue reported downstream at mstorsjo/llvm-mingw#266. Differential Revision: https://reviews.llvm.org/D122389
In practice, Windows paths can use either backslashes or forward slashes. This fixes an issue reported downstream at mstorsjo/llvm-mingw#266. Differential Revision: https://reviews.llvm.org/D122389
lldb-vscode.exe together with lldb/tools/lldb-vscode/package.json and the few files in lldb-vscode/syntaxes is enough to get debugging in VSCode without Microsofts Cpp or thirdparty extensions working.
This works without the MI interface, by directly communicating to VSCodes debugger API.
But file+linenumber breakpoints don't resolve when launching a target. Function breakpoints do work.
I spent some time debugging, and it turned out to be a path-seperator problem.
My code is built using forwards slashes in the filepaths.
After lldb loads the Dwarf symbols the source file paths are getting transformed to
/my/project/build/c:/my/project/src/somefile.cpp
I made these 2 changes, and it now constructs the correct path for source files.
I haven't run the unittests for FileSpec::GuessPathStyle.
Is it feasible to get this change upstream and to include lldb-vscode.exe in future releases?
The text was updated successfully, but these errors were encountered: