| 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 | # Run with the TF environment variable set to a trace directory to open it. |
| 9 | # ex: TF=/my/trace ./runlttv |
| 10 | # |
| 11 | # The .runlttvrc file can be used to control its behavior. |
| 12 | # - by setting the TRACEFILE variable, a trace can be automatically loaded |
| 13 | # ex: TRACEFILE="-t /tmp/traces/dijkstra-20071212" |
| 14 | # - by setting the ARGS variable, a different set of plugins can be loaded |
| 15 | # for an example see the ARGS= line below |
| 16 | # - the LTTV_ARGS environment variable may be used to add additional arguments to lttv |
| 17 | # |
| 18 | # In order for icons to display correctly, it might be necessary to create a |
| 19 | # symlink: |
| 20 | # $ ln -s ./lttv/modules/gui/lttvwindow/pixmaps |
| 21 | # while in the same directory as this script. |
| 22 | |
| 23 | RCFILE=".runlttvrc" |
| 24 | |
| 25 | ARGS=\ |
| 26 | "-L lttv/modules/gui/lttvwindow/lttvwindow/.libs -m lttvwindow "\ |
| 27 | "-L lttv/modules/gui/controlflow/.libs -m guicontrolflow "\ |
| 28 | "-L lttv/modules/gui/detailedevents/.libs -m guievents "\ |
| 29 | "-L lttv/modules/gui/tracecontrol/.libs -m guitracecontrol "\ |
| 30 | "-L lttv/modules/gui/statistics/.libs -m guistatistics "\ |
| 31 | "-L lttv/modules/gui/resourceview/.libs -m resourceview "\ |
| 32 | "-L lttv/modules/gui/filter/.libs -m guifilter "\ |
| 33 | "-L lttv/modules/gui/interrupts/.libs -m interrupts "\ |
| 34 | "-L lttv/modules/gui/histogram/.libs -m guihistogram" |
| 35 | |
| 36 | if [ -e "lttv/lttv/.libs/lttv.real" ]; then |
| 37 | LTTV_EXEC="lttv/lttv/.libs/lttv.real" |
| 38 | elif [ -e "lttv/lttv/lttv.real" ]; then |
| 39 | LTTV_EXEC="lttv/lttv/lttv.real" |
| 40 | else |
| 41 | echo "error: LTTV should be compiled before running this script." >/dev/stderr |
| 42 | exit 1 |
| 43 | fi |
| 44 | |
| 45 | for a in $@; do |
| 46 | eval $(echo $a)"=1" |
| 47 | done |
| 48 | |
| 49 | if [ -n "$TF" ]; then |
| 50 | TRACEFILE="-t $TF" |
| 51 | fi |
| 52 | |
| 53 | if [ -e "$RCFILE" ]; then |
| 54 | source "$RCFILE"; |
| 55 | fi |
| 56 | |
| 57 | ARGS="$ARGS $LTTV_ARGS" |
| 58 | |
| 59 | if [ -n "$dbg" ]; then |
| 60 | LD_LIBRARY_PATH=ltt/.libs gdb --args $LTTV_EXEC $ARGS $TRACEFILE |
| 61 | elif [ -n "$valgrind" ]; then |
| 62 | LD_LIBRARY_PATH=ltt/.libs valgrind --track-origins=yes --show-reachable=yes --leak-check=full --error-limit=no $LTTV_EXEC $ARGS $TRACEFILE |
| 63 | elif [ -n "$strace" ]; then |
| 64 | LD_LIBRARY_PATH=ltt/.libs strace $LTTV_EXEC $ARGS $TRACEFILE |
| 65 | else |
| 66 | LD_LIBRARY_PATH=ltt/.libs $LTTV_EXEC $ARGS $TRACEFILE |
| 67 | fi |