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
Copy file name to clipboardExpand all lines: docs/sanitizers/asan-runtime.md
+9-21Lines changed: 9 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,39 +102,27 @@ The MSVC AddressSanitizer is based on the [Clang AddressSanitizer runtime from t
102
102
103
103
### Configure runtime options
104
104
105
-
ASan runtime options are set in one of two ways: through the `ASAN_OPTIONS` environment variable, or the `__asan_default_options` user function. If the environment variable and the user function select conflicting options, the `ASAN_OPTIONS` environment variable takes precedence.
105
+
ASan runtime options are set in one of two ways:
106
+
- The `ASAN_OPTIONS` environment variable
107
+
- The `__asan_default_options` user function
106
108
107
-
For example, to select the [`alloc_dealloc_mismatch`](./error-alloc-dealloc-mismatch.md) flag, you may use:
109
+
If the environment variable and the user function specify conflicting options, the options in the `ASAN_OPTIONS` environment variable take precedence.
108
110
109
-
```cmd
110
-
set ASAN_OPTIONS=alloc_dealloc_mismatch=1
111
-
```
112
-
113
-
Alternatively by implementing `__asan_defalt_options()` in your code:
114
-
115
-
```C++
116
-
extern "C" const char*__asan_default_options() {
117
-
return "alloc_dealloc_mismatch=1";
118
-
}
119
-
120
-
// ... your code below, such as your `main` function
121
-
```
122
-
123
-
Multiple options can be specified by separating them with a colon (`:`). For example, to additionally set `symbolize=0`:
111
+
Multiple options are specified by separating them with a colon (`:`).
124
112
113
+
The following example sets [`alloc_dealloc_mismatch`](./error-alloc-dealloc-mismatch.md) and `symbolize`:
125
114
126
115
```cmd
127
116
set ASAN_OPTIONS=alloc_dealloc_mismatch=1:symbolize=0
128
117
```
129
118
130
-
Or alternatively, through `__asan_defalt_options()`:
119
+
Or add the following function to your code:
131
120
132
121
```C++
133
-
extern "C" const char*__asan_default_options() {
122
+
extern "C" const char*__asan_default_options()
123
+
{
134
124
return "alloc_dealloc_mismatch=1:symbolize=0;
135
125
}
136
-
137
-
// ... your code below, such as your `main` function
0 commit comments