diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-01-21 20:48:59 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-01-22 11:39:54 +0100 |
commit | 03eb15933da9944e821bc8c787f84de50e823da0 (patch) | |
tree | 82bc6b9329ed88bfaeb0117210ba9a9432ef5d71 /storage/innobase | |
parent | d9c460b84e6dd603d0101369ee3d6f935213827c (diff) | |
download | mariadb-git-03eb15933da9944e821bc8c787f84de50e823da0.tar.gz |
improve ASAN instrumentation: InnoDB/XtraDB
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/include/univ.i | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index a9d75955550..35c32d6bc1b 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -162,7 +162,7 @@ command. Not tested on Windows. */ #define UNIV_COMPILE_TEST_FUNCS */ -#if defined(HAVE_valgrind)&& defined(HAVE_VALGRIND_MEMCHECK_H) +#if defined(HAVE_VALGRIND) && defined(HAVE_valgrind) # define UNIV_DEBUG_VALGRIND #endif /* HAVE_VALGRIND */ #if 0 @@ -497,12 +497,17 @@ typedef void* os_thread_ret_t; #include "ut0dbg.h" #include "ut0ut.h" #include "db0err.h" + +#include <my_valgrind.h> +/* define UNIV macros in terms of my_valgrind.h */ +# define UNIV_MEM_INVALID(addr, size) MEM_UNDEFINED(addr, size) +# define UNIV_MEM_FREE(addr, size) MEM_NOACCESS(addr, size) +# define UNIV_MEM_ALLOC(addr, size) UNIV_MEM_INVALID(addr, size) + +/* macros below cannot be defined in terms of my_valgrind.h */ #ifdef UNIV_DEBUG_VALGRIND # include <valgrind/memcheck.h> # define UNIV_MEM_VALID(addr, size) VALGRIND_MAKE_MEM_DEFINED(addr, size) -# define UNIV_MEM_INVALID(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size) -# define UNIV_MEM_FREE(addr, size) VALGRIND_MAKE_MEM_NOACCESS(addr, size) -# define UNIV_MEM_ALLOC(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size) # define UNIV_MEM_DESC(addr, size, b) VALGRIND_CREATE_BLOCK(addr, size, b) # define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b) # define UNIV_MEM_ASSERT_RW(addr, size) do { \ @@ -525,14 +530,12 @@ typedef void* os_thread_ret_t; } while (0) #else # define UNIV_MEM_VALID(addr, size) do {} while(0) -# define UNIV_MEM_INVALID(addr, size) do {} while(0) -# define UNIV_MEM_FREE(addr, size) do {} while(0) -# define UNIV_MEM_ALLOC(addr, size) do {} while(0) # define UNIV_MEM_DESC(addr, size, b) do {} while(0) # define UNIV_MEM_UNDESC(b) do {} while(0) # define UNIV_MEM_ASSERT_RW(addr, size) do {} while(0) # define UNIV_MEM_ASSERT_W(addr, size) do {} while(0) #endif + #define UNIV_MEM_ASSERT_AND_FREE(addr, size) do { \ UNIV_MEM_ASSERT_W(addr, size); \ UNIV_MEM_FREE(addr, size); \ |