Skip to content

Commit

Permalink
Trac #15586: Update Valgrind to 3.10.0
Browse files Browse the repository at this point in the history
New version is out.
Use git branch and tarball at:
* http://sage.sagedev.org/home/vbraun/upstream/valgrind-3.10.0.tar.bz2

URL: http://trac.sagemath.org/15586
Reported by: jpflori
Ticket author(s): Jean-Pierre Flori, Volker Braun
Reviewer(s): Jeroen Demeyer
  • Loading branch information
Release Manager authored and vbraun committed Oct 9, 2014
2 parents 5a0a967 + e150b39 commit 993e9c7
Show file tree
Hide file tree
Showing 10 changed files with 645 additions and 15 deletions.
8 changes: 8 additions & 0 deletions build/pkgs/python/spkg-install
Expand Up @@ -92,6 +92,13 @@ build()
echo >&2 "Error installing Python."
exit 1
fi

echo "Installing valgrind suppression file..."
cp Misc/valgrind-python.supp "$SAGE_EXTCODE/valgrind/python.supp"
if [ $? -ne 0 ]; then
echo >&2 "Error installing valgrind suppression file."
exit 1
fi
}


Expand Down Expand Up @@ -154,3 +161,4 @@ if $import_errors; then
fi
exit 1
fi

49 changes: 49 additions & 0 deletions build/pkgs/valgrind/SPKG.txt
@@ -0,0 +1,49 @@
= Valgrind =

== Description ==

This is an optional spkg. It supports Linux on x86, x86-64, ppc, ppc64 and ARM
as well as Darwin (Mac OS X 10.5 and 10.6) on x86 and x86-64.

Valgrind is an instrumentation framework for building dynamic analysis tools.
There are Valgrind tools that can automatically detect many memory management
and threading bugs, and profile your programs in detail. You can also use
Valgrind to build new tools.

The Valgrind distribution currently includes six production-quality tools:
a memory error detector, two thread error detectors, a cache and
branch-prediction profiler, a call-graph generating cache and branch-prediction
profiler, and a heap profiler. It also includes three experimental tools: a
heap/stack/global array overrun detector, a second heap profiler that examines
how heap blocks are used, and a SimPoint basic block vector generator. It runs
on the following platforms: X86/Linux, AMD64/Linux, ARM/Linux, PPC32/Linux,
PPC64/Linux, S390X/Linux, ARM/Android (2.3.x), X86/Darwin and AMD64/Darwin
(Mac OS X 10.6 and 10.7).

== License ==

Valgrind is Open Source / Free Software, and is freely available under the
GNU General Public License, version 2.

== SPKG Maintainers ==

* Tim Dumol
* Ivan Andrus

== Upstream Contact ==

* http://www.valgrind.org/
* valgrind-user, valgrind-devel mailing lists

== Dependencies ==

* None

== Special Build Instructions ==

* To build on OS X, you need to use Apple's compiler. FSF GCC is unsupported.

=== Patches ===

* None.

4 changes: 4 additions & 0 deletions build/pkgs/valgrind/checksums.ini
@@ -0,0 +1,4 @@
tarball=valgrind-VERSION.tar.bz2
sha1=aec0b8cd042ec36c8cce4f6027b98627ab202f26
md5=7c311a72a20388aceced1aa5573ce970
cksum=968601795
1 change: 1 addition & 0 deletions build/pkgs/valgrind/package-version.txt
@@ -0,0 +1 @@
3.10.0
15 changes: 15 additions & 0 deletions build/pkgs/valgrind/spkg-check
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

if [ -z "$SAGE_LOCAL" ] ; then
echo >&2 "Error - SAGE_LOCAL undefined ... exiting"
echo >&2 "Maybe run 'sage -sh'?"
exit 1
fi

cd src/

$MAKE regtest
if [ $? -ne 0 ]; then
echo >&2 "Error testing Valgrind"
exit 1
fi
37 changes: 37 additions & 0 deletions build/pkgs/valgrind/spkg-install
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

if [ -z "$SAGE_LOCAL" ] ; then
echo >&2 "Error - SAGE_LOCAL undefined ... exiting"
echo >&2 "Maybe run 'sage -sh'?"
exit 1
fi

cd src/

for patch in ../patches/*.patch; do
[ -f "$patch" ] || continue
patch -p1 <"$patch"
if [ $? -ne 0 ]; then
echo >&2 "Error applying '$patch'"
exit 1
fi
done

./configure --prefix=$SAGE_LOCAL
if [ $? -ne 0 ]; then
echo >&2 "Error configuring Valgrind"
exit 1
fi

$MAKE
if [ $? -ne 0 ]; then
echo >&2 "Error building Valgrind"
exit 1
fi

$MAKE install
if [ $? -ne 0 ]; then
echo >&2 "Error installing Valgrind"
exit 1
fi

28 changes: 13 additions & 15 deletions src/bin/sage-valgrind
@@ -1,24 +1,22 @@
#!/usr/bin/env bash

# We reuse the gdb pythonstartup script.
PYTHONSTARTUP=$SAGE_ROOT/local/bin/sage-ipython
export PYTHONSTARTUP
echo $PYTHONSTARTUP
if [ ! -d "$DOT_SAGE/valgrind" ]; then
mkdir "$DOT_SAGE/valgrind"
SUPP=""
if [ -f "$SAGE_EXTCODE/valgrind/python.supp" ]; then
SUPP+=" --suppressions=$SAGE_EXTCODE/valgrind/python.supp"
else
echo "Python suppressions not found (not installed?), skipping"
fi
SUPP+=" --suppressions=$SAGE_EXTCODE/valgrind/pyalloc.supp"
SUPP+=" --suppressions=$SAGE_EXTCODE/valgrind/sage.supp"
SUPP+=" --suppressions=$SAGE_EXTCODE/valgrind/sage-additional.supp"

LOG="$DOT_SAGE"/valgrind/sage-memcheck.%p
echo "Log file is $LOG"
MEMCHECK_FLAGS="--leak-resolution=high --leak-check=full --num-callers=25 $SUPP"

MEMCHECK_FLAGS="--leak-resolution=high --log-file=$LOG --leak-check=full --num-callers=25 --suppressions=$SAGE_LOCAL/lib/valgrind/sage.supp "; export MEMCHECK_FLAGS
if [ "$SAGE_MEMCHECK_FLAGS" ]; then
echo "Overwriting memcheck flags with:"
echo $SAGE_MEMCHECK_FLAGS
MEMCHECK_FLAGS=$SAGE_MEMCHECK_FLAGS; export MEMCHECK_FLAGS
echo "Overwriting memcheck flags with: $SAGE_MEMCHECK_FLAGS"
MEMCHECK_FLAGS=$SAGE_MEMCHECK_FLAGS
else
echo "Using default flags:"
echo $MEMCHECK_FLAGS
echo "Using default flags: $MEMCHECK_FLAGS"
fi

valgrind --tool=memcheck $MEMCHECK_FLAGS python -i
valgrind --tool=memcheck $MEMCHECK_FLAGS python "$SAGE_LOCAL/bin/sage-ipython" "$@" -i
58 changes: 58 additions & 0 deletions src/ext/valgrind/pyalloc.supp
@@ -0,0 +1,58 @@
# Read Misc/README.valgrind in the Python sourcs for a thorough explanation
#
# In short: We need these unless we compile python without pyalloc,
# but that would be prohibitively slow.

# Upstream has these commented out in python.supp:

{
ADDRESS_IN_RANGE/Invalid read of size 4
Memcheck:Addr4
fun:PyObject_Free
}

{
ADDRESS_IN_RANGE/Invalid read of size 4
Memcheck:Value4
fun:PyObject_Free
}

{
ADDRESS_IN_RANGE/Conditional jump or move depends on uninitialised value
Memcheck:Cond
fun:PyObject_Free
}

{
ADDRESS_IN_RANGE/Invalid read of size 4
Memcheck:Addr4
fun:PyObject_Realloc
}

{
ADDRESS_IN_RANGE/Invalid read of size 4
Memcheck:Value4
fun:PyObject_Realloc
}

{
ADDRESS_IN_RANGE/Conditional jump or move depends on uninitialised value
Memcheck:Cond
fun:PyObject_Realloc
}


# These also happen in Python 2.7.8, pretty sure they are just pyalloc
# artifacts as well:

{
Spurious "Use of uninitialised value of size 8"
Memcheck:Value8
fun:PyObject_Free
}

{
Spurious "Use of uninitialised value of size 8"
Memcheck:Value8
fun:PyObject_Realloc
}

0 comments on commit 993e9c7

Please sign in to comment.