diff options
author | Patrik Nyblom <[email protected]> | 2011-03-01 17:33:01 +0100 |
---|---|---|
committer | Patrik Nyblom <[email protected]> | 2011-03-01 17:33:06 +0100 |
commit | 3cc8eede4be9e04dbc8a7328e1dda7e4410b7b55 (patch) | |
tree | 1b52b9fcc1d1c21b8a9fbb9828b4955ef911c9d1 | |
parent | c1952e34401c4711b480f4c97d3f65cf2376a52b (diff) | |
parent | 5dd7bdee141803099b5a9b4eba18c6f04048ba40 (diff) | |
download | otp-3cc8eede4be9e04dbc8a7328e1dda7e4410b7b55.tar.gz otp-3cc8eede4be9e04dbc8a7328e1dda7e4410b7b55.tar.bz2 otp-3cc8eede4be9e04dbc8a7328e1dda7e4410b7b55.zip |
Merge branch 'pan/valgrind-3.6.0' into dev
* pan/valgrind-3.6.0:
Make crypto.c work with valgrind 3.6 and correct cerl.src
Teach cerl to handle newer valgrind
OTP-9079
-rw-r--r-- | erts/etc/unix/cerl.src | 23 | ||||
-rw-r--r-- | lib/crypto/c_src/crypto.c | 14 |
2 files changed, 28 insertions, 9 deletions
diff --git a/erts/etc/unix/cerl.src b/erts/etc/unix/cerl.src index 73b1bafbe0..69840daf69 100644 --- a/erts/etc/unix/cerl.src +++ b/erts/etc/unix/cerl.src @@ -228,17 +228,30 @@ if [ $run_valgrind != yes ]; then fi if [ "x$GDB" = "x" ]; then if [ $run_valgrind = yes ]; then + valversion=`valgrind --version` + valmajor=`echo $valversion | sed 's,[a-z]*\-\([0-9]*\).*,\1,'` + valminor=`echo $valversion | sed 's,[a-z]*\-[0-9]*.\([0-9]*\).*,\1,'` emu_xargs=`echo $xargs | sed "s|+|-|g"` - if [ "x$VALGRIND_LOG_DIR" = "x" ]; then - valgrind_log= - else - valgrind_log="--log-file=$VALGRIND_LOG_DIR/$VALGRIND_LOGFILE_PREFIX$VALGRIND_LOGFILE_INFIX$EMU.log" - fi if [ "x$VALGRIND_LOG_XML" = "x" ]; then valgrind_xml= + log_file_prefix="--log-file=" else export VALGRIND_LOG_XML valgrind_xml="--xml=yes" + if [ $valmajor -gt 2 -a $valminor -gt 4 ]; then + log_file_prefix="--xml-file=" + else + log_file_prefix="--log-file=" + fi + fi + if [ "x$VALGRIND_LOG_DIR" = "x" ]; then + valgrind_log= + else + if [ $valmajor -gt 2 -a $valminor -gt 4 ]; then + valgrind_log="$log_file_prefix$VALGRIND_LOG_DIR/$VALGRIND_LOGFILE_PREFIX$VALGRIND_LOGFILE_INFIX$EMU.log.$$" + else + valgrind_log="$log_file_prefix$VALGRIND_LOG_DIR/$VALGRIND_LOGFILE_PREFIX$VALGRIND_LOGFILE_INFIX$EMU.log" + fi fi if [ "x$VALGRIND_MISC_FLAGS" = "x" ]; then valgrind_misc_flags= diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c index 92cc2b4dd9..0e7e63eb73 100644 --- a/lib/crypto/c_src/crypto.c +++ b/lib/crypto/c_src/crypto.c @@ -62,10 +62,16 @@ # define ERL_VALGRIND_MAKE_MEM_DEFINED(ptr,size) \ VALGRIND_MAKE_MEM_DEFINED(ptr,size) - # define ERL_VALGRIND_ASSERT_MEM_DEFINED(ptr,size) \ - ((void) ((VALGRIND_CHECK_MEM_IS_DEFINED(ptr,size) == 0) ? 1 : \ - (fprintf(stderr,"\r\n####### VALGRIND_ASSSERT(%p,%ld) failed at %s:%d\r\n",\ - (ptr),(long)(size), __FILE__, __LINE__), abort(), 0))) + # define ERL_VALGRIND_ASSERT_MEM_DEFINED(Ptr,Size) \ + do { \ + int __erl_valgrind_mem_defined = VALGRIND_CHECK_MEM_IS_DEFINED((Ptr),(Size)); \ + if (__erl_valgrind_mem_defined != 0) { \ + fprintf(stderr,"\r\n####### VALGRIND_ASSSERT(%p,%ld) failed at %s:%d\r\n", \ + (Ptr),(long)(Size), __FILE__, __LINE__); \ + abort(); \ + } \ + } while (0) + #else # define ERL_VALGRIND_MAKE_MEM_DEFINED(ptr,size) # define ERL_VALGRIND_ASSERT_MEM_DEFINED(ptr,size) |