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