How to use AddressSanitizer with Wine?

Alex Henrie <[email protected]> Sat, 26 Apr 2025 15:18:31 -0600
Newsgroups gmane.comp.emulators.wine.devel
Message-ID <CAMMLpeQtQct1DtU2_G0_AUGaNsyZ0W3C0SHPnBZmFPUw2gNLJA@mail.gmail.com>
Dear oenologists,

I would like to use GCC's AddressSanitizer [1] to investigate a memory
corruption bug in Wine. There must be a way to do it because I see
multiple references to "ASan" in the Wine commit log in commits from
this year.[2] I found some instructions on the WineHQ wiki,[3] but I
get a myriad of linker errors when I try to follow them.

What Linux distributions can successfully compile Wine with libasan?
Are there special steps not mentioned in the wiki? Does
AddressSanitizer work with MinGW, or only with non-PE builds?

I'd love to get AddressSanitizer working myself, but even if I can't,
thanks to Bernhard and Nikolay for using it to fix a lot of bugs
already.

-Alex

[1] https://github.com/google/sanitizers/wiki/AddressSanitizer
[2] https://gitlab.winehq.org/wine/wine/-/commits/master?search=ASan
[3] https://gitlab.winehq.org/wine/wine/-/wikis/Building-Wine#memory--address-checkers