From f4485b595731d307e4f28deb50288e7cc36b1abf Mon Sep 17 00:00:00 2001 From: Doug Johnson Date: Wed, 3 Jan 2024 20:39:15 -0700 Subject: [PATCH] Add address sanitizer support for debugging double free --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d7b3f6f0..f9f39a8d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,6 +138,7 @@ option(GDBSTUB "Enable GDB stub server for debugging" option(DEV_BRANCH "Development branch" OFF) option(DISCORD "Discord Rich Presence support" ON) option(DEBUGREGS486 "Enable debug register opeartion on 486+ CPUs" OFF) +option(LIBASAN "Enable compilation with the addresss sanitizer" OFF) if(WIN32) set(QT ON) @@ -212,4 +213,10 @@ if(NOT EMU_COPYRIGHT_YEAR) set(EMU_COPYRIGHT_YEAR 2024) endif() +# Libasan +if(LIBASAN) + add_compile_options(-fsanitize=address) + add_link_options(-fsanitize=address) +endif() + add_subdirectory(src)