Skip to content

Commit 4c97348

Browse files
author
mikeblome
committed
new section for attach to process and additional versioning monikers
1 parent 5f66431 commit 4c97348

20 files changed

+179
-14
lines changed

docs/linux/cmake-linux-project.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ ms.assetid: f8707b32-f90d-494d-ae0b-1d44425fdc25
77

88
# Configure a Linux CMake project
99

10+
::: moniker range="vs-2015"
11+
12+
Linux support is available in Visual Studio 2017 and later.
13+
14+
::: moniker-end
15+
1016
When you open a folder that contains a CMake project, Visual Studio uses the metadata that CMake produces to configure IntelliSense and builds automatically. Local configuration and debugging settings are stored in JSON files that can optionally be shared with others who are using Visual Studio.
1117

1218
Visual Studio does not modify the CMakeLists.txt files or the original CMake cache, so that others working on the same project can continue to use whatever tools they are already using.

docs/linux/configure-a-linux-project.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ ms.assetid: 4d7c6adf-54b9-4b23-bd23-5de0c825b768
55
---
66
# Configure a Linux project
77

8+
::: moniker range="vs-2015"
9+
10+
Linux support is available in Visual Studio 2017 and later.
11+
12+
::: moniker-end
13+
814
This topic describes how to configure a C++ Linux project as described in [Create a new C++ Linux project in Visual Studio](create-a-new-linux-project.md). For CMake Linux projects, see [Configure a Linux CMake Project ](cmake-linux-project.md).
915

1016
You can configure a Linux project to target a physical Linux machine, a virtual machine, or the [Windows Subsystem for Linux](/windows/wsl/about) (WSL).
@@ -39,7 +45,7 @@ To change settings pertaining to the remote Linux computer, configure the remote
3945

4046
::: moniker range="vs-2019"
4147

42-
**Visual Studio 16.1**: To target Windows Subsystem for Linux, click the down arrow for **Platform Toolset** and choose **WSL_1_0**. The other remote options will disappear and the path to the default WSL shell will appear in their place:
48+
**Visual Studio 2019 version 16.1**: To target Windows Subsystem for Linux, click the down arrow for **Platform Toolset** and choose **WSL_1_0**. The other remote options will disappear and the path to the default WSL shell will appear in their place:
4349

4450
![WSL build machine](media/wsl-remote-vs2019.png)
4551

@@ -114,7 +120,6 @@ You can enable logging to help troubleshoot problems:
114120

115121
::: moniker-end
116122

117-
118123
## See also
119124

120125
[Set compiler and build properties](../build/working-with-project-properties.md)<br/>

docs/linux/connect-to-your-remote-linux-computer.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ ms.assetid: 5eeaa683-4e63-4c46-99ef-2d5f294040d4
77

88
# Connect to your remote Linux computer
99

10+
::: moniker range="vs-2015"
11+
12+
Linux support is available in Visual Studio 2017 and later.
13+
14+
::: moniker-end
15+
1016
::: moniker range="vs-2019"
1117

1218
When you target Windows Subsystem for Linux (WSL) Visual Studio interacts with your Linux distro directly through the file system; no remote connection is necessary.

docs/linux/create-a-new-linux-project.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ ms.assetid: 5d7c1d67-bc31-4f96-8622-2b4cf91372fd
66

77
# Create a new Linux project
88

9+
::: moniker range="vs-2015"
10+
11+
Linux porjects are available in Visual Studio 2017 and later.
12+
13+
::: moniker-end
14+
915
First, make sure you have the **Linux Development Workload** for Visual Studio installed. For more information, see [Download, install, and setup the Linux workload](download-install-and-setup-the-linux-development-workload.md).
1016

1117
When creating a new C++ project in Visual Studio for Linux, you have the choice of creating a Visual Studio project, or a CMake project. This topic describes how to create a Visual Studio project. For information about creating and working with existing CMake Projects, see [Configure a Linux CMake Project ](cmake-linux-project.md).

docs/linux/deploy-run-and-debug-your-linux-project.md

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,48 @@ ms.assetid: f7084cdb-17b1-4960-b522-f84981bea879
66
---
77
# Deploy, run, and debug your Linux project
88

9+
::: moniker range="vs-2015"
10+
11+
Linux support is available in Visual Studio 2017 and later.
12+
13+
::: moniker-end
14+
915
Once you have created a Linux C++ project in Visual Studio and you have connected to the project using the [Linux Connection Manager](connect-to-your-remote-linux-computer.md), you can run and debug the project. You compile, execute, and debug the code on the remote target.
1016

1117
::: moniker range="vs-2019"
1218

13-
**Visual Studio 2019 version 16.1** You can target different Linux systems for debugging and building. Specify the debug machine on the **General** property page and the debug machine on the **Debugging** property page.
19+
**Visual Studio 2019 version 16.1** You can target different Linux systems for debugging and building. Specify the build machine on the **General** property page and the debug machine on the **Debugging** property page.
1420

1521
::: moniker-end
1622

1723
There are several ways to interact with and debug your Linux project.
1824

1925
- Debug using traditional Visual Studio features, such as breakpoints, watch windows, and hovering over a variable. Using these methods, you may debug as you normally would for other project types.
2026

21-
- View output from the target computer in a special Linux Console window. You can also use the console to send input to the target computer.
27+
- View output from the target computer in the Linux Console window. You can also use the console to send input to the target computer.
2228

2329
## Debug your Linux project
2430

2531
1. Select debugging mode in the **Debugging** property page.
2632

33+
34+
35+
::: moniker range="vs-2019"
36+
37+
GDB is used to debug applications running on Linux. When debugging on a remote system (not WSL) GDB can run in two different modes, which can be selected from the **Debugging Mode** option in the project's **Debugging** property page:
38+
39+
![GDB options](media/vs2019-debugger-settings.png)
40+
41+
::: moniker-end
42+
43+
::: moniker range="vs-2017"
44+
2745
GDB is used to debug applications running on Linux. GDB can run in two different modes, which can be selected from the **Debugging Mode** option in the project's **Debugging** property page:
2846

29-
![GDB options](media/settings_debugger.png)
47+
![GDB options](media/vs2017-debugger-settings.png)
48+
49+
::: moniker-end
50+
3051

3152
- In **gdbserver** mode, GDB is run locally, which connects to gdbserver on the remote system. Note that this is the only mode that the Linux Console window supports.
3253

@@ -77,12 +98,31 @@ There are several ways to interact with and debug your Linux project.
7798

7899
`handle SIGILL nostop noprint`
79100

101+
## Debug with Attach to Process
102+
103+
The [Debugging](debugging-linux.md) property page for Visual Studio projects, and the **Launch.vs.json** settings for CMake projects, have settings that enable you to attach to a running process. If you require additional control beyond what is provided in those settings, you can place a file named `Microsoft.MIEngine.Options.xml` in the root of your solution or workspace. Here is a simple example:
104+
105+
```xml
106+
<?xml version="1.0" encoding="utf-8"?>
107+
<SupplementalLaunchOptions>
108+
<AttachOptions>
109+
<AttachOptionsForConnection AdditionalSOLibSearchPath="/home/user/solibs">
110+
<ServerOptions MIDebuggerPath="C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\Common7\IDE\VC\Linux\bin\gdb\7.9\x86_64-linux-gnu-gdb.exe"
111+
ExePath="C:\temp\ConsoleApplication17\ConsoleApplication17\bin\x64\Debug\ConsoleApplication17.out"/>
112+
<SetupCommands>
113+
<Command IgnoreFailures="true">-enable-pretty-printing</Command>
114+
</SetupCommands>
115+
</AttachOptionsForConnection>
116+
</AttachOptions>
117+
</SupplementalLaunchOptions>
118+
```
119+
120+
The **AttachOptionsForConnection** has most of the attributes you might need. The example above shows how to specify a location to search for additional .so libraries. The child element **ServerOptions** enables attaching to the remote process with gdbserver instead. To do that you need to specify a local gdb client (the one shipped in Visual Studio 2017 is shown above) and a local copy of the binary with symbols. The **SetupCommands** element enables you to pass commands directly to gdb. You can find all the options available in the [LaunchOptions.xsd schema](https://github.com/Microsoft/MIEngine/blob/master/src/MICore/LaunchOptions.xsd) on GitHub.
121+
80122
## Next steps
81123

82124
- To debug ARM devices on Linux, see this blog post: [Debugging an embedded ARM device in Visual Studio](https://blogs.msdn.microsoft.com/vcblog/2018/01/10/debugging-an-embedded-arm-device-in-visual-studio/).
83125

84-
- To debug using the **Attach to Process** command, see this blog post: [Linux C++ Workload improvements to the Project System, Linux Console Window, rsync and Attach to Process](https://blogs.msdn.microsoft.com/vcblog/2018/03/13/linux-c-workload-improvements-to-the-project-system-linux-console-window-rsync-and-attach-to-process/).
85-
86126
## See also
87127

88128
[C++ Debugging Properties (Linux C++)](prop-pages/debugging-linux.md)

docs/linux/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: Create and debug applications running on Linux.
66

77
# Linux Development with C++ Documentation
88

9-
Use Visual Studio 2017 to create and debug applications running on Linux.
9+
Use Visual Studio 2017 and later to create and debug applications running on Linux remote machines or Windows Subsystem for Linux.
1010

1111
<ul class="panelContent cardsF">
1212
<li>
@@ -59,8 +59,8 @@ Use Visual Studio 2017 to create and debug applications running on Linux.
5959
<div class="cardPadding">
6060
<div class="card">
6161
<div class="cardText">
62-
<h3><a href="http://github.com/cpp/overview/visual-cpp-in-visual-studio.md">Visual C++</a></h3>
63-
<p><a href="http://github.com/cpp/overview-of-cpp-development">IDE and Tools for Visual C++ Development</a></p>
62+
<h3><a href="http://github.com/cpp/overview/visual-cpp-in-visual-studio.md">C++ in Visual Studio</a></h3>
63+
<p><a href="http://github.com/cpp/overview-of-cpp-development">Overview of C++ development in Visual Studio</a></p>
6464
</div>
6565
</div>
6666
</div>

docs/linux/linux-asan-configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ ASan is a runtime memory error detector for C/C++ that catches the following err
1919
- Use after scope
2020
- Initialization order bugs
2121

22-
When ASan detects an error it stops execution immediately. When you run an ASan-enabled program in the debugger, you see a message that describes the type of error, the memory address, and the location in the source file where the error occurred:
22+
When ASan detects an error, it stops execution immediately. When you run an ASan-enabled program in the debugger, you see a message that describes the type of error, the memory address, and the location in the source file where the error occurred:
2323

2424
![ASan error message](media/asan-error.png)
2525

2626
You can also view the full ASan output (including where the corrupted memory was allocated/deallocated) in the Debug pane of the output window.
2727

2828
## Enable ASan for MSBuild-based Linux projects
2929

30-
To enable ASan for MSBuild-based Linux projects,right-click on the project in **Solution Explorer** and select **Properties**. Next, navigate to **Configuration Properties** > **C/C++** > **Sanitizers**. ASan is enabled via compiler and linker flags and requires recompilation in order to work.
30+
To enable ASan for MSBuild-based Linux projects, right-click on the project in **Solution Explorer** and select **Properties**. Next, navigate to **Configuration Properties** > **C/C++** > **Sanitizers**. ASan is enabled via compiler and linker flags and requires recompilation in order to work.
3131

3232
![Enable ASan for an MSBuild project](media/msbuild-asan-prop-page.png)
3333

-29.6 KB
Binary file not shown.
109 KB
Loading
46 KB
Loading

docs/linux/prop-pages/build-events-linux.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ ms.assetid: 165d3690-5bd8-4b0b-bc66-8b699d85a61b
55
---
66
# Build Event Properties (Linux C++)
77

8+
::: moniker range="vs-2015"
9+
10+
Linux support is available in Visual Studio 2017 and later.
11+
12+
::: moniker-end
13+
14+
::: moniker range=">=vs-2017"
15+
816
## Pre-Build Event
917

1018
Property | Description
@@ -58,3 +66,7 @@ Command Line | Specifies a command line for the post-build event tool to run on
5866
Description | Specifies a description for the post-build event tool to display.
5967
Use In Build | Specifies whether this build event is excluded from the build for the current configuration.
6068
Additional files to copy | Specifies additional files to copy from the remote system. Optionally the list can be provided as a remote to local mapping pairs using a syntax like this: fullremotepath1:=fulllocalpath1;fullremotepath2:=fulllocalpath2, where a remote file can be copied to the specified location on the local machine.
69+
70+
::: moniker-end
71+
72+

docs/linux/prop-pages/c-cpp-linux.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ f1_keywords: []
77

88
# C/C++ Properties (Linux C++)
99

10+
::: moniker range="vs-2015"
11+
12+
Linux support is available in Visual Studio 2017 and later.
13+
14+
::: moniker-end
15+
16+
::: moniker range=">=vs-2017"
17+
1018
## General
1119

1220
Property | Description | Choices
@@ -70,4 +78,4 @@ Property | Description | Choices
7078
Compile As | Select compile language option for .c and .cpp files. 'Default' will detect based on .c or .cpp extention. (-x c, -x c++) | **Default** - Default.<br/>**Compile as C Code** - Compile as C Code.<br/>**Compile as C++ Code** - Compile as C++ Code.<br/>
7179
Forced Include Files | One or more forced include files (-include [name])
7280

73-
## Additional Options
81+
::: moniker-end

docs/linux/prop-pages/copy-sources-project.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,20 @@ ms.assetid: 1a44230d-5dd8-4d33-93b4-e77e03e00150
55
---
66
# Copy Sources Project Properties (Linux C++)
77

8+
::: moniker range="vs-2015"
9+
10+
Linux support is available in Visual Studio 2017 and later.
11+
12+
::: moniker-end
13+
14+
::: moniker range=">=vs-2017"
15+
816
The properties set on this property page apply to all files in the project except whose file-level properties are set.
917

1018
Property | Description
1119
--- | ---
1220
Sources To Copy | Specifies the sources to copy to the remote system. Changing this list might shift or otherwise affect the directory structure where files are copied to on the remote system.
1321
Copy Sources | Specifies whether to copy the sources to the remote system.
1422
Additional Sources To Copy | Specifies additional sources to copy to the remote system. Optionally the list can be provided as a local to remote mapping pairs using a syntax like this: fulllocalpath1:=fullremotepath1;fulllocalpath2:=fullremotepath2, where a local file can be copied to the specified remote location on the remote system.
23+
24+
::: moniker-end

docs/linux/prop-pages/custom-build-step-linux.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,21 @@ ms.assetid: 77a9c1fb-7c41-4a9b-9418-18ac17ce4e74
55
---
66
# Custom Build Step Properties (Linux C++)
77

8+
::: moniker range="vs-2015"
9+
10+
Linux support is available in Visual Studio 2017 and later.
11+
12+
::: moniker-end
13+
14+
::: moniker range=">=vs-2017"
15+
816
Property | Description
917
--- | ---
1018
Command Line | The command to be executed by the custom build step.
1119
Description | A message that's displayed when the custom build step runs.
1220
Outputs | The output file that the custom build step generates. This setting is required so that incremental builds work correctly.
1321
Additional Dependencies | A semicolon-delimited list of any additional input files to use for the custom build step.
1422
Execute After and Execute Before | These options define when the custom build step is run in the build process, relative to the listed targets. The most commonly listed targets are BuildGenerateSources, BuildCompile, and BuildLink, because they represent the major steps in the build process. Other often-listed targets are Midl, CLCompile, and Link.
15-
Treat Output As Content | This option is only meaningful for Microsoft Store or Windows Phone apps, which include all content files in the .appx package.
23+
Treat Output As Content | This option is only meaningful for Microsoft Store or Windows Phone apps, which include all content files in the .appx package.
24+
25+
::: moniker-end

docs/linux/prop-pages/debugging-linux.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ ms.assetid: 0c1c0fcc-a49b-451c-a5cb-ce9711fac064
55
---
66
# C++ Debugging Properties (Linux C++)
77

8+
::: moniker range="vs-2015"
9+
10+
Linux support is available in Visual Studio 2017 and later.
11+
12+
::: moniker-end
13+
14+
::: moniker range=">=vs-2017"
15+
816
Property | Description | Choices
917
--- | ---| ---
1018
Remote debug machine | **Visual Studio 2019 version 16.1**: Specifies the machine to debug the program on. Can be different than the remote build machine that is specified on the [General](general-linux.md) page.
@@ -21,3 +29,5 @@ Debug Child Processes | Specifies whether to enable debugging of child processes
2129
Enable Python Pretty Printing | Enable pretty printing of expression values. Only supported in gdb debugging mode.
2230
Visualization File | Default native visualization file (.natvis) containing visualization directives for SLT types. Other .natvis files that belong to the current solution will be loaded automatically.
2331
Additional Sources File Path Map | Additional path equivalences for the debugger to use to map Windows source file names to Linux source file names. The format is "\<windows-path>=\<linux-path>;...". A source file name found under the Windows path will be referenced as if is has been found in the same relative position under the Linux path. Files found in the local project do not require additional mapping.
32+
33+
::: moniker-end

docs/linux/prop-pages/directories-linux.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,20 @@ ms.assetid: 12d45b93-0a5c-455e-b12a-9b9aad9a6d6c
55
---
66
# VC++ Directories (Linux C++)
77

8+
::: moniker range="vs-2015"
9+
10+
Linux support is available in Visual Studio 2017 and later.
11+
12+
::: moniker-end
13+
14+
::: moniker range=">=vs-2017"
15+
816
Property | Description
917
--- | ---
1018
Include Directories | Path to use when searching for include files while building a VC++ project. Corresponds to environment variable INCLUDE.
1119
Library Directories | Path to use when searching for library files while building a VC++ project. Corresponds to environment variable LIB.
1220
Source Directories | Path to use when searching for source files to use for IntelliSense.
1321
Exclude Directories | Path to skip when searching for scan dependencies.
22+
23+
::: moniker-end
24+

docs/linux/prop-pages/general-linux.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ ms.assetid: 56c800a9-3df9-4196-87b2-81adb00e4767
55
---
66
# General Properties (Linux C++)
77

8+
::: moniker range="vs-2015"
9+
10+
Linux support is available in Visual Studio 2017 and later.
11+
12+
::: moniker-end
13+
14+
::: moniker range=">=vs-2017"
15+
816
Property | Description | Choices
917
--- | ---| ---
1018
Output Directory | Specifies a relative path to the output file directory; can include environment variables.
@@ -19,3 +27,6 @@ Remote Build Root Directory | Specifies a path to a directory on the remote mach
1927
Remote Build Project Directory | Specifies a path to a directory on the remote machine or device for the project.
2028
Configuration Type | Specifies the type of output this configuration generates. | **Dynamic Library (.so)** - Dynamic Library (.so)<br>**Static library (.a)** - Static Library (.a)<br>**Application (.out)** - Application (.out)<br>**Makefile** - Makefile<br>
2129
Use of STL | Specifies which C++ Standard Library to use for this configuration. | **Shared GNU Standard C++ Library**<br>**Static GNU Standard C++ Library (-static)**<br>
30+
31+
::: moniker-end
32+

docs/linux/prop-pages/linker-linux.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ ms.assetid: a0243a94-8164-425b-b2fe-b84ff363d546
55
---
66
# Linker Properties (Linux C++)
77

8+
::: moniker range="vs-2015"
9+
10+
Linux support is available in Visual Studio 2017 and later.
11+
12+
::: moniker-end
13+
14+
::: moniker range=">=vs-2017"
15+
816
## General
917

1018
Property | Description | Choices
@@ -49,3 +57,5 @@ Mark Variables ReadOnly After Relocation | This option marks variables read-only
4957
Enable Immediate Function Binding | This option marks object for immediate function binding.
5058
Do Not Require Executable Stack | This option marks output as not requiring executable stack.
5159
Whole Archive | Whole Archive uses all code from Sources and Additional Dependencies.
60+
61+
::: moniker-end

docs/linux/prop-pages/makefile-linux.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ ms.assetid: 3dec6853-43f6-412b-9806-9bfad333a204
55
---
66
# Makefile Project Properties (Linux C++)
77

8+
::: moniker range="vs-2015"
9+
10+
Linux support is available in Visual Studio 2017 and later.
11+
12+
::: moniker-end
13+
14+
::: moniker range=">=vs-2017"
15+
816
This is a partial list of the properties available in a Linux Makefile project. Many Makefile project properties are identical to the Linux C++ Console Application project properties.
917

1018
## General
@@ -95,3 +103,5 @@ Build Command Line | Specifies the command line to run for the 'Build' command.
95103
Rebuild All Command Line | Specifies the command line to run for the 'Rebuild All' command. This is executed on the remote system.
96104
Clean Command Line | Specifies the command line to run for the 'Clean' command. This is executed on the remote system.
97105
Outputs | Specifies the outputs generated by the remote build on the remote system.
106+
107+
::: moniker-end

0 commit comments

Comments
 (0)