runlttv: use cmd line arguments instead of environment variables
[lttv.git] / runlttv
1 #!/bin/sh
2 # Released under the GPL
3 # pmf - 2008/07/31
4
5 # This script runs LTTV in place in the compile directory without need for
6 # installing it with make install.
7 #
8 # In order for icons to display correctly, it might be necessary to create a
9 # symlink:
10 # $ ln -s ./lttv/modules/gui/lttvwindow/pixmaps
11 # while in the same directory as this script.
12
13 RCFILE="$(dirname $0)/.runlttvrc"
14
15 function usage {
16 echo "Usage: $0 OPTIONS TRACES..." >/dev/stderr
17 echo "" >/dev/stderr
18 echo "Options:" >/dev/stderr
19 echo -e "\t-m mode (modes: text)" >/dev/stderr
20 echo -e "\t-H helper (helpers: gdb, valgrind, massif, strace)" >/dev/stderr
21 echo "" >/dev/stderr
22 }
23
24 if [ -e "lttv/lttv/.libs/lttv.real" ]; then
25 LTTV_EXEC="lttv/lttv/.libs/lttv.real"
26 elif [ -e "lttv/lttv/lttv.real" ]; then
27 LTTV_EXEC="lttv/lttv/lttv.real"
28 else
29 echo "error: LTTV should be compiled before running this script." >/dev/stderr
30 exit 1
31 fi
32
33 if [ -e "$RCFILE" ]; then
34 source "$RCFILE";
35 fi
36
37 while getopts ":hH:m:" options; do
38 case $options in
39 H) HELPER=$OPTARG;;
40 m) MODE=$OPTARG;;
41 h) usage;
42 exit 0;;
43 \?) usage
44 exit 1;;
45 *) usage
46 exit 1;;
47 esac
48 done
49 shift $(($OPTIND - 1))
50
51 for trace in $@;
52 do
53 TRACEFILE="$TRACEFILE -t $trace "
54 done
55
56 if [ "$MODE" = "text" ]; then
57 ARGS="-L lttv/modules/text/.libs -m textDump"
58 else
59 ARGS="-L lttv/modules/gui/lttvwindow/lttvwindow/.libs -m lttvwindow "\
60 "-L lttv/modules/gui/controlflow/.libs -m guicontrolflow "\
61 "-L lttv/modules/gui/detailedevents/.libs -m guievents "\
62 "-L lttv/modules/gui/tracecontrol/.libs -m guitracecontrol "\
63 "-L lttv/modules/gui/statistics/.libs -m guistatistics "\
64 "-L lttv/modules/gui/resourceview/.libs -m resourceview "\
65 "-L lttv/modules/gui/filter/.libs -m guifilter "\
66 "-L lttv/modules/gui/interrupts/.libs -m interrupts "\
67 "-L lttv/modules/gui/histogram/.libs -m guihistogram"
68 fi
69
70 if [ "$HELPER" = "gdb" ]; then
71 shift
72 LD_LIBRARY_PATH=ltt/.libs gdb --args $LTTV_EXEC $ARGS $TRACEFILE $@
73 elif [ "$HELPER" = "valgrind" ]; then
74 shift
75 LD_LIBRARY_PATH=ltt/.libs valgrind --track-origins=yes --show-reachable=yes --leak-check=full --error-limit=no $LTTV_EXEC $ARGS $TRACEFILE $@
76 elif [ "$HELPER" = "massif" ]; then
77 shift
78 LD_LIBRARY_PATH=ltt/.libs valgrind --tool=massif $LTTV_EXEC $ARGS $TRACEFILE $@
79 elif [ "$HELPER" = "strace" ]; then
80 shift
81 LD_LIBRARY_PATH=ltt/.libs strace $LTTV_EXEC $ARGS $TRACEFILE $@
82 else
83 LD_LIBRARY_PATH=ltt/.libs $LTTV_EXEC $ARGS $TRACEFILE $@
84 fi
This page took 0.033197 seconds and 5 git commands to generate.