Currently Visual Studio Code does not support debugging inside windows. How to setup vscode to use gcc/gdb from bash on windows?
问题:
回答1:
Here is the solution:
With the release of Windows 10 Creators Update, you will now be able to use Visual Studio Code and the Microsoft C/C++ extension to debug your Windows Subsystem for Linux (WSL) Bash on Ubuntu projects.
https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/Debugger/gdb/Windows%20Subsystem%20for%20Linux.md
回答2:
Not easily, and it might not work correctly. First, you have to get sshd running on port 2020.
To do this, edit
/etc/ssh/sshd_config
and set the options:
Port 2020
ListenAddress 0.0.0.0
UsePrivilegeSeparation no
PasswordAuthentication yes
Then, run sudo service ssh start
inside of a WSL console.
Then, connect with VS Code to 127.0.0.1:2020
with your WSL username and password.
I'm not sure how well it will work, but that's how you can do it.
Source: https://github.com/Microsoft/BashOnWindows/issues/300
Better support and integration is planned. If you're curious, take a look at Alex Ionescu's slides from his talk from BlackHat 2016 (on his github, go to the repo "lxss" and view the PDF). He describes an undocumented COM interface attached to the lxsessionmanager
Windows service and an undocumented device /dev/lxss
in WSL, which is actually a bus for Win32 <-> WSL IPC. He demonstrated a proof-of-concept server and client that launched a Windows application through the bus from inside the WSL Linux Instance.