List:Commits« Previous MessageNext Message »
From:marko.makela Date:May 20 2010 11:44am
Subject:bzr push into mysql-trunk-innodb branch (marko.makela:3107 to 3108)
View as plain text  
 3108 Marko Mäkelä	2010-05-20
      Merge a change from mysql-5.1-innodb:
      
      TO DO: Enable this in CMake-based builds.
      
      ------------------------------------------------------------
      revno: 3474
      revision-id: marko.makela@strippedsscqdvwoph8k
      parent: marko.makela@stripped19081618-h38q02qxuvcowbtk
      committer: Marko Mäkelä <marko.makela@stripped>
      branch nick: 5.1-innodb
      timestamp: Thu 2010-05-20 13:40:42 +0300
      message:
        Bug#53593: Add some instrumentation to improve Valgrind sensitivity
      
        BUILD/*: Add valgrind_configs=--with-valgrind.
        BUILD/*: Remove -USAFEMALLOC from valgrind_flags.
      
        configure.in: Add AC_ARG_WITH(valgrind) and HAVE_VALGRIND.
      
        include/my_sys.h: Define a number of MEM_ wrappers for VALGRIND_ functions.
        include/my_sys.h: Make TRASH do MEM_UNDEFINED().
      
        include/m_string.h: Remove unused macro bzero_if_purify(A,B).
      
        _mymalloc(): Declare MEM_UNDEFINED() on the allocated memory.
      
        _myfree(): Declare MEM_NOACCESS() on the freed memory.
      
        storage/innobase/include/univ.i: Enable UNIV_DEBUG_VALGRIND based on
        HAVE_VALGRIND rather than HAVE_purify.
      
        Possible things to do:
         * In my_global.h, remove the defined(HAVE_purify) condition
           from the _WIN32 uint3korr().
         * In my_global.h *int*korr(), use | instead of +
           in order to keep the Valgrind V bits accurate
         * Consider replacing HAVE_purify with HAVE_VALGRIND
         * Use VALGRIND_CREATE_BLOCK, VALGRIND_DISCARD in mem_root and similar places

    modified:
      BUILD/SETUP.sh
      BUILD/build_mccge.sh
      BUILD/compile-amd64-valgrind-max
      BUILD/compile-pentium-icc-valgrind-max
      BUILD/compile-pentium-valgrind-max
      BUILD/compile-pentium-valgrind-max-no-ndb
      BUILD/compile-pentium64-valgrind-max
      configure.in
      include/m_string.h
      include/my_sys.h
      mysys/safemalloc.c
      storage/innobase/include/univ.i
 3107 Vasil Dimov	2010-05-19 [merge]
      Merge mysql-trunk-bugfixing -> mysql-trunk-innodb

    added:
      mysql-test/suite/funcs_1/r/row_count_func.result
      mysql-test/suite/funcs_1/t/row_count_func-master.opt
      mysql-test/suite/funcs_1/t/row_count_func.test
    modified:
      BUILD/Makefile.am
      CMakeLists.txt
      Docs/Makefile.am
      Makefile.am
      client/Makefile.am
      cmake/build_configurations/mysql_release.cmake
      cmake/install_layout.cmake
      cmake/install_macros.cmake
      cmake/mysql_version.cmake
      cmake/plugin.cmake
      cmd-line-utils/Makefile.am
      cmd-line-utils/readline/Makefile.am
      config.h.cmake
      extra/Makefile.am
      extra/yassl/Makefile.am
      extra/yassl/src/Makefile.am
      extra/yassl/taocrypt/Makefile.am
      extra/yassl/taocrypt/benchmark/Makefile.am
      extra/yassl/taocrypt/src/Makefile.am
      extra/yassl/taocrypt/test/Makefile.am
      extra/yassl/testsuite/Makefile.am
      include/Makefile.am
      libmysql/CMakeLists.txt
      libmysql/Makefile.am
      libmysql/Makefile.shared
      libmysql_r/Makefile.am
      libmysqld/CMakeLists.txt
      libmysqld/Makefile.am
      libmysqld/examples/CMakeLists.txt
      libmysqld/examples/Makefile.am
      man/CMakeLists.txt
      man/Makefile.am
      mysql-test/CMakeLists.txt
      mysql-test/Makefile.am
      mysql-test/collections/default.experimental
      mysql-test/include/ctype_numconv.inc
      mysql-test/include/mysqld--help.inc
      mysql-test/lib/My/SafeProcess/Makefile.am
      mysql-test/r/ctype_binary.result
      mysql-test/r/ctype_cp1251.result
      mysql-test/r/ctype_latin1.result
      mysql-test/r/ctype_ucs.result
      mysql-test/r/mysql_client_test.result
      mysql-test/r/partition.result
      mysql-test/r/sp.result
      mysql-test/r/variables_debug.result
      mysql-test/suite/funcs_1/r/innodb_storedproc_10.result
      mysql-test/suite/funcs_1/r/memory_storedproc_10.result
      mysql-test/suite/funcs_1/r/myisam_storedproc_10.result
      mysql-test/suite/funcs_1/r/ndb_storedproc_10.result
      mysql-test/suite/rpl/t/disabled.def
      mysql-test/t/mysql_client_test.test
      mysql-test/t/parser_stack.test
      mysql-test/t/partition.test
      mysql-test/t/variables_debug.test
      mysys/Makefile.am
      netware/Makefile.am
      plugin/Makefile.am
      plugin/audit_null/CMakeLists.txt
      plugin/daemon_example/Makefile.am
      plugin/fulltext/CMakeLists.txt
      plugin/fulltext/Makefile.am
      pstack/Makefile.am
      pstack/aout/Makefile.am
      regex/Makefile.am
      scripts/CMakeLists.txt
      scripts/Makefile.am
      scripts/mysqld_safe.sh
      sql-bench/CMakeLists.txt
      sql-bench/Makefile.am
      sql-common/Makefile.am
      sql/CMakeLists.txt
      sql/Makefile.am
      sql/ha_ndbcluster_binlog.cc
      sql/item_func.cc
      sql/log_event.cc
      sql/protocol.cc
      sql/share/Makefile.am
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_delete.cc
      sql/sql_insert.cc
      sql/sql_lex.cc
      sql/sql_lex.h
      sql/sql_parse.cc
      sql/sql_parse.h
      sql/sql_signal.cc
      sql/sql_update.cc
      storage/Makefile.am
      storage/archive/Makefile.am
      storage/blackhole/Makefile.am
      storage/csv/Makefile.am
      storage/example/Makefile.am
      storage/federated/Makefile.am
      storage/heap/Makefile.am
      storage/ibmdb2i/Makefile.am
      storage/innobase/Makefile.am
      storage/myisam/Makefile.am
      storage/myisammrg/Makefile.am
      storage/ndb/Makefile.am
      storage/ndb/docs/Makefile.am
      storage/ndb/include/Makefile.am
      storage/ndb/src/Makefile.am
      storage/ndb/src/common/Makefile.am
      storage/ndb/src/common/debugger/Makefile.am
      storage/ndb/src/common/debugger/signaldata/Makefile.am
      storage/ndb/src/common/logger/Makefile.am
      storage/ndb/src/common/mgmcommon/Makefile.am
      storage/ndb/src/common/portlib/Makefile.am
      storage/ndb/src/common/transporter/Makefile.am
      storage/ndb/src/common/util/Makefile.am
      storage/ndb/src/cw/Makefile.am
      storage/ndb/src/cw/cpcd/Makefile.am
      storage/ndb/src/kernel/Makefile.am
      storage/ndb/src/kernel/blocks/Makefile.am
      storage/ndb/src/kernel/blocks/backup/Makefile.am
      storage/ndb/src/kernel/blocks/dbdict/Makefile.am
      storage/ndb/src/kernel/blocks/dbdih/Makefile.am
      storage/ndb/src/kernel/blocks/dblqh/Makefile.am
      storage/ndb/src/kernel/blocks/dbtup/Makefile.am
      storage/ndb/src/kernel/error/Makefile.am
      storage/ndb/src/kernel/vm/Makefile.am
      storage/ndb/src/mgmapi/Makefile.am
      storage/ndb/src/mgmclient/Makefile.am
      storage/ndb/src/mgmsrv/Makefile.am
      storage/ndb/src/ndbapi/Makefile.am
      storage/ndb/test/Makefile.am
      storage/ndb/test/ndbapi/Makefile.am
      storage/ndb/test/ndbapi/bank/Makefile.am
      storage/ndb/test/run-test/Makefile.am
      storage/ndb/test/src/Makefile.am
      storage/ndb/test/tools/Makefile.am
      storage/ndb/tools/Makefile.am
      strings/Makefile.am
      support-files/CMakeLists.txt
      support-files/MacOSX/Makefile.am
      support-files/Makefile.am
      support-files/RHEL4-SElinux/Makefile.am
      support-files/mysql.spec.sh
      tests/Makefile.am
      unittest/Makefile.am
      unittest/examples/Makefile.am
      unittest/mytap/t/Makefile.am
      vio/Makefile.am
      win/Makefile.am
      zlib/Makefile.am
=== modified file 'BUILD/SETUP.sh'
--- a/BUILD/SETUP.sh	revid:vasil.dimov@strippedm-20100519204850-d7odvjyfx1gv6fms
+++ b/BUILD/SETUP.sh	revid:marko.makela@stripped1g
@@ -119,8 +119,12 @@ fi
 
 # Set flags for various build configurations.
 # Used in -valgrind builds
-valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
+# Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro
+# LINT_INIT(), which is only useful for silencing spurious warnings
+# of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind.
+valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify "
 valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
+valgrind_configs="--with-valgrind"
 #
 # Used in -debug builds
 debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "

=== modified file 'BUILD/build_mccge.sh'
--- a/BUILD/build_mccge.sh	revid:vasil.dimov@oracle.com-20100519204850-d7odvjyfx1gv6fms
+++ b/BUILD/build_mccge.sh	revid:marko.makela@strippedz8mce7y8m7y6p1g
@@ -1010,9 +1010,10 @@ set_ccache_usage()
 set_valgrind_flags()
 {
   if test "x$valgrind_flag" = "xyes" ; then
-    loc_valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
+    loc_valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify "
     loc_valgrind_flags="$loc_valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
     compiler_flags="$compiler_flags $loc_valgrind_flags"
+    with_flags="$with_flags --with-valgrind"
   fi
 }
 

=== modified file 'BUILD/compile-amd64-valgrind-max'
--- a/BUILD/compile-amd64-valgrind-max	revid:vasil.dimov@stripped
+++ b/BUILD/compile-amd64-valgrind-max	revid:marko.makela@stripped-20100520114306-oz8mce7y8m7y6p1g
@@ -4,7 +4,7 @@ path=`dirname $0`
 . "$path/SETUP.sh"
 
 extra_flags="$amd64_cflags $debug_cflags $valgrind_flags"
-extra_configs="$amd64_configs $debug_configs $max_configs"
+extra_configs="$amd64_configs $debug_configs $valgrind_configs $max_configs"
 
 . "$path/FINISH.sh"
 

=== modified file 'BUILD/compile-pentium-icc-valgrind-max'
--- a/BUILD/compile-pentium-icc-valgrind-max	revid:vasil.dimov@stripped850-d7odvjyfx1gv6fms
+++ b/BUILD/compile-pentium-icc-valgrind-max	revid:marko.makela@strippedmce7y8m7y6p1g
@@ -29,6 +29,6 @@ extra_flags="$pentium_cflags $debug_cfla
 c_warnings="-Wall -Wcheck -wd161,444,279,810,981,1292,1469,1572"
 cxx_warnings="$c_warnings -wd869,874"
 base_cxxflags="-fno-exceptions -fno-rtti"
-extra_configs="$pentium_configs $debug_configs"
+extra_configs="$pentium_configs $debug_configs $valgrind_configs"
 
 . "$path/FINISH.sh"

=== modified file 'BUILD/compile-pentium-valgrind-max'
--- a/BUILD/compile-pentium-valgrind-max	revid:vasil.dimov@stripped6fms
+++ b/BUILD/compile-pentium-valgrind-max	revid:marko.makela@stripped
@@ -4,7 +4,7 @@ path=`dirname $0`
 . "$path/SETUP.sh"
 
 extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
-extra_configs="$pentium_configs $debug_configs $max_configs"
+extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
 
 . "$path/FINISH.sh"
 

=== modified file 'BUILD/compile-pentium-valgrind-max-no-ndb'
--- a/BUILD/compile-pentium-valgrind-max-no-ndb	revid:vasil.dimov@stripped
+++ b/BUILD/compile-pentium-valgrind-max-no-ndb	revid:marko.makela@stripped
@@ -4,7 +4,7 @@ path=`dirname $0`
 . "$path/SETUP.sh"
 
 extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
-extra_configs="$pentium_configs $debug_configs $max_no_ndb_configs"
+extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_no_ndb_configs"
 
 . "$path/FINISH.sh"
 

=== modified file 'BUILD/compile-pentium64-valgrind-max'
--- a/BUILD/compile-pentium64-valgrind-max	revid:vasil.dimov@stripped
+++ b/BUILD/compile-pentium64-valgrind-max	revid:marko.makela@oracle.com-20100520114306-oz8mce7y8m7y6p1g
@@ -4,7 +4,7 @@ path=`dirname $0`
 . "$path/SETUP.sh"
 
 extra_flags="$pentium64_cflags $debug_cflags $valgrind_flags"
-extra_configs="$pentium_configs $debug_configs $max_configs"
+extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
 
 . "$path/FINISH.sh"
 

=== modified file 'configure.in'
--- a/configure.in	revid:vasil.dimov@oracle.com-20100519204850-d7odvjyfx1gv6fms
+++ b/configure.in	revid:marko.makela@strippedy8m7y6p1g
@@ -1844,6 +1844,17 @@ else
   CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
 fi
 
+AC_ARG_WITH([valgrind],
+  [AS_HELP_STRING([--with-valgrind],
+    [Valgrind instrumentation @<:@default=no@:>@])],
+    [], [with_valgrind=no])
+
+if test "$with_valgrind" != "no"
+then
+  AC_CHECK_HEADERS([valgrind/valgrind.h valgrind/memcheck.h],
+    [AC_DEFINE([HAVE_VALGRIND], [1], [Define for Valgrind support])])
+fi
+
 # Debug Sync Facility. NOTE: depends on 'with_debug'. Must be behind it.
 AC_MSG_CHECKING(if Debug Sync Facility should be enabled.)
 AC_ARG_ENABLE(debug_sync,

=== modified file 'include/m_string.h'
--- a/include/m_string.h	revid:vasil.dimov@stripped-d7odvjyfx1gv6fms
+++ b/include/m_string.h	revid:marko.makela@stripped
@@ -127,9 +127,6 @@ extern	size_t bcmp(const uchar *s1,const
 extern	size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len);
 #undef bcmp
 #define bcmp(A,B,C) my_bcmp((A),(B),(C))
-#define bzero_if_purify(A,B) bzero(A,B)
-#else
-#define bzero_if_purify(A,B)
 #endif /* HAVE_purify */
 
 #ifndef bmove512

=== modified file 'include/my_sys.h'
--- a/include/my_sys.h	revid:vasil.dimov@stripped4850-d7odvjyfx1gv6fms
+++ b/include/my_sys.h	revid:marko.makela@stripped
@@ -28,6 +28,19 @@ typedef struct my_aio_result {
 } my_aio_result;
 #endif
 
+#ifdef HAVE_VALGRIND
+# include <valgrind/memcheck.h>
+# define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len)
+# define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len)
+# define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,len)
+# define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len)
+#else /* HAVE_VALGRIND */
+# define MEM_UNDEFINED(a,len) ((void) 0)
+# define MEM_NOACCESS(a,len) ((void) 0)
+# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
+# define MEM_CHECK_DEFINED(a,len) ((void) 0)
+#endif /* HAVE_VALGRIND */
+
 #ifndef THREAD
 extern int NEAR my_errno;		/* Last error in mysys */
 #else
@@ -156,7 +169,7 @@ extern int NEAR my_errno;		/* Last error
 #define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C)
 #define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C)
 #define my_strndup(A,B,C) _my_strndup((A),(B),__FILE__,__LINE__,C)
-#define TRASH(A,B) bfill(A, B, 0x8F)
+#define TRASH(A,B) do { bfill(A, B, 0x8F); MEM_UNDEFINED(A, B); } while (0)
 #define QUICK_SAFEMALLOC sf_malloc_quick=1
 #define NORMAL_SAFEMALLOC sf_malloc_quick=0
 extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick;
@@ -184,7 +197,7 @@ extern char *my_strndup(const char *from
 #define CALLER_INFO_PROTO   /* nothing */
 #define CALLER_INFO         /* nothing */
 #define ORIG_CALLER_INFO    /* nothing */
-#define TRASH(A,B) /* nothing */
+#define TRASH(A,B) do{MEM_CHECK_ADDRESSABLE(A,B);MEM_UNDEFINED(A,B);} while (0)
 #endif
 
 #if defined(ENABLED_DEBUG_SYNC)

=== modified file 'mysys/safemalloc.c'
--- a/mysys/safemalloc.c	revid:vasil.dimov@strippedjyfx1gv6fms
+++ b/mysys/safemalloc.c	revid:marko.makela@oracle.com-20100520114306-oz8mce7y8m7y6p1g
@@ -190,9 +190,12 @@ void *_mymalloc(size_t size, const char
   sf_malloc_count++;
   mysql_mutex_unlock(&THR_LOCK_malloc);
 
+  MEM_CHECK_ADDRESSABLE(data, size);
   /* Set the memory to the aribtrary wierd value */
   if ((MyFlags & MY_ZEROFILL) || !sf_malloc_quick)
     bfill(data, size, (char) (MyFlags & MY_ZEROFILL ? 0 : ALLOC_VAL));
+  if (!(MyFlags & MY_ZEROFILL))
+    MEM_UNDEFINED(data, size);
   /* Return a pointer to the real data */
   DBUG_PRINT("exit",("ptr: %p", data));
   if (sf_min_adress > data)
@@ -309,7 +312,9 @@ void _myfree(void *ptr, const char *file
   if (!sf_malloc_quick)
     bfill(ptr, irem->datasize, (pchar) FREE_VAL);
 #endif
+  MEM_NOACCESS(ptr, irem->datasize);
   *((uint32*) ((char*) ptr- sizeof(uint32)))= ~MAGICKEY;
+  MEM_NOACCESS((char*) ptr - sizeof(uint32), sizeof(uint32));
   /* Actually free the memory */
   free((char*) irem);
   DBUG_VOID_RETURN;

=== modified file 'storage/innobase/include/univ.i'
--- a/storage/innobase/include/univ.i	revid:vasil.dimov@strippedjyfx1gv6fms
+++ b/storage/innobase/include/univ.i	revid:marko.makela@stripped
@@ -182,9 +182,9 @@ command. Not tested on Windows. */
 #define UNIV_COMPILE_TEST_FUNCS
 */
 
-#ifdef HAVE_purify
+#if defined HAVE_VALGRIND
 # define UNIV_DEBUG_VALGRIND
-#endif /* HAVE_purify */
+#endif /* HAVE_VALGRIND */
 #if 0
 #define UNIV_DEBUG_VALGRIND			/* Enable extra
 						Valgrind instrumentation */

Attachment: [text/bzr-bundle] bzr/marko.makela@oracle.com-20100520114306-oz8mce7y8m7y6p1g.bundle
Thread
bzr push into mysql-trunk-innodb branch (marko.makela:3107 to 3108) marko.makela20 May