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