Commit dc5b9ecf authored by Arnaud Blanchard's avatar Arnaud Blanchard

Make them work in local directories

parent 9b709f1b
......@@ -11,29 +11,35 @@
#Author: Arnaud Blanchard
#Date: April 2015
usage(){
echo "usage: debug.sh <project dir> [args ...]" >&2
}
blar_build_dir="${PWD}/build"
./compile.sh $1 "Debug" $1 || {
echo "fail compiling '$1'"
exit 1
}
[ $1 ] || { echo "Missing project directory."; usage; exit 1; }
cd $1;
project_dir="$PWD";
project_name=`basename $project_dir`;
cd - >/dev/null
cd `dirname $0`
blaar_dir="$PWD"
blaar_build_dir="${blaar_dir}_build"
./compile.sh "$project_dir" "Debug" "$project_name" >&2
[ $? ] || { echo "Fail compiling '$project_dir'" >&2; exit 2; }
bin_dir="$blar_build_dir/Debug/bin"
bin_dir="$blaar_build_dir/Debug/bin"
program=`basename $1`
shift #remove $1
echo >&2
echo "Debug $project_name" >&2
echo "==============" >&2
echo
echo "'run' to start" >&2
echo >&2
echo "execute:" >&2
echo
command -v lldb && { set -x; lldb -- "$bin_dir/$project_name" "$@"; }||{ set -x; gdb --args "$bin_dir/$project_name" "$@"; }
command -v lldb && {
set -x; lldb -- "$bin_dir/$program" "$@"
}||{
set -x; gdb --args $bin_dir/$program "$@"
}
......@@ -11,18 +11,33 @@
#Author: Arnaud Blanchard
#Date: April 2015
./compile.sh $1 "Debug" $1 || exit 1
usage(){
echo "usage: valgrind.sh <project dir> [args ...]" >&2
}
bin_dir="${PWD}_build/Debug/bin"
program=`basename $1`
shift #remove $1
[ $1 ] || { echo "Missing project directory."; usage; exit 1; }
cd $1;
project_dir="$PWD";
project_name=`basename $project_dir`;
cd - >/dev/null
cd `dirname $0`
blaar_dir="$PWD"
blaar_build_dir="${blaar_dir}_build"
./compile.sh "$project_dir" "Debug" "$project_name" >&2
[ $? ] || { echo "Fail compiling '$project_dir'" >&2; exit 2; }
bin_dir="$blaar_build_dir/Debug/bin"
shift #remove $0 i.e. run.sh
echo >&2
echo "Execute $project_name" >&2
echo "================" >&2
set -x #display command line
command -v valgrind &&{
set -x;
valgrind --dsymutil=yes $bin_dir/$program "$@" || echo "Problems of memory"
} || echo "You need to install valgrind"
command -v valgrind &&{ set -x; valgrind --dsymutil=yes --leak-check=full --show-leak-kinds=all "$bin_dir/$project_name" "$@" || echo "Problems of memory"; } || { echo "You need to install valgrind"; exit 1; }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment