Commit | Line | Data |
---|---|---|
94e22cd1 | 1 | #!/bin/sh |
2 | # Released under the GPL | |
3 | # pmf - 2008/07/31 | |
4 | ||
eb9ab977 | 5 | # This script runs LTTV in place in the compile directory without need for |
6 | # installing it with make install. | |
58f53b56 | 7 | # |
eb9ab977 | 8 | # In order for icons to display correctly, it might be necessary to create a |
9 | # symlink: | |
94e22cd1 | 10 | # $ ln -s ./lttv/modules/gui/lttvwindow/pixmaps |
11 | # while in the same directory as this script. | |
12 | ||
a7bbe2f6 | 13 | RCFILE="$(dirname $0)/.runlttvrc" |
94e22cd1 | 14 | |
ceedc609 PMF |
15 | function usage { |
16 | echo "Usage: $0 OPTIONS TRACES..." >/dev/stderr | |
17 | echo "" >/dev/stderr | |
18 | echo "Options:" >/dev/stderr | |
19 | echo -e "\t-m mode (modes: text)" >/dev/stderr | |
20 | echo -e "\t-H helper (helpers: gdb, valgrind, massif, strace)" >/dev/stderr | |
21 | echo "" >/dev/stderr | |
22 | } | |
3d55af6e | 23 | |
011e5097 BP |
24 | if [ -e "lttv/lttv/.libs/lttv.real" ]; then |
25 | LTTV_EXEC="lttv/lttv/.libs/lttv.real" | |
26 | elif [ -e "lttv/lttv/lttv.real" ]; then | |
27 | LTTV_EXEC="lttv/lttv/lttv.real" | |
28 | else | |
f034e1cb | 29 | echo "error: LTTV should be compiled before running this script." >/dev/stderr |
30 | exit 1 | |
31 | fi | |
94e22cd1 | 32 | |
33 | if [ -e "$RCFILE" ]; then | |
34 | source "$RCFILE"; | |
35 | fi | |
36 | ||
ceedc609 PMF |
37 | while getopts ":hH:m:" options; do |
38 | case $options in | |
39 | H) HELPER=$OPTARG;; | |
40 | m) MODE=$OPTARG;; | |
41 | h) usage; | |
42 | exit 0;; | |
43 | \?) usage | |
44 | exit 1;; | |
45 | *) usage | |
46 | exit 1;; | |
47 | esac | |
48 | done | |
49 | shift $(($OPTIND - 1)) | |
50 | ||
51 | for trace in $@; | |
52 | do | |
53 | TRACEFILE="$TRACEFILE -t $trace " | |
54 | done | |
55 | ||
56 | if [ "$MODE" = "text" ]; then | |
57 | ARGS="-L lttv/modules/text/.libs -m textDump" | |
58 | else | |
59 | ARGS="-L lttv/modules/gui/lttvwindow/lttvwindow/.libs -m lttvwindow "\ | |
60 | "-L lttv/modules/gui/controlflow/.libs -m guicontrolflow "\ | |
61 | "-L lttv/modules/gui/detailedevents/.libs -m guievents "\ | |
62 | "-L lttv/modules/gui/tracecontrol/.libs -m guitracecontrol "\ | |
63 | "-L lttv/modules/gui/statistics/.libs -m guistatistics "\ | |
64 | "-L lttv/modules/gui/resourceview/.libs -m resourceview "\ | |
65 | "-L lttv/modules/gui/filter/.libs -m guifilter "\ | |
66 | "-L lttv/modules/gui/interrupts/.libs -m interrupts "\ | |
67 | "-L lttv/modules/gui/histogram/.libs -m guihistogram" | |
68 | fi | |
69 | ||
91840ab1 | 70 | if [ "$HELPER" = "gdb" ]; then |
89db30b2 BP |
71 | shift |
72 | LD_LIBRARY_PATH=ltt/.libs gdb --args $LTTV_EXEC $ARGS $TRACEFILE $@ | |
73 | elif [ "$HELPER" = "valgrind" ]; then | |
74 | shift | |
75 | LD_LIBRARY_PATH=ltt/.libs valgrind --track-origins=yes --show-reachable=yes --leak-check=full --error-limit=no $LTTV_EXEC $ARGS $TRACEFILE $@ | |
ad5078da BP |
76 | elif [ "$HELPER" = "massif" ]; then |
77 | shift | |
78 | LD_LIBRARY_PATH=ltt/.libs valgrind --tool=massif $LTTV_EXEC $ARGS $TRACEFILE $@ | |
89db30b2 BP |
79 | elif [ "$HELPER" = "strace" ]; then |
80 | shift | |
81 | LD_LIBRARY_PATH=ltt/.libs strace $LTTV_EXEC $ARGS $TRACEFILE $@ | |
94e22cd1 | 82 | else |
89db30b2 | 83 | LD_LIBRARY_PATH=ltt/.libs $LTTV_EXEC $ARGS $TRACEFILE $@ |
94e22cd1 | 84 | fi |