[memleak] Add memleak directory and script to start program with it
[lttng-tools.git] / memleak / start-bin
1 #!/bin/bash
2 #
3 # Copyright (C) - 2013 Christian Babeux <christian.babeux@efficios.com>
4 #
5 # This program is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU General Public License, version 2 only, as published by
7 # the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12 # details.
13 #
14 # You should have received a copy of the GNU General Public License along with
15 # this program; if not, write to the Free Software Foundation, Inc., 51
16 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 LIB_MEMLEAK="lttng-memleak-finder.so"
19 LIB_STATS="lttng-malloc-stats.so"
20
21 ld_preload_lib="./$LIB_MEMLEAK"
22
23 if [ -z "$1" ]; then
24 echo "Usage: $0 [--stats] PROG"
25 exit 1
26 fi
27
28 if [ ! -f ./$LIB_MEMLEAK -a ! -f ./$LIB_STATS ]; then
29 echo "Please compile the $LIB_STATS and/or $LIB_MEMLEAK first."
30 exit 1
31 fi
32
33 if [ "$1" = "--stats" ]; then
34 ld_preload_lib="./$LIB_STATS"
35 shift
36 fi
37
38 LD_PRELOAD=$ld_preload_lib $@
This page took 0.030166 seconds and 4 git commands to generate.