You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: "Configure Linux projects to use Address Sanitizer"
3
3
description: "Describes how to configure C++ Linux projects in Visual Studio to use Address Sanitizer."
4
-
ms.date: "05/31/2019"
4
+
ms.date: "06/07/2019"
5
5
---
6
6
7
7
# Configure Linux projects to use Address Sanitizer
8
8
9
-
In Visual Studio 2019 version 16.1, AddressSanitizer (ASan) support is integrated into Linux projects. You can enable ASan for MSBuild-based Linux projects as well as CMake projects. It works on remote Linux systems and on Windows Subsystem for Linux (WSL).
9
+
In Visual Studio 2019 version 16.1, AddressSanitizer (ASan) support is integrated into Linux projects. You can enable ASan for both MSBuild-based Linux projects and CMake projects. It works on remote Linux systems and on Windows Subsystem for Linux (WSL).
10
10
11
11
## About ASan
12
12
@@ -19,15 +19,15 @@ ASan is a runtime memory error detector for C/C++ that catches the following err
19
19
- Use after scope
20
20
- Initialization order bugs
21
21
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. If 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:
23
23
24
24

25
25
26
26
You can also view the full ASan output (including where the corrupted memory was allocated/deallocated) in the Debug pane of the output window.
27
27
28
28
## Enable ASan for MSBuild-based Linux projects
29
29
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 your project to be recompiled to work.
31
31
32
32

33
33
@@ -37,19 +37,19 @@ You can pass optional ASan runtime flags by navigating to **Configuration Proper
37
37
38
38
## Enable ASan for Visual Studio CMake projects
39
39
40
-
To enable ASan for CMake, rightclick on the CMakeLists.txt file in **Solution Explorer** and choose open the**CMake Settings for Project**.
40
+
To enable ASan for CMake, right-click on the CMakeLists.txt file in **Solution Explorer** and choose **CMake Settings for Project**.
41
41
42
-
Make sure you have a Linux configuration (for example **Linux-Debug**) selected in the left pane of the dialog:
42
+
Make sure you have a Linux configuration (for example,**Linux-Debug**) selected in the left pane of the dialog:
To enable the ASan diagnostics, you have to install its debug symbols (libasan-dbg) on your remote Linux machine or WSL installation. The version of libasan-dbg that you load depends on the version of GCC you have installed on your Linux machine:
52
+
To enable the ASan diagnostics, you must install its debug symbols (libasan-dbg) on your remote Linux machine or WSL installation. The version of libasan-dbg that you load depends on the version of GCC installed on your Linux machine:
53
53
54
54
|**ASan version**|**GCC version**|
55
55
| --- | --- |
@@ -59,23 +59,22 @@ To enable the ASan diagnostics, you have to install its debug symbols (libasan-d
59
59
|libasan4|gcc-7|
60
60
|libasan5|gcc-8|
61
61
62
-
You can determine the version of GCC you have with the following command:
62
+
You can determine which version of GCC you have by using this command:
63
63
64
64
```bash
65
65
gcc --version
66
66
```
67
67
68
-
You can also view the version of libasan-dbg you will need by running your program and then looking at the **Debug** pane of the **Output** window. The version of ASan that is loaded corresponds to the version of libasan-dbg you will need on your Linux machine. You can use **Ctrl + F** to search for "libasan" in the window. If you have libasan4, for example, you see a line like this:
68
+
To view the version of libasan-dbg you need, run your program, and then look at the **Debug** pane of the **Output** window. The version of ASan that's loaded corresponds to the version of libasan-dbg needed on your Linux machine. You can use **Ctrl + F** to search for "libasan" in the window. If you have libasan4, for example, you see a line like this:
0 commit comments