From 0047ce4bd6f7b13eddbe46e64852451ec04ae599 Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Fri, 7 Jul 2017 00:02:56 +0300 Subject: [PATCH] mdbx: add default AddressSanitizer options. Change-Id: I99b7aee5010f1d43008b2a61efe3fb9bb023ab31 --- src/mdbx.c | 22 ++++++++++++++++++++++ test/base.h | 6 ++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/mdbx.c b/src/mdbx.c index 3a168702..00ba1e0d 100644 --- a/src/mdbx.c +++ b/src/mdbx.c @@ -11225,3 +11225,25 @@ int mdbx_set_attr(MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data, txn->mt_cursors[dbi] = mc.mc_next; return rc; } + +//---------------------------------------------------------------------------- + +#ifdef __SANITIZE_ADDRESS__ +LIBMDBX_API __attribute__((weak)) const char *__asan_default_options() { + return "symbolize=1:allow_addr2line=1:" +#ifdef _DEBUG + "debug=1:" +#endif /* _DEBUG */ + "report_globals=1:" + "replace_str=1:replace_intrin=1:" + "malloc_context_size=9:" + "detect_leaks=1:" + "check_printf=1:" + "detect_deadlocks=1:" + "check_initialization_order=1:" + "detect_stack_use_after_return=1:" + "intercept_tls_get_addr=1:" + "decorate_proc_maps=1:" + "abort_on_error=1"; +} +#endif /* __SANITIZE_ADDRESS__ */ diff --git a/test/base.h b/test/base.h index 0ed927da..8557787d 100644 --- a/test/base.h +++ b/test/base.h @@ -93,8 +93,10 @@ nameless struct / union */ #pragma warning(disable : 4127) /* conditional expression is constant */ #if _MSC_VER < 1900 -#pragma warning(disable : 4510) /* default constructor could not be generated */ -#pragma warning(disable : 4512) /* assignment operator could not be generated */ +#pragma warning(disable : 4510) /* default constructor could \ + not be generated */ +#pragma warning(disable : 4512) /* assignment operator could \ + not be generated */ #pragma warning(disable : 4610) /* user-defined constructor required */ #define snprintf _snprintf #pragma warning(disable : 4996) /* 'vsnprintf': This function or variable \