I'm on Windows using Visual Studio compiler.
I'm using /fsanitize=address
to compile with AddressSanitizer.
I run my exe from command line.
I want my exe to
The documentation of ASAN_OPTIONS suggests the following syntax:
set ASAN_OPTIONS=continue_on_error=1:log_path=log_file my.exe
However, I only can (partially) succeed, when I
a) omit the exe name AND
b) use only 1 option
When specifying the executable name, I always get the error
Internal error duing continue on error: Fail on write()
(no matter
whether I use the full path name or the exe file name only,
or if I'm in the exe's directory or not)
And when using more than 1 option, only 1 option is working.
I tried the delimiter characters
(space) and :
.
Surrounding the whole option string with quotes ("
) is counterproductive: then no option is recognized at all.
Edit after @yugr's answer: I experimented a little further and experienced the following:
>set ASAN_OPTIONS=log_path='D:\_tmp\log_file':continue_on_error=1
>set ASAN_OPTIONS=continue_on_error=1:log_path='D:\_tmp\log_file'
set ASAN_OPTIONS=log_path='D:\_tmp\log_file'
>set ASAN_OPTIONS=continue_on_error=1 log_path='D:\_tmp\log_file'
>set ASAN_OPTIONS=log_path='D:\_tmp\log_file' continue_on_error=1
>set ASAN_OPTIONS=continue_on_error=1;log_path='D:\_tmp\log_file'
>my.exe
Internal error duing continue on error: Fail on write()
Edit end.
I tried the option log_path
with
stderr
log_file
D:\_tmp\log_file
AddressSanitizer: ERROR: expected '=' in ASAN_OPTIONS
- don't know why:> echo %ASAN_OPTIONS%
log_path=D:\_tmp\log_file
Any hint is highly appreciated on the 3 dubieties (exe name in options, >1 option, path in log_path
option).
The documentation of ASAN_OPTIONS suggests the following syntax: set ASAN_OPTIONS=continue_on_error=1:log_path=log_file my.exe ... When specifying the executable name, I always get the error
That syntax is Linux-specific. On Windows you should run it with two separate commands
> set ASAN_OPTIONS=log_path=log_file
> my.exe
Multiple flags in ASAN_OPTIONS
can be separated via :
or
(whitespace):
> set ASAN_OPTIONS=verbosity=2:log_path=log_file
> set ASAN_OPTIONS=verbosity=2 log_path=log_file
D:\_tmp\log_file => gives AddressSanitizer: ERROR: expected '=' in ASAN_OPTIONS - don't know why:
Yes, this is a (mis)feature of Asan - it treats any unescaped colon as option separator so when you do
set ASAN_OPTIONS=log_path=D:\_tmp\log_file
it treats "\_tmp\log_file" as second option and fails to parse it. You should escape filename to prevent Asan from doing this:
set ASAN_OPTIONS=log_path='D:\_tmp\log_file'
2 options: set ASAN_OPTIONS=log_path='D:_tmp\log_file':continue_on_error=1 continues, but does not writa a logfile
exchanged option order: set ASAN_OPTIONS=continue_on_error=1:log_path='D:_tmp\log_file' continues, but does not writa a logfile
This happens because continue_on_error=1
forces output to stdout and overrides the log_path
setting.