Commit 03eb1593 authored by Sergei Golubchik's avatar Sergei Golubchik

improve ASAN instrumentation: InnoDB/XtraDB

parent d9c460b8
......@@ -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); \
......
......@@ -170,7 +170,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
#if 0
......@@ -511,12 +511,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 { \
......@@ -539,9 +544,6 @@ 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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment