Skip to content

Commit 5d4204f

Browse files
committed
cloud testing and DMP files
1 parent a4cdd57 commit 5d4204f

4 files changed

Lines changed: 62 additions & 18 deletions

File tree

131 KB
Loading

‎docs/cpp/ASAN/asan-installing.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Installkng the Address Sanitizer
2+
3+
## From the Installer prompt
4+
5+
## After the installation to verify its there
6+
Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,58 @@
1-
# Offline Address Sanitizer crash dumps
1+
# Address Sanitizer - Cloud or distributed testing
22

3-
## Enable Cloud and Distributed testing
3+
## Overview - debugging off-line
44

5-
We've made it very simple to store an Address Sanitizer runtime error in a new type of crash dump file.This functionality is simply enabled with an environment variable.
5+
We've made it possible to store a precisely diagnosed error, reported by the Address Sanitizer runtime, for post-mortem debugging in Visual Studio. You can capture a precisely diagnosed error and view it on another machine.
66

7-
`set ASAN_SAVE_DUMPS="MyFileName.dmpx"`
7+
**You can view precisely diagnosed Address Sanitizer bugs in the debugger IDE without having to copy huge data-sets, discovering lost data or finding machines that went off line.**
88

9-
## How it works
9+
When compiling `cl -fsanitize=address` the compiler driver (cl.exe) will automatically link a new static library with your application: vcasan.lib. This library has the optional functionality to create a new type of crash dump file upon encountering an exception from the Address Sanitizer. This functionality is enabled with an environment variable by simply typing the following on the command line:
1010

11-
Address Sanitizer exceptions are thrown from inside the runtime, due to many [error types](#errors) detected at runtime. When run from the command line the Address Sanitizer runtime produces text output with error information. When run from the Visual Studio IDE the debugger displays the error information.
11+
**`set ASAN_SAVE_DUMPS=MyFileName.dmp`**
1212

13-
Upon error, your application will produce MyFileName.dmpx which is a [dump file](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/proc_snap/export-a-process-snapshot-to-a-file) that can be opened and debugged using Visual Studio.
13+
Your testing automation could do this on remote machines before running your tests against code compiled with -fsanitize=address.
1414

15-
**Note** that like all other dump files, [debugging symbols](https://docs.microsoft.com/en-us/windows/win32/dxtecharts/debugging-with-symbols) must be available and must match the version of the source compiled.
15+
If you would like to see further Cloud based customization please [provide feedback](https://aka.ms/feedback/suggest?space=62) that might help you take advantage of [Azure OneFuzz](https://www.microsoft.com/security/blog/2020/09/15/microsoft-onefuzz-framework-open-source-developer-tool-fix-bugs/).
1616

17-
## Example
17+
### Errors - stored to a new dump file
1818

19-
## Command line build and run
19+
Once you set a file name in the environment variable **ASAN_SAVE_DUMPS** then upon error, your application will produce "MyFileName.dmpx" which is a [dump file](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/proc_snap/export-a-process-snapshot-to-a-file) that can be displayed by using Visual Studio at a later date on another machine.
20+
21+
**The .exe, .pdb and source code used to produce those, must match** for Visual Studio to display the precise Address Sanitizer error within the debugger IDE. As with normal debugging, displaying information, within the context of the original source code, Visual Studio requires [debugging symbols](https://docs.microsoft.com/en-us/windows/win32/dxtecharts/debugging-with-symbols) and [indexing source code](https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/source-indexing).
22+
23+
We provide a simple step-by-step example below.
24+
25+
## Example - build, test, and analyze
26+
27+
Assume you have machines A, B and C. You build on machine B, you run on machine C and then you analyze failures on machine A. The errors are reported against source line and column numbers in your source code. The call stack is displayed with a set of symbols produced from that [same source code](#Source-and-symbols).
28+
29+
The following steps take you through a workflow that involves three (3) different machines.
30+
31+
## Command line to build
32+
33+
## Command line copy to a test machine
34+
35+
## Command line to copy results for viewing on another machine
36+
37+
## View the remote error in Visual Studio
38+
39+
![snapshot](.\MEDIA\asan-DMP-file-open.PNG)
40+
41+
## Source and symbols
42+
43+
Source server enables a client to retrieve the **exact version** of the source files that were used to build an application. Because the source code for a module can change between versions and over a course of years, it is important to look at the source code as it existed when the version of the module in question was built.
44+
45+
Source server retrieves the appropriate files from source control. To use source server, the application must have been [source indexed](https://docs.microsoft.com/en-us/windows/win32/debug/source-server-and-source-indexing)
46+
47+
- See [the steps indexing sources and publishing symbols](https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/index-sources-publish-symbols?view=azure-devops)
48+
49+
- See [how to specify symbols and source code for the debugger IDE will to open your crash dump from the Address Sanitizer](https://docs.microsoft.com/en-us/visualstudio/debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger?view=vs-2019)
50+
51+
52+
## Error reporting to a file - under the covers
53+
54+
When your .EXE encounters a runtime error, the Address Sanitizer runtime throws different exceptions. When run from the command line the Address Sanitizer runtime will with throw an exception and produce textual error information on the console.
55+
56+
When run under the Visual Studio debugger, the new debugger IDE displays that error diagnostic, super imposed on your source code. That's due to new meta-data written to the heap. The exceptions the runtime throw, are implemented with an exception record data structure. That record points to the meta-data in the heap and the new IDE can parse it. That same information can also be preserved in a simple memory dump to a binary file for later ingestion by the new debugger IDE.
2057

21-
## Viewing in Visual Studio
2258

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,19 @@ Using this flag can reduce your time spent on:
2222

2323
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 directly leverage your existing build systems and existing test assets.
2424

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.
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](https://docs.microsoft.com/en-us/visualstudio/debugger/edit-and-continue-visual-cpp?view=vs-2019), [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-
The Address Sanitizer is integrated with the Visual Studio the project system, CMake system and the IDE.
27+
The Address Sanitizer is integrated with the Visual Studio the project system, CMake system, and the IDE.
2828

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:
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.dmp”`, your program can automatically create a new type of crash dump file that will contain extra meta-data for efficient, [post-mortem debugging](#.\asan-offline-address-sanitizer-crash-dumps.md) of **precisely diagnosed bugs**. These files facilitate extended use of the Address Sanitizer for local machine testing as well as:
3030

31-
- On-premise single machine or distributed testing
31+
- On-premise distributed testing and
3232
- Cloud based workflows for testing
3333

34+
3435
### Installing the Address Sanitizer
3536

36-
Simply [**install the Address Sanitizer functionality**]().
37+
Simply [**install the Address Sanitizer functionality**](.\asan-installing.md).
3738

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

@@ -62,7 +63,7 @@ Microsoft recommends using the Address Sanitizer in these **three standard workf
6263

6364
This article will cover the information needed to enable the three workflows listed above. The information will be specific to the **platform dependent** Windows 10 implementation of the Address Sanitizer and supplement existing documentation from [Google, Apple and GCC](#Google,-Apple-and-GCC-documentation).
6465

65-
> [!NOTE] Current support is limited to x86 and AMD64 on Windows 10. **Customer feedback** would help us prioritize shipping these sanitizers in the future: -fsanitize=thread, -fsanitize=leak, -fsanitize=memory, -fsanitize=hwaddress or -fsanitize=undefined.
66+
> [!NOTE] Current support is limited to x86 and AMD64 on Windows 10. Please click [**Customer Feedback**](https://aka.ms/feedback/suggest?space=62) and tell us what you would like to see in future releases. Your feedback would help us prioritize shipping these sanitizers in the future: -fsanitize=thread, -fsanitize=leak, -fsanitize=memory, -fsanitize=hwaddress or -fsanitize=undefined.
6667
6768
## Using the Address Sanitizer from a Developer Command Prompt
6869

@@ -204,7 +205,8 @@ We did NOT ship features that could lead to false positives in this first releas
204205
- [Container Overflow](https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow)
205206
- [Pointer Subtraction/Comparison](https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html)
206207
207-
See [Building for the Address Sanitizer with MSVC](.\asan-building.md) for further details.
208+
Please provide [provide feedback](https://aka.ms/feedback/suggest?space=62).<sup>16.9</sup> about features you would like to see in future releases.
209+
208210
209211
## Existing industry documentation
210212

0 commit comments

Comments
 (0)