mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 18:56:10 +00:00
- vg_cachesim.c
- vg_cachesim_{I1,D1,L2}.c
- vg_annotate.in
- vg_cachegen.in
Changes to existing files:
- valgrind/valgrind.in, added option:
--cachesim=no|yes [no]
- Makefile/Makefile.am:
* added vg_cachesim.c to valgrind_so_SOURCES var
* added vg_cachesim_I1.c, vg_cachesim_D1.c, vg_cachesim_L2.c to
noinst_HEADERS var
* added vg_annotate, vg_cachegen to 'bin_SCRIPTS' var, and added empty
targets for them
- vg_main.c:
* added two offsets for cache sim functions (put in positions 17a,17b)
* added option handling (detection of --cachesim=yes which turns off of
--instrument);
* added calls to cachesim initialisation/finalisation functions
- vg_mylibc: added some system call wrappers (for chmod, open_write, etc) for
file writing
- vg_symtab2.c:
* allow it to read symbols if either of --instrument or --cachesim is
used
* made vg_symtab2.c:vg_what_{line,fn}_is_this extern, renaming it as
VG_(what_line_is_this) (and added to vg_include.h)
* completely rewrote the read loop in vg_read_lib_symbols, fixing
several bugs. Much better now, although probably not perfect. It's
also relatively fragile -- I'm using the "die immediately if anything
unexpected happens" approach.
- vg_to_ucode.c:
* in VG_(disBB), patching in x86 instruction size into extra4b field of
JMP instructions at the end of basic blocks if --cachesim=yes.
Shifted things around to do this; also had to fiddle around with
single-step stuff to get this to work, by not sticking extra JMPs on
the end of the single-instruction block if there was already one
there (to avoid breaking an assertion in vg_cachesim.c). Did a
similar thing to avoid an extra JMP on huge basic blocks that are
split.
- vg_translate.c:
* if --cachesim=yes call the cachesim instrumentation phase
* made some functions extern and renamed:
allocCodeBlock() --> VG_(allocCodeBlock)()
freeCodeBlock() --> VG_(freeCodeBlock)()
copyUInstr() --> VG_(copyUInstr)()
(added to vg_include.h too)
- vg_include.c: declared
* cachesim offsets
* exports of vg_cachesim.c
* added four new profiling events (increasing VGP_M_CCS to 24 -- I kept
the spare ones)
* added comment about UInstr.extra4b field being used for instr size in
JMPs for cache simulation
- docs/manual.html:
* Added --cachesim option to section 2.5.
* Added cache profiling stuff as section 7.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@168
175 lines
7.8 KiB
Bash
Executable File
175 lines
7.8 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Should point to the installation directory
|
|
prefix="@prefix@"
|
|
exec_prefix="@exec_prefix@"
|
|
VALGRIND="@libdir@/valgrind"
|
|
|
|
|
|
# Other stuff ...
|
|
version="@VERSION@"
|
|
emailto="jseward@acm.org"
|
|
|
|
# The default name of the suppressions file
|
|
vgsupp="--suppressions=$VALGRIND/default.supp"
|
|
|
|
# name we were invoked with
|
|
vgname=`echo $0 | sed 's,^.*/,,'`
|
|
|
|
# Valgrind options
|
|
vgopts=
|
|
|
|
# Prog and arg to run
|
|
argopts=
|
|
|
|
# Show usage info?
|
|
dousage=0
|
|
|
|
# show version info?
|
|
doversion=0
|
|
|
|
# Collect up args for Valgrind
|
|
while [ $+ != 0 ]
|
|
do
|
|
arg=$1
|
|
case "$arg" in
|
|
# options for the user
|
|
--help) dousage=1; break;;
|
|
--version) doversion=1; break;;
|
|
--logfile-fd=*) vgopts="$vgopts $arg"; shift;;
|
|
-v) vgopts="$vgopts $arg"; shift;;
|
|
--verbose) vgopts="$vgopts -v"; shift;;
|
|
-q) vgopts="$vgopts $arg"; shift;;
|
|
--quiet) vgopts="$vgopts $arg"; shift;;
|
|
--check-addrVs=no) vgopts="$vgopts $arg"; shift;;
|
|
--check-addrVs=yes) vgopts="$vgopts $arg"; shift;;
|
|
--gdb-attach=no) vgopts="$vgopts $arg"; shift;;
|
|
--gdb-attach=yes) vgopts="$vgopts $arg"; shift;;
|
|
--demangle=no) vgopts="$vgopts $arg"; shift;;
|
|
--demangle=yes) vgopts="$vgopts $arg"; shift;;
|
|
--num-callers=*) vgopts="$vgopts $arg"; shift;;
|
|
--partial-loads-ok=no) vgopts="$vgopts $arg"; shift;;
|
|
--partial-loads-ok=yes) vgopts="$vgopts $arg"; shift;;
|
|
--leak-check=no) vgopts="$vgopts $arg"; shift;;
|
|
--leak-check=yes) vgopts="$vgopts $arg"; shift;;
|
|
--show-reachable=no) vgopts="$vgopts $arg"; shift;;
|
|
--show-reachable=yes) vgopts="$vgopts $arg"; shift;;
|
|
--leak-resolution=low) vgopts="$vgopts $arg"; shift;;
|
|
--leak-resolution=med) vgopts="$vgopts $arg"; shift;;
|
|
--leak-resolution=high) vgopts="$vgopts $arg"; shift;;
|
|
--sloppy-malloc=no) vgopts="$vgopts $arg"; shift;;
|
|
--sloppy-malloc=yes) vgopts="$vgopts $arg"; shift;;
|
|
--trace-children=no) vgopts="$vgopts $arg"; shift;;
|
|
--trace-children=yes) vgopts="$vgopts $arg"; shift;;
|
|
--workaround-gcc296-bugs=no) vgopts="$vgopts $arg"; shift;;
|
|
--workaround-gcc296-bugs=yes) vgopts="$vgopts $arg"; shift;;
|
|
--freelist-vol=*) vgopts="$vgopts $arg"; shift;;
|
|
--suppressions=*) vgopts="$vgopts $arg"; shift;;
|
|
--cachesim=yes) vgopts="$vgopts $arg"; shift;;
|
|
--cachesim=no) vgopts="$vgopts $arg"; shift;;
|
|
# options for debugging Valgrind
|
|
--sanity-level=*) vgopts="$vgopts $arg"; shift;;
|
|
--single-step=yes) vgopts="$vgopts $arg"; shift;;
|
|
--single-step=no) vgopts="$vgopts $arg"; shift;;
|
|
--optimise=yes) vgopts="$vgopts $arg"; shift;;
|
|
--optimise=no) vgopts="$vgopts $arg"; shift;;
|
|
--instrument=yes) vgopts="$vgopts $arg"; shift;;
|
|
--instrument=no) vgopts="$vgopts $arg"; shift;;
|
|
--cleanup=yes) vgopts="$vgopts $arg"; shift;;
|
|
--cleanup=no) vgopts="$vgopts $arg"; shift;;
|
|
--smc-check=none) vgopts="$vgopts $arg"; shift;;
|
|
--smc-check=some) vgopts="$vgopts $arg"; shift;;
|
|
--smc-check=all) vgopts="$vgopts $arg"; shift;;
|
|
--trace-syscalls=yes) vgopts="$vgopts $arg"; shift;;
|
|
--trace-syscalls=no) vgopts="$vgopts $arg"; shift;;
|
|
--trace-signals=yes) vgopts="$vgopts $arg"; shift;;
|
|
--trace-signals=no) vgopts="$vgopts $arg"; shift;;
|
|
--trace-symtab=yes) vgopts="$vgopts $arg"; shift;;
|
|
--trace-symtab=no) vgopts="$vgopts $arg"; shift;;
|
|
--trace-malloc=yes) vgopts="$vgopts $arg"; shift;;
|
|
--trace-malloc=no) vgopts="$vgopts $arg"; shift;;
|
|
--trace-sched=yes) vgopts="$vgopts $arg"; shift;;
|
|
--trace-sched=no) vgopts="$vgopts $arg"; shift;;
|
|
--trace-pthread=none) vgopts="$vgopts $arg"; shift;;
|
|
--trace-pthread=some) vgopts="$vgopts $arg"; shift;;
|
|
--trace-pthread=all) vgopts="$vgopts $arg"; shift;;
|
|
--stop-after=*) vgopts="$vgopts $arg"; shift;;
|
|
--dump-error=*) vgopts="$vgopts $arg"; shift;;
|
|
-*) dousage=1; break;;
|
|
*) break;;
|
|
esac
|
|
done
|
|
|
|
if [ z"$doversion" = z1 ]; then
|
|
echo "valgrind-$version"
|
|
exit 1
|
|
fi
|
|
|
|
if [ $# = 0 ] || [ z"$dousage" = z1 ]; then
|
|
echo
|
|
echo "usage: $vgname [options] prog-and-args"
|
|
echo
|
|
echo " options for the user, with defaults in [ ], are:"
|
|
echo " --help show this message"
|
|
echo " --version show version"
|
|
echo " -q --quiet run silently; only print error msgs"
|
|
echo " -v --verbose be more verbose, incl counts of errors"
|
|
echo " --gdb-attach=no|yes start GDB when errors detected? [no]"
|
|
echo " --demangle=no|yes automatically demangle C++ names? [yes]"
|
|
echo " --num-callers=<number> show <num> callers in stack traces [4]"
|
|
echo " --partial-loads-ok=no|yes too hard to explain here; see manual [yes]"
|
|
echo " --leak-check=no|yes search for memory leaks at exit? [no]"
|
|
echo " --leak-resolution=low|med|high"
|
|
echo " amount of bt merging in leak check [low]"
|
|
echo " --show-reachable=no|yes show reachable blocks in leak check? [no]"
|
|
echo " --sloppy-malloc=no|yes round malloc sizes to next word? [no]"
|
|
echo " --trace-children=no|yes Valgrind-ise child processes? [no]"
|
|
echo " --logfile-fd=<number> file descriptor for messages [2=stderr]"
|
|
echo " --freelist-vol=<number> volume of freed blocks queue [1000000]"
|
|
echo " --workaround-gcc296-bugs=no|yes self explanatory [no]"
|
|
echo " --suppressions=<filename> suppress errors described in"
|
|
echo " suppressions file <filename>"
|
|
echo " --check-addrVs=no|yes experimental lighterweight checking? [yes]"
|
|
echo " yes == Valgrind's original behaviour"
|
|
echo " --cachesim=no|yes do cache profiling? [no]"
|
|
echo
|
|
echo " options for debugging Valgrind itself are:"
|
|
echo " --sanity-level=<number> level of sanity checking to do [1]"
|
|
echo " --single-step=no|yes translate each instr separately? [no]"
|
|
echo " --optimise=no|yes improve intermediate code? [yes]"
|
|
echo " --instrument=no|yes actually do memory checks? [yes]"
|
|
echo " --cleanup=no|yes improve after instrumentation? [yes]"
|
|
echo " --smc-check=none|some|all check writes for s-m-c? [some]"
|
|
echo " --trace-syscalls=no|yes show all system calls? [no]"
|
|
echo " --trace-signals=no|yes show signal handling details? [no]"
|
|
echo " --trace-symtab=no|yes show symbol table details? [no]"
|
|
echo " --trace-malloc=no|yes show client malloc details? [no]"
|
|
echo " --trace-sched=no|yes show thread scheduler details? [no]"
|
|
echo " --trace-pthread=none|some|all show pthread event details? [no]"
|
|
echo " --stop-after=<number> switch to real CPU after executing"
|
|
echo " <number> basic blocks [infinity]"
|
|
echo " --dump-error=<number> show translation for basic block"
|
|
echo " associated with <number>'th"
|
|
echo " error context [0=don't show any]"
|
|
echo
|
|
echo " Extra options are read from env variable \$VALGRIND_OPTS"
|
|
echo
|
|
echo " Valgrind is Copyright (C) 2000-2002 Julian Seward"
|
|
echo " and licensed under the GNU General Public License, version 2."
|
|
echo " Bug reports, feedback, admiration, abuse, etc, to: $emailto."
|
|
echo
|
|
exit 1
|
|
fi
|
|
|
|
|
|
VG_ARGS="$VALGRIND_OPTS $vgsupp $vgopts"
|
|
export VG_ARGS
|
|
LD_LIBRARY_PATH=$VALGRIND:$LD_LIBRARY_PATH
|
|
export LD_LIBRARY_PATH
|
|
LD_PRELOAD=valgrind.so:$LD_PRELOAD
|
|
export LD_PRELOAD
|
|
#LD_DEBUG=files
|
|
#LD_DEBUG=symbols
|
|
#export LD_DEBUG
|
|
exec "$@"
|