swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
734 stars 50 forks source link

Add option to output CodeView debug info for Windows #153

Open adam-fowler opened 2 years ago

adam-fowler commented 2 years ago

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

adam-fowler commented 2 years ago

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.

compnerd commented 2 years ago

@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.

stevenbrix commented 1 year ago

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