Removing whitespace/align errors
[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 PROGNAME=$0
14 RCFILE="$(dirname $0)/.runlttvrc"
15 TEXTLIBS="-L lttv/modules/text/.libs -m textDump"
16 GRAPHLIBS="-L lttv/modules/gui/lttvwindow/lttvwindow/.libs -m lttvwindow "\
17 "-L lttv/modules/gui/controlflow/.libs -m guicontrolflow "\
18 "-L lttv/modules/gui/detailedevents/.libs -m guievents "\
19 "-L lttv/modules/gui/tracecontrol/.libs -m guitracecontrol "\
20 "-L lttv/modules/gui/statistics/.libs -m guistatistics "\
21 "-L lttv/modules/gui/resourceview/.libs -m resourceview "\
22 "-L lttv/modules/gui/filter/.libs -m guifilter "\
23 "-L lttv/modules/gui/interrupts/.libs -m interrupts "\
24 "-L lttv/modules/gui/histogram/.libs -m guihistogram"
25 DEFAULTMODE="gui"
26
27 usage () {
28 echo "Usage: $0 [OPTION]... [TRACE]..." >/dev/stderr
29 echo "" >/dev/stderr
30 echo "Options:" >/dev/stderr
31 printf "\t-m MODE Output mode (modes: text, gui)" >/dev/stderr
32 printf "\t-H HELPER Invoke LTTV through a helper program" >/dev/stderr
33 printf "\t (helpers: gdb, valgrind, massif, strace)" >/dev/stderr
34 printf "\t-b OPTIONS LTTV options to specify before the module list" >/dev/stderr
35 printf "\t-a OPTIONS LTTV options to specify after the module list" >/dev/stderr
36 echo "" >/dev/stderr
37 }
38
39 if [ -e "lttv/lttv/.libs/lttv.real" ]; then
40 LTTV_EXEC="lttv/lttv/.libs/lttv.real"
41 elif [ -e "lttv/lttv/lttv.real" ]; then
42 LTTV_EXEC="lttv/lttv/lttv.real"
43 else
44 echo "error: LTTV should be compiled before running this script." >/dev/stderr
45 exit 1
46 fi
47
48 while getopts "H:m:b:a:h" options; do
49 case $options in
50 H) HELPER=$OPTARG;;
51 m) MODE=$OPTARG;;
52 b) BOPTIONS="$BOPTIONS $OPTARG";;
53 a) AOPTIONS="$AOPTIONS $OPTARG";;
54 h) usage;
55 exit 0;;
56 \?) usage;
57 exit 1;;
58 esac
59 done
60 shift $(($OPTIND - 1))
61
62 for trace in $@
63 do
64 TRACEFILES="$TRACEFILES -t $trace "
65 done
66
67 if [ -e "$RCFILE" ]; then
68 . "$RCFILE";
69 fi
70
71 if [ -z "$MODE" ]; then
72 MODE=$DEFAULTMODE
73 fi
74
75 if [ "$MODE" = "text" ]; then
76 LIBS="$TEXTLIBS"
77 elif [ "$MODE" = "gui" ]; then
78 LIBS="$GRAPHLIBS"
79 else
80 echo "$PROGNAME: unknown mode -- $MODE" >/dev/stderr
81 exit 1
82 fi
83
84 LTTV_ARGS="$BOPTIONS $LIBS $TRACEFILES $AOPTIONS"
85 if [ "$HELPER" = "gdb" ]; then
86 LD_LIBRARY_PATH=ltt/.libs gdb --args $LTTV_EXEC $LTTV_ARGS
87 elif [ "$HELPER" = "valgrind" ]; then
88 LD_LIBRARY_PATH=ltt/.libs valgrind --track-origins=yes --show-reachable=yes --leak-check=full --error-limit=no $LTTV_EXEC $LTTV_ARGS
89 elif [ "$HELPER" = "massif" ]; then
90 LD_LIBRARY_PATH=ltt/.libs valgrind --tool=massif $LTTV_EXEC $LTTV_ARGS
91 elif [ "$HELPER" = "strace" ]; then
92 LD_LIBRARY_PATH=ltt/.libs strace $LTTV_EXEC $LTTV_ARGS
93 else
94 LD_LIBRARY_PATH=ltt/.libs $LTTV_EXEC $LTTV_ARGS
95 fi
This page took 0.031851 seconds and 4 git commands to generate.