Skip to content

Commit 1c25a7a

Browse files
authored
Update asan-runtime.md
streamlined
1 parent 903db80 commit 1c25a7a

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

docs/sanitizers/asan-runtime.md

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -102,39 +102,27 @@ The MSVC AddressSanitizer is based on the [Clang AddressSanitizer runtime from t
102102

103103
### Configure runtime options
104104

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
106108

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.
108110

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 (`:`).
124112

113+
The following example sets [`alloc_dealloc_mismatch`](./error-alloc-dealloc-mismatch.md) and `symbolize`:
125114

126115
```cmd
127116
set ASAN_OPTIONS=alloc_dealloc_mismatch=1:symbolize=0
128117
```
129118

130-
Or alternatively, through `__asan_defalt_options()`:
119+
Or add the following function to your code:
131120

132121
```C++
133-
extern "C" const char* __asan_default_options() {
122+
extern "C" const char* __asan_default_options()
123+
{
134124
return "alloc_dealloc_mismatch=1:symbolize=0;
135125
}
136-
137-
// ... your code below, such as your `main` function
138126
```
139127

140128
### Unsupported AddressSanitizer options

0 commit comments

Comments
 (0)