| 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 | # |
| 17 | # In order for icons to display correctly, it might be necessary to create a |
| 18 | # symlink: |
| 19 | # $ ln -s ./lttv/modules/gui/lttvwindow/pixmaps |
| 20 | # while in the same directory as this script. |
| 21 | |
| 22 | RCFILE=".runlttvrc" |
| 23 | |
| 24 | if [ "$MODE" = "text" ]; then |
| 25 | ARGS="-L lttv/modules/text/.libs -m textDump" |
| 26 | else |
| 27 | ARGS="-L lttv/modules/gui/lttvwindow/lttvwindow/.libs -m lttvwindow "\ |
| 28 | "-L lttv/modules/gui/controlflow/.libs -m guicontrolflow "\ |
| 29 | "-L lttv/modules/gui/detailedevents/.libs -m guievents "\ |
| 30 | "-L lttv/modules/gui/tracecontrol/.libs -m guitracecontrol "\ |
| 31 | "-L lttv/modules/gui/statistics/.libs -m guistatistics "\ |
| 32 | "-L lttv/modules/gui/resourceview/.libs -m resourceview "\ |
| 33 | "-L lttv/modules/gui/filter/.libs -m guifilter "\ |
| 34 | "-L lttv/modules/gui/interrupts/.libs -m interrupts "\ |
| 35 | "-L lttv/modules/gui/histogram/.libs -m guihistogram" |
| 36 | fi |
| 37 | |
| 38 | if [ -e "lttv/lttv/.libs/lttv.real" ]; then |
| 39 | LTTV_EXEC="lttv/lttv/.libs/lttv.real" |
| 40 | elif [ -e "lttv/lttv/lttv.real" ]; then |
| 41 | LTTV_EXEC="lttv/lttv/lttv.real" |
| 42 | else |
| 43 | echo "error: LTTV should be compiled before running this script." >/dev/stderr |
| 44 | exit 1 |
| 45 | fi |
| 46 | |
| 47 | if [ -n "$TF" ]; then |
| 48 | TRACEFILE="-t $TF" |
| 49 | fi |
| 50 | |
| 51 | if [ -e "$RCFILE" ]; then |
| 52 | source "$RCFILE"; |
| 53 | fi |
| 54 | |
| 55 | HELPER=$1 |
| 56 | if [ "$HELPER" = "gdb" ]; then |
| 57 | shift |
| 58 | LD_LIBRARY_PATH=ltt/.libs gdb --args $LTTV_EXEC $ARGS $TRACEFILE $@ |
| 59 | elif [ "$HELPER" = "valgrind" ]; then |
| 60 | shift |
| 61 | LD_LIBRARY_PATH=ltt/.libs valgrind --track-origins=yes --show-reachable=yes --leak-check=full --error-limit=no $LTTV_EXEC $ARGS $TRACEFILE $@ |
| 62 | elif [ "$HELPER" = "massif" ]; then |
| 63 | shift |
| 64 | LD_LIBRARY_PATH=ltt/.libs valgrind --tool=massif $LTTV_EXEC $ARGS $TRACEFILE $@ |
| 65 | elif [ "$HELPER" = "strace" ]; then |
| 66 | shift |
| 67 | LD_LIBRARY_PATH=ltt/.libs strace $LTTV_EXEC $ARGS $TRACEFILE $@ |
| 68 | else |
| 69 | LD_LIBRARY_PATH=ltt/.libs $LTTV_EXEC $ARGS $TRACEFILE $@ |
| 70 | fi |