vscode-swift icon indicating copy to clipboard operation
vscode-swift copied to clipboard

Add option to output CodeView debug info for Windows

Open adam-fowler opened this issue 2 years ago • 3 comments

Add build options -Xswiftc -g -Xswiftc -debug-info-format=codeview

adam-fowler avatar Feb 21 '22 17:02 adam-fowler

Regarding debugging options on Windows

Debugging options seem a little light on Windows side if you don't have a full copy of Visual Studio. There is the extension you linked to that uses WinDbg, but it is 3 years old and doesn't have a great deal of downloads over that time, which makes me a little nervous on being reliant on it.

You don't need a fully copy of Visual Studio for debugging on Windows. The only piece of Visual Studio that we need installed for Swift on Windows is the build tools, and even that is strictly for a small subset of headers that are not available standalone (See %ProgramFiles%\Microsoft Visual Studio\2022*\Tools\MSVC\include). The Windows SDK is the one true hard dependency. Both of these are for building code of course, not for debugging.

For debugging, I tend to find that WinDBGX works quite well and is a standalone product that you can install from the Windows Store. This actually is backed by DbgEngine.dll, which is the same debugging path as Visual Studio. You can also use WinDBG, which is part of the debugging tools in the Windows SDK if you so desire.

@compnerd But integration with VSCode seems a little sparse. There are two extensions that add WinDbg support, neither seemed to have been used that much.

adam-fowler avatar Feb 21 '22 18:02 adam-fowler

@compnerd But integration with VSCode seems a little sparse. There are two extensions that add WinDbg support, neither seemed to have been used that much.

Agreed; I'm not sure if we can reasonably get LLDB into a state close to WinDBG though for the time being. Perhaps one thing to consider is to enable VSCode to launch WinDBGX? We should be able to direct the user to the Windows Store if it is not installed, and if it is, we could simply launch it.

I realize that this breaks the IDE feel and nature of VSCode, but it does help simplify development. I am not sure if that is better or worse though.

compnerd avatar Feb 21 '22 18:02 compnerd

users can launch using vscppdbg debugger type if they have a full vs install, right?

stevenbrix avatar May 02 '23 20:05 stevenbrix