mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-06 19:54:18 +00:00
requiring "make install". This is good for two reasons:
1. shorter compile times ("make" instead of "make install")
2. don't need to install before running the regression tests
Changes:
- root Makefile now builds a libpthread.so.0 symlink to libpthread.so, which
was needed.
- startup script accepts a --in-place=<dir> option for running a non-installed
version, where <dir> is the root of the src tree
- VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH) had to be fiddled with a bit
- tests/vg_regtest now uses the --in-place option to test the non-installed
version
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1614
142 lines
4.3 KiB
Bash
Executable File
142 lines
4.3 KiB
Bash
Executable File
#!/bin/sh
|
|
##--------------------------------------------------------------------##
|
|
##--- The startup script. valgrind ---##
|
|
##--------------------------------------------------------------------##
|
|
|
|
# This file is part of Valgrind, an extensible x86 protected-mode
|
|
# emulator for monitoring program execution on x86-Unixes.
|
|
#
|
|
# Copyright (C) 2002-2003 Julian Seward
|
|
# jseward@acm.org
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License as
|
|
# published by the Free Software Foundation; either version 2 of the
|
|
# License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
# 02111-1307, USA.
|
|
#
|
|
# The GNU General Public License is contained in the file COPYING.
|
|
|
|
|
|
# Should point to the installation directory
|
|
prefix="@prefix@"
|
|
exec_prefix="@exec_prefix@"
|
|
VALGRIND="@libdir@/valgrind"
|
|
nptl_threading="@NPTL_THREADING@"
|
|
|
|
# Other stuff ...
|
|
version="@VERSION@"
|
|
emailto="jseward@acm.org"
|
|
|
|
# The default name of the suppressions file
|
|
vgsupp="--suppressions=$VALGRIND/default.supp"
|
|
|
|
# Valgrind options
|
|
vgopts=
|
|
|
|
# --skin=<foo> arg, specifying skin used
|
|
skin_arg=
|
|
|
|
# --in-place=<dir> arg, for using non-installed version
|
|
in_place_arg=
|
|
|
|
# Default core+skin to use are the installed ones
|
|
coredir=$VALGRIND
|
|
skindir=$VALGRIND
|
|
|
|
# Collect up args for Valgrind. Only some are intercepted here;
|
|
# the rest are passed to vg_main.c.
|
|
while [ $# != 0 ]
|
|
do
|
|
arg=$1
|
|
case "$arg" in
|
|
--version) echo "valgrind-$version"; exit 1 ;;
|
|
--skin=*) skin_arg=$arg; shift;;
|
|
--in-place=*) in_place_arg=$arg; shift;;
|
|
-*) vgopts="$vgopts $arg"; shift;;
|
|
*) break;;
|
|
esac
|
|
done
|
|
|
|
|
|
# Decide on the skin. Default to memory checking if not specified.
|
|
if [ z"$skin_arg" = z ]; then
|
|
skin=memcheck
|
|
else
|
|
# Hack off the "--skin=" prefix.
|
|
skin=`echo $skin_arg | sed 's/--skin=//'`
|
|
fi
|
|
|
|
# If running uninstalled version in-place...
|
|
if [ z"$in_place_arg" != z ]; then
|
|
in_place_dir=`echo $in_place_arg | sed 's/--in-place=//'`
|
|
skindir="$in_place_dir/$skin"
|
|
coredir="$in_place_dir/coregrind"
|
|
vgsupp="--suppressions=$in_place_dir/default.supp"
|
|
fi
|
|
|
|
# Setup skin shared object.
|
|
skin_so="vgskin_${skin}.so"
|
|
if [ ! -r "$skindir/$skin_so" ] ; then
|
|
echo
|
|
echo "Skin error:"
|
|
echo " The shared library \`$skin_so' for the chosen"
|
|
echo " skin \`$skin' could not be found in"
|
|
echo " $skindir"
|
|
echo
|
|
exit 1
|
|
fi
|
|
|
|
VG_ARGS="$VALGRIND_OPTS $vgsupp $vgopts"
|
|
|
|
export VG_ARGS
|
|
|
|
# Red Hat Linux 9 uses NPTL, which has a kernel interface
|
|
# unlike the linuxthreads interface valgrind expects. We can
|
|
# tell the dynamic loader to disable this interface using
|
|
# an environment variable.
|
|
|
|
if [ z"$nptl_threading" = zyes ]; then
|
|
LD_ASSUME_KERNEL=2.2.5
|
|
export LD_ASSUME_KERNEL
|
|
fi
|
|
|
|
# A bit subtle. The LD_PRELOAD added entry must be absolute
|
|
# and not depend on LD_LIBRARY_PATH. This is so that we can
|
|
# mess with LD_LIBRARY_PATH for child processes, which makes
|
|
# libpthread.so fall out of visibility, independently of
|
|
# whether valgrind.so is visible.
|
|
|
|
LD_LIBRARY_PATH=$coredir:$LD_LIBRARY_PATH
|
|
export LD_LIBRARY_PATH
|
|
|
|
# Insert skin .so before valgrind.so to override template functions.
|
|
LD_PRELOAD=$skindir/$skin_so:$coredir/valgrind.so:$LD_PRELOAD
|
|
export LD_PRELOAD
|
|
#LD_DEBUG=files
|
|
#LD_DEBUG=symbols
|
|
#export LD_DEBUG
|
|
|
|
# If no command given, act like -h was given so vg_main.c prints out
|
|
# the usage string. And pass to 'exec' tha name of any program -- it doesn't
|
|
# matter which -- because it won't be run anyway (we use 'true').
|
|
if [ $# != 0 ] ; then
|
|
exec "$@"
|
|
else
|
|
VG_ARGS="$VG_ARGS -h"
|
|
exec true
|
|
fi
|
|
|
|
##--------------------------------------------------------------------##
|
|
##--- end valgrind ---##
|
|
##--------------------------------------------------------------------##
|