I'm using CodeLLDB in VSCode, and have the lldb backend pointed to Swift's LLDB lib.
Symbols load and breakpoints work, but as soon as I select a call from the stack and CodeLLDB tries to load local variables, LLDB crashes with this error:
Cannot create Swift scratch context (couldn't load the Swift stdlib)Debug adapter exit code=3221225477 (0xc0000005), signal=null.
I don't see any articles or posts with others having this problem, but it seems like I have everything setup properly. Is this a bug or limitation for Windows? And if so are there any workarounds?
I'm using Swift 5.7 Release, CodeLLDB 1.7.4
This implies that the library search path isn't working for loading the core libraries or dependencies. A workaround would be to use
:image load swiftCore.dll to ensure that the standard library is loaded and thus the scratch context can be created. @Adrian_Prantl was working on some refactorings for lldb that should help make this more robust in the future.
I am having a similar issue. I cannot see any variables. When you say "use
:image load swiftCore.dll", could you please clarify what that means? Where does that go? Thanks.
Awesome! Having VSCode with debugging is going to so amazing
image load -f swiftCore.dll -s 0 does stop the crash and populate the local variable names, but their values are not filled in. And after using the that
po 1 + 1 also doesn't return any value.
I assume -s should be zero since it's a dll, but I did try dumping the address of swiftCore and using the first pointer but that made no difference. Not entirely sure I'm doing this correctly.
I took a screenshot in case that's helpful.
More investigating needs to be done, because this does not make debugging usable by itself. But it's an lldb console command. You can type it directly into the console, or place it your launch.json file like this:
"postRunCommands": ["image load -f swiftCore.dll -s 0"],