Visual Studio Code and Bash on Ubuntu on Windows (WSL) GCC/GDB integration

五迷三道 提交于 2019-11-29 16:53:51

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!