aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt11
-rw-r--r--CMakeOptions.txt1
-rw-r--r--configure.ac18
3 files changed, 30 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ceeed1e3e..cf5c017f10 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -354,6 +354,17 @@ else()
)
endif()
+ set(WIRESHARK_ASAN_FLAGS
+ # With Clang >= 3.5 Leak detection is enable by default
+ # and no yet all leak is fixed...
+ # use ASAN_OPTIONS=detect_leaks=0 to disable detect_leaks
+ -fsanitize=address
+ )
+
+ if(ENABLE_ASAN)
+ set(WIRESHARK_COMMON_FLAGS ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_ASAN_FLAGS})
+ endif()
+
if(ENABLE_EXTRA_COMPILER_WARNINGS) # This overrides -Werror
set(WIRESHARK_COMMON_FLAGS ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_EXTRA_COMPILER_COMMON_FLAGS})
set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS} ${WIRESHARK_EXTRA_COMPILER_C_ONLY_FLAGS})
diff --git a/CMakeOptions.txt b/CMakeOptions.txt
index c3c5983fef..03015d28ab 100644
--- a/CMakeOptions.txt
+++ b/CMakeOptions.txt
@@ -20,6 +20,7 @@ option(AUTOGEN_pidl "Autogenerate pidl dissectors" OFF)
option(DISABLE_WERROR "Do not treat warnings as errors" OFF)
option(ENABLE_EXTRA_COMPILER_WARNINGS "Do additional compiler warnings (disables -Werror)" OFF)
option(ENABLE_CODE_ANALYSIS "Enable the compiler's static analyzer if possible" OFF)
+option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (May be slow down)" OFF)
#
# Leave GTK2 the default on Windows, looks better than GTK3
diff --git a/configure.ac b/configure.ac
index dd0b50234b..d1ec39a17e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -922,6 +922,24 @@ AC_ARG_ENABLE(extra-compiler-warnings,
fi
],)
+# Try to add ASAN address analyze.
+# Only needed for analyse
+#
+AC_ARG_ENABLE(asan,
+ AC_HELP_STRING( [--enable-asan],
+ [Enable AddressSanitizer (ASAN) for debugging (May be slow down)@<:@default=no@:>@]),
+[
+ #
+ # With Clang >= 3.5 Leak detection is enable by default
+ # and no yet all leak is fixed...
+ # use ASAN_OPTIONS=detect_leaks=0 to disable detect_leaks
+ #
+ AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fsanitize=address)
+
+],)
+
+
+
#
# The following are for C and C++
#