Search code examples
visual-studiovisual-c++address-sanitizer

Generate MiniDump on Address Sanitizer error


I’ve compiled my Windows C++ application with Address Sanitizer and deployed it to a target machine. When I run it on the target machine, I get an ASAN error and I get a stack trace for the culprit thread.

I want to debug all the threads at this occurrence. Unfortunately I don’t have a debugger installed on the target machine and I don’t have remote debugging set up.

I have turned on WER for the application so I can copy the MiniDump file back to my dev machine to debug other types of crashes.

Can I do the same for ASAN errors?


Solution

  • Yes, you totally can do it. You need to set the environment variable, then Asan will generate the crash dump file for you.

    ASAN_SAVE_DUMPS=MyFileName.dmp

    More info: https://learn.microsoft.com/en-us/cpp/sanitizers/asan-offline-crash-dumps?view=msvc-170