Add pixmaps shortcut
[lttv.git] / runlttv
... / ...
CommitLineData
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
13PROGNAME=$0
14RCFILE="$(dirname $0)/.runlttvrc"
15TEXTLIBS="-L lttv/modules/text/.libs -m textDump"
16GRAPHLIBS="-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"
25DEFAULTMODE="gui"
26
27usage () {
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)\n" >/dev/stderr
32 printf "\t-H HELPER Invoke LTTV through a helper program\n" >/dev/stderr
33 printf "\t (helpers: gdb, valgrind, massif, strace)\n" >/dev/stderr
34 printf "\t-b OPTIONS LTTV options to specify before the module list\n" >/dev/stderr
35 printf "\t-a OPTIONS LTTV options to specify after the module list\n" >/dev/stderr
36 echo "" >/dev/stderr
37}
38
39if [ -e "lttv/lttv/.libs/lttv.real" ]; then
40 LTTV_EXEC="lttv/lttv/.libs/lttv.real"
41elif [ -e "lttv/lttv/lttv.real" ]; then
42 LTTV_EXEC="lttv/lttv/lttv.real"
43else
44 echo "error: LTTV should be compiled before running this script." >/dev/stderr
45 exit 1
46fi
47
48while 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
59done
60shift $(($OPTIND - 1))
61
62for trace in $@
63do
64 TRACEFILES="$TRACEFILES -t $trace "
65done
66
67if [ -e "$RCFILE" ]; then
68 . "$RCFILE";
69fi
70
71if [ -z "$MODE" ]; then
72 MODE=$DEFAULTMODE
73fi
74
75if [ "$MODE" = "text" ]; then
76 LIBS="$TEXTLIBS"
77elif [ "$MODE" = "gui" ]; then
78 LIBS="$GRAPHLIBS"
79else
80 echo "$PROGNAME: unknown mode -- $MODE" >/dev/stderr
81 exit 1
82fi
83
84LTTV_ARGS="$BOPTIONS $LIBS $TRACEFILES $AOPTIONS"
85if [ "$HELPER" = "gdb" ]; then
86 LD_LIBRARY_PATH=ltt/.libs gdb --args $LTTV_EXEC $LTTV_ARGS
87elif [ "$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
89elif [ "$HELPER" = "massif" ]; then
90 LD_LIBRARY_PATH=ltt/.libs valgrind --tool=massif $LTTV_EXEC $LTTV_ARGS
91elif [ "$HELPER" = "strace" ]; then
92 LD_LIBRARY_PATH=ltt/.libs strace $LTTV_EXEC $LTTV_ARGS
93else
94 LD_LIBRARY_PATH=ltt/.libs $LTTV_EXEC $LTTV_ARGS
95fi
This page took 0.021933 seconds and 4 git commands to generate.