Skip to content

Commit 61631aa

Browse files
committed
refresh of Linux run and debugging content
1 parent d2e29d5 commit 61631aa

8 files changed

+72
-44
lines changed

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

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: "Configure a Linux Project | Microsoft Docs"
2+
title: "Configure a Linux project | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/16/2016"
4+
ms.date: "11/06/2017"
55
ms.reviewer: ""
66
ms.suite: ""
77
ms.technology: ["cpp-linux"]
@@ -13,29 +13,28 @@ ms.author: "corob"
1313
manager: "ghogen"
1414
---
1515

16-
# Configure a Linux Project
16+
# Configure a Linux project
1717

18-
## General Settings
19-
A variety of options can be configured for a Linux project with Visual Studio. To view these options, select the **Project > Properties** menu, or right click on the project in **Solution Explorer** and select **Properties** from the context menu:
18+
## General settings
19+
A variety of options can be configured for a Linux project with Visual Studio. To view these options, select the **Project > Properties** menu, or right click on the project in **Solution Explorer** and select **Properties** from the context menu. The **General** settings appear.
2020

2121
![General configuration](media/settings_general.png)
2222

2323
By default, an executable (.out) is built with the tool. To build a static or dynamic library, or to use an existing Makefile, use the **Configuration Type** selection.
2424

25-
## Remote Settings
26-
To change settings pertaining to the remote Linux computer, select the **Remote settings** item:
25+
## Remote settings
26+
To change settings pertaining to the remote Linux computer, configure the remote options that appear in the **General** settings:
2727

28-
![Remote settings](media/settings_remote.png)
28+
* To change the target Linux computer, use the **Remote Build Machine** entry. This will allow you to select one of the connections created previously. To create a new entry, please see the [Connecting to Your Remote Linux Computer](connect-to-your-remote-linux-computer.md) section.
2929

30-
* To change the target Linux computer, use the **Target machine** entry. This will allow you to select one of the connections created previously. To create a new entry, please see the [Connecting to Your Remote Linux Computer](connect-to-your-remote-linux-computer.md) section.
30+
* The **Remote Build Root Directory** determines the root location of where the project is built on the remote Linux computer. This will default to **~/projects** unless changed.
3131

32-
* The **Remote Root Directory** determines the root location of where the project is built on the remote Linux computer. This will default to **~/projects** unless changed.
32+
* The **Remote Build Project Directory** is where this specific project will be built on the remote Linux computer. This will default to **$(RemoteRootDir)/$(ProjectName)**, which will expand to a directory named after the current project, under the root directory set above.
3333

34-
* The **Remote Project Directory** is where this specific project will be built on the remote Linux computer. This will default to **$(RemoteRootDir)/$(ProjectName)**, which will expand to a directory named after the current project, under the root directory set above.
34+
> [!NOTE]
35+
> To change the default C and C++ compilers, or the Linker and Archiver used to build the project, use the appropriate entries in the **C/C++ > General** section and the **Linker > General** section. These could be set to use a certain version of GCC, or even the Clang compiler, for example.
3536
36-
* Finally, to change the default C and C++ compilers, or the Linker and Archiver used to build the project, use the appropriate entries in the **Tools Defaults** section. These could be set to use a certain version of GCC, or even the Clang compiler, for example.
37-
38-
## VC++ Directories
37+
## VC++ directories
3938
By default, Visual Studio does not include any system-level include files from the Linux computer. For example, items in the **/usr/include** directory are not present in Visual Studio. For full [IntelliSense](/visualstudio/ide/using-intellisense) support, you will need to copy those files to some location on your development computer and point Visual Studio to this location. One option is to use scp (Secure Copy) to copy the files. On Windows 10, you can use [Bash on Windows](https://msdn.microsoft.com/commandline/wsl/about) to run scp. For previous versions of Windows, you could use something like [PSCP (PuTTY Secure Copy)](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html).
4039

4140
You can copy the files by using a command similar to the following:
@@ -48,7 +47,7 @@ Once the files are copied, use the **VC++ Directories** item in Project properti
4847

4948
![VC++ Directories](media/settings_directories.png)
5049

51-
## Copy Sources
50+
## Copy sources
5251
When building, the source files on your development PC are copied to the Linux computer and compiled there. By default, all sources in the Visual Studio project are copied to the locations set in the settings above. However, additional sources can also be added to the list, or copying sources can be turned off entirely, which is the default for a Makefile project.
5352

5453
* **Sources to copy** determines which sources are copied to the remote computer. By default, the **@(SourcesToCopyRemotely)** defaults to all source code files in the project, but does not include any asset/resource files, such as images.
@@ -59,8 +58,8 @@ When building, the source files on your development PC are copied to the Linux c
5958

6059
`C:\Projects\ConsoleApplication1\MyFile.cpp:=~/projects/ConsoleApplication1/ADifferentName.cpp;C:\Projects\ConsoleApplication1\MyFile2.cpp:=~/projects/ConsoleApplication1/ADifferentName2.cpp;`
6160

62-
## Build Events
63-
Since all compilation is happening on a remote computer, several additional Build Events have been added to the Build Events section in Project Properties. These are **Remote Pre-Build Event**, **Remote Pre-Link Event**, and **Remove Post-Build Event**, and will occur on the remote computer before or after the individual steps in the process.
61+
## Build events
62+
Since all compilation is happening on a remote computer, several additional Build Events have been added to the Build Events section in Project Properties. These are **Remote Pre-Build Event**, **Remote Pre-Link Event**, and **Remote Post-Build Event**, and will occur on the remote computer before or after the individual steps in the process.
6463

6564
![Build Events](media/settings_buildevents.png)
6665

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: "Connect to Your Remote Linux Computer | Microsoft Docs"
2+
title: "Connect to your remote Linux computer | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/16/2016"
4+
ms.date: "11/06/2017"
55
ms.reviewer: ""
66
ms.suite: ""
77
ms.technology: ["cpp-linux"]
@@ -13,7 +13,7 @@ ms.author: "corob"
1313
manager: "ghogen"
1414
---
1515

16-
# Connect to Your Remote Linux Computer
16+
# Connect to Your remote Linux computer
1717

1818
When building, Linux code is copied to your remote Linux computer and then compiled on that system according to the settings chosen in Visual Studio. To setup this remote connection:
1919

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Create a New Linux Project | Microsoft Docs"
2+
title: "Create a new Linux project | Microsoft Docs"
33
ms.custom: ""
44
ms.date: "08/16/2017"
55
ms.reviewer: ""
@@ -13,7 +13,7 @@ ms.author: "corob"
1313
manager: "ghogen"
1414
---
1515

16-
# Create a New Linux Project
16+
# Create a new Linux project
1717

1818
To create a new Linux project in Visual Studio, do the following:
1919

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: "Deploy, Run, and Debug Your Linux Project | Microsoft Docs"
2+
title: "Deploy, run, and debug Your Linux project | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/16/2016"
4+
ms.date: "11/06/2017"
55
ms.reviewer: ""
66
ms.suite: ""
77
ms.technology: ["cpp-linux"]
@@ -13,37 +13,66 @@ ms.author: "corob"
1313
manager: "ghogen"
1414
---
1515

16-
# Deploy, Run, and Debug Your Project
16+
# Deploy, run, and debug your Linux project
1717

18-
Now that the project is created, you will need to connect to your Linux computer, which is where the code will be compiled, executed, and debugged.
19-
20-
1. Set the remote target architecture using the standard dropdown in Visual Studio as shown:
21-
![Remote Architecture](media/architecture.png)
18+
Once you have created a Linux project and you have connected to the project using the [Linux Connection Manager](../linux/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.
2219

2320
There are several ways to interact with and debug your Linux project.
2421

25-
* The traditional Visual Studio features, such as breakpoints, watch windows, and hovering over a variable, will all work as expected, so you may debug as you normally would.
26-
* A special Linux Console window can be opened with the **Debug > Linux Console** menu item.
22+
* Debug using traditional Visual Studio features, such as breakpoints, watch windows, and hovering over a variable, so you may debug as you normally would in other project types.
23+
* View output from the target computer in a special Linux Console window, which you can also use to send input to the target computer.
24+
25+
## Debug your Linux project
26+
27+
1. Select debugging mode in the **Debugging** property page.
28+
29+
GDB is used to debug applications running on Linux. However, this can run in two different modes, which can be selected from the **Debugging Mode** option in the project's **Debugging** property page:
30+
31+
![GDB options](media/settings_debugger.png)
32+
33+
- In **gdbserver** mode, GDB is run locally which connects to gdbserver running on the remote system. Note that this is the only mode which the Linux Console window supports.
34+
35+
- In **gdb** mode, the Visual Studio debugger drives GDB on the remote system, which is more compatible if the local version of GDB is not compatible with the version installed on the target computer. |
36+
37+
> [!NOTE]
38+
> If you are unable to hit breakpoints in gdbserver debugging mode, try gdb mode. gdb must first be [installed](../linux/download-install-and-setup-the-linux-development-workload.md) on the remote target.
39+
40+
2. Select the remote target using the standard **Debug** toolbar in Visual Studio.
41+
42+
When the remote target is available, you will see it listed by either name or IP address.
43+
44+
![Remote target](media/remote_target.png)
45+
46+
If you have not yet connected to the remote target, you will see an instruction to use [Linux Connection Manager](../linux/connect-to-your-remote-linux-computer.md) to connect to the remote target.
47+
48+
![Remote Architecture](media/architecture.png)
49+
50+
3. Set a breakpoint by clicking in the left gutter of some code that you know will execut. A red circle appears.
51+
52+
4. Press **F5** (or **Debug > Start Debugging**) to start debugging.
53+
54+
When you start debugging the application first will be compiled on the remote target. Any compilation errors will appear in the **Error List** window.
55+
56+
If there are no errors, the app will start and the debugger will pause at the breakpoint.
57+
58+
![Hit a breakpoint](media/hit_breakpoint.png)
59+
60+
Now, you can interact with the application in it's current state, view variables, and step through code by pressing command keys such as **F10** or **F11**.
61+
62+
4. If you want to use the Linux Console to interact with your app, select **Debug > Linux Console**.
2763

2864
![Linux Console menu](media/consolemenu.png)
2965

3066
This console will display any console output from the target computer as well as take input and send it to the target computer.
3167

3268
![Linux Console window](media/consolewindow.png)
3369

70+
## Configure other debugging options
71+
3472
* Command line arguments can be passed to the executable using the **Program Arguments** item in the project's **Debugging** property page.
3573

3674
![Program Arguments](media/settings_programarguments.png)
3775

38-
* GDB is used to debug applications running on Linux. However, this can run in two different modes, which can be selected from the **Debugging Mode** option in the project's **Debugging** property page:
39-
40-
![GDB options](media/settings_debugger.png)
41-
42-
| Selection | Description
43-
| --------- | ---
44-
| gdbserver | GDB is run locally which connects to gdbserver running on the remote system. Note that this is the only mode which the Linux Console window supports.
45-
| gdb | the Visual Studio debugger drives GDB on the remote system, which is more compatible if the local version of GDB is not compatible with the version installed on the target computer
46-
4776
* Specific debugger options can be passed to GDB using the **Additional Debugger Commands** entry. For example, you might want to ignore SIGILL (illegal instruction) signals. You could use the **handle** command to achieve this. by adding the following to the **Additional Debugger Commands** entry as shown above:
4877

4978
```handle SIGILL nostop noprint```

docs/linux/download-install-and-setup-the-linux-development-workload.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Download, Install and Setup the Linux Workload | Microsoft Docs"
2+
title: "Download, install, and setup the Linux workload | Microsoft Docs"
33
ms.custom: ""
44
ms.date: "11/16/2016"
55
ms.reviewer: ""
@@ -13,16 +13,16 @@ ms.author: "corob"
1313
manager: "ghogen"
1414
---
1515

16-
# Download, Install and Setup the Linux Workload
16+
# Download, install, and setup the Linux workload
1717

18-
## Visual Studio Setup
18+
## Visual Studio setup
1919
1. Start the Visual Studio installer and select the **Linux development with C++** workload.
2020

2121
![Visual C++ for Linux Development extension](media/linuxworkload.png)
2222

2323
2. Click **Install** to continue with the installation.
2424

25-
## Linux Setup
25+
## Linux setup
2626
The target Linux computer must have **openssh-server**, **g++**, **gdb**, and **gdbserver** installed, and the ssh daemon must be running. If these are not already present, you can install them as follows:
2727

2828
1. At a shell prompt on your Linux computer, run:

docs/linux/media/architecture.png

8.48 KB
Loading
61.1 KB
Loading
-23 KB
Binary file not shown.

0 commit comments

Comments
 (0)