Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for WSL #626

Merged
merged 3 commits into from
Apr 11, 2017
Merged

Add documentation for WSL #626

merged 3 commits into from
Apr 11, 2017

Conversation

pieandcakes
Copy link
Contributor

@pieandcakes pieandcakes commented Apr 10, 2017

* [Visual Studio Code](https://code.visualstudio.com) + Microsoft C/C++ extension for VSCode.

## How-To
To debug, commands will be routed from Windows through `bash.exe` to setup debugging. Because our extension runs as a 32-bit process, it will need to use the `C:\Windows\SysNative` folder to access the executable that is normally in `C:\Windows\System32`. We will be using the `"pipeTransport"` ability within the extension to do debugging and `"sourceFileMap"` to map the source from the subsystem's paths back to Windows path.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which executable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bash.exe . I'll add that in.

@timsneath
Copy link

Do we want to include anything about configuration of c_cpp_properties.json so that Linux header files are found instead of Windows ones?

I included the following in mine:

"includePath": [
                "${localappdata}/lxss/rootfs/usr/include",
                "${localappdata}/lxss/rootfs/usr/local/include"            
            ],

@bitcrazed pointed out that this could theoretically be risky. One alternative could be to tell users to copy header files from /usr/include to a location outside of the lxss folder and use that for the includePath, but the problem there is that header updates won't get automatically pulled through. I've stuck with the original solution for now though.

@pieandcakes
Copy link
Contributor Author

@timsneath Thanks for the info. I work on the debugging experience but hopefully @bobbrow @ronglums @sean-mcmanus can chime in. Are there plans for additional instructions/configurations from a Language Server standpoint that you will be providing to help this experience?

Copy link

@timsneath timsneath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments enclosed...

@@ -0,0 +1,88 @@
# Windows 10's Windows Subsystem for Linux
With the release of Windows 10 Creator's 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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the official name is "Windows 10 Creators Update" (no apostrophe) - see https://blogs.windows.com/buildingapps/2017/04/05/windows-10-creators-update-creators-update-sdk-released/ for an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


## Prerequisites
* [Windows 10 Creator's Update with Windows Subsystem for Linux and Bash.](https://msdn.microsoft.com/en-us/commandline/wsl/install_guide)
* Install g++/gcc and gdb to allow compiling and debugging.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In WSL, right? Not in Windows? Probably want to make that really clear. Perhaps worth calling out sudo apt get build-essential as the right command to get stuff set up, unless you think the audience will already know all this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added WSL to the sentence. The command you provided isn't correct but i'll add something in regards to using the package manager to install tools.

To debug, commands will be routed from Windows through `bash.exe` to setup debugging. Because our extension runs as a 32-bit process, it will need to use the `C:\Windows\SysNative` folder to access the `bash.exe` executable that is normally in `C:\Windows\System32`. We will be using the `"pipeTransport"` ability within the extension to do debugging and `"sourceFileMap"` to map the source from the subsystem's paths back to Windows path.

**NOTE: Applications will need to be compiled in the `Windows Subsystem for Linux (WSL)` prior to debugging.**

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth a link back to https://code.visualstudio.com/Docs/editor/debugging so users who aren't familiar with launch.json and debugging in Visual Studio Code in general have a point of reference...? This page also explains how to create a launch.json and the various elements contained within it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timsneath This isn't a tutorial but an addition of documentation within our repo for debugging. As such, I'm assuming that the user knows launch.json

}
```

### Example `launch.json` for Attaching to an Existing Process

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm dumb, but I don't understand when I'd use the latter? This is like Debug / Attach to Process in 'full' VS, right?

Copy link
Contributor Author

@pieandcakes pieandcakes Apr 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have a process already running in Bash on Windows and want to debug it, this is how you do it.

* [Visual Studio Code](https://code.visualstudio.com) + Microsoft C/C++ extension for VSCode.

## How-To
To debug, commands will be routed from Windows through `bash.exe` to setup debugging. Because our extension runs as a 32-bit process, it will need to use the `C:\Windows\SysNative` folder to access the `bash.exe` executable that is normally in `C:\Windows\System32`. We will be using the `"pipeTransport"` ability within the extension to do debugging and `"sourceFileMap"` to map the source from the subsystem's paths back to Windows path.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setup is used as a verb a few times in this document, but when spelled as one word it is a noun. Replace with set up (two words)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@bitcrazed
Copy link

@robotdad Are you able to shed some light on how VC++ for Linux handles headers & Intellisense?

@robotdad
Copy link
Member

For VC Linux support we carry basic IntelliSense for libstdc++, it isn't tailored for any specific Linux system. To get IntelliSense specific to your Linux system you need to copy your include files (or map them to a Windows drive etc.) and give that local path to VS to parse them. That's described here

@pieandcakes pieandcakes merged commit f974963 into master Apr 11, 2017
@bitcrazed
Copy link

🍺 to Marc for NOT instructing users to copy files from %localappdata%\lxss

Using [p]scp to copy files from Linux is a MUCH better bet.

@pieandcakes pieandcakes deleted the users/piel/WSL branch December 28, 2017 22:57
@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants