Skip to content

Commit 1f4e162

Browse files
committed
further top level edits
1 parent 4cb5247 commit 1f4e162

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

docs/cpp/ASAN/asan-top-level.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,26 @@ Using this flag can reduce your time spent on:
2020
- Stress testing
2121
- Integrating new code
2222

23-
The Address Sanitizer is a compiler and runtime runtime [introduced by Google](https://www.usenix.org/conference/atc12/technical-sessions/presentation/serebryany). Many projects can enable the Address Sanitizer with a project setting, or a single additional compiler switch: `-fanitize=address`. The new flag is compatible with all levels of optimization. There are conflicts in three compilation modes: [edit-and-continue](), [incremental linking](), and [/RTC](https://docs.microsoft.com/en-us/cpp/build/reference/rtc-run-time-error-checks?view=msvc-160). Apart from those three modes, all other configurations are supported when targeting x86 and x64.
23+
The Address Sanitizer is a compiler and runtime [introduced by Google](https://www.usenix.org/conference/atc12/technical-sessions/presentation/serebryany). Compiling with `cl -fsanitize=addres` is a powerful alternative to both [/RTC](..\..\build\reference\rtc-run-time-error-checks.md), and [/analyze](../..\code-quality/code-analysis-for-c-cpp-overview.md). It provides run-time bug-finding technologies which leverage your existing build systems and existing test assets.
2424

25-
Compiling with `-fsanitize=address` is a powerful alternative to both [/RTC](https://docs.microsoft.com/en-us/cpp/build/reference/rtc-run-time-error-checks?view=msvc-160), and [/analyze](https://docs.microsoft.com/en-us/cpp/code-quality/code-analysis-for-c-cpp-overview?view=msvc-160). It provides run-time bug-finding technologies which leverage your existing build systems and existing test assets.
25+
Projects can enable the Address Sanitizer with a project setting, or a single additional compiler switch: **-fanitize=address**. The new flag is compatible with all levels of optimization but it is not compatible with three compilation modes: [edit-and-continue](), [incremental linking](..\..\build\reference\incremental-link-incrementally.md), and [/RTC](..\..\build\reference\rtc-run-time-error-checks.md). Apart from those three modes, all other configurations are supported when targeting x86 and x64.
2626

27-
We also link a new library to your executable. By setting the environment variable via **`set ASAN_SAVE_DUMPS=”MyFileName.dmpx”`** your program can automatically create a new type of crash dump file that will contain extra meta-data for post-mortem debugging. These dump files can be displayed off-line, with Visual Studio's new debugger IDE. These dump files are an enabler for:
27+
The Address Sanitizer is integrated with the Visual Studio the project system, CMake system and the IDE.
28+
29+
Using the flag -fsanitize=address, the driver (cl.exe) will link a new library with your executable. This library enables integration with the IDE and it can optionally create a new crash dump file. Setting an environment variable via `set ASAN_SAVE_DUMPS=”MyFileName.dmpx”`your program can automatically create a new type of crash dump file that will contain extra meta-data for efficient, post-mortem debugging of **precisely diagnosed bugs**. These files facilitate using the Address Sanitizer in:
2830

2931
- On-premise single machine or distributed testing
3032
- Cloud based workflows for testing
3133

32-
These test systems can store the dump files, with **precisely diagnosed bugs**, for later viewing super imposed on your source code in the IDE.
33-
3434
### Installing the Address Sanitizer
3535

3636
Simply [**install the Address Sanitizer functionality**]().
3737

38-
After installing you can build your executables with the `-fsanitize=address`compiler switch using any of the following:
38+
After installing, you can build your executables with the `-fsanitize=address`compiler switch using any of the following:
3939

4040
- Command line
4141
- Visual Studio project system
42-
- Visual Studio Cmake make integration
42+
- Visual Studio CMake integration
4343

4444
You simply run your program normally. This will light up [many types of precisely diagnosed bugs](#errors). These [errors can be reported three (3) ways](#TBD): in the debugger IDE, on the command line or stored in a new type of dump file for precise off-line processing.
4545

@@ -68,10 +68,11 @@ This article will cover the information needed to enable the three workflows lis
6868

6969
Compile with `-fsanitize=address` to enable Address Sanitizer. The compiler flag `-fsanitize=address` is compatible with all existing C++ or C optimization levels (e.g., /Od, /O1, /O2, /O2 /GL and PGO), works with static and dynamic CRTs (e.g. /MD, /MDd, /MT, /MTd) and can be used to create an .EXE or .DLL. Debug information is required for optimal formatting of call stacks. In this example we explicitly pass `-/Zi`.
7070

71-
The Address Sanitizer libraries (.lib files) will be linked for you. For more detail, and for guidelines on partitioned build systems, see [building to target the Address Sanitizer runtime.](.\ASan-building.md).
71+
The Address Sanitizer libraries (.lib files) will be linked for you. For more detail, and for guidelines on partitioned build systems, see [building to target the Address Sanitizer runtime.](.\asan-building.md).
7272

7373
### Example - basic global buffer overflow:
7474

75+
7576
```cpp
7677
// main.cpp
7778
#include <stdio.h>
@@ -85,11 +86,11 @@ The Address Sanitizer libraries (.lib files) will be linked for you. For more de
8586
}
8687
```
8788
88-
Using a Developer Command Prompt for VS 2019, compile main.cpp as `-fsanitize=address -Zi`
89+
Using a Developer Command Prompt for VS 2019, compile main.cpp using `-fsanitize=address -Zi`
8990
9091
![basic-global-overflow](src_code\asan-top-level\command-basic-global-overflow.png)
9192
92-
Running **main.exe** at the command line, will result in the formatted error report seen below.
93+
Running the resulting **main.exe** at the command line, will result in the formatted error report seen below.
9394
9495
Consider the over layed, red boxes which high light seven (7) key pieces of information:
9596

0 commit comments

Comments
 (0)