X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=runlttv;h=73b7d8ee53741f25eda30e7a131a4fda7d6151e8;hb=c885e35c6ebb432e3434bfb0d2d3a3e09ad8e2bc;hp=31728d65b0d3c786cd93b5b8d08ad5b0c2a6fbc1;hpb=011e5097367fb6ca911b128beee969994d4cf5d5;p=lttv.git diff --git a/runlttv b/runlttv index 31728d65..73b7d8ee 100755 --- a/runlttv +++ b/runlttv @@ -4,31 +4,22 @@ # This script runs LTTV in place in the compile directory without need for # installing it with make install. -# -# The .runlttvrc file can be used to control its behavior. -# - by setting the TRACEFILE variable, a trace can be automatically loaded -# ex: TRACEFILE="-t /tmp/traces/dijkstra-20071212" -# - by setting the ARGS variable, a different set of plugins can be loaded -# for an example see the ARGS= line below -# - the LTTV_ARGS environment variable may be used to add additional arguments to lttv # # In order for icons to display correctly, it might be necessary to create a # symlink: # $ ln -s ./lttv/modules/gui/lttvwindow/pixmaps # while in the same directory as this script. -RCFILE=".runlttvrc" +RCFILE="$(dirname $0)/.runlttvrc" -ARGS=\ -"-L lttv/modules/gui/lttvwindow/lttvwindow/.libs -m lttvwindow "\ -"-L lttv/modules/gui/controlflow/.libs -m guicontrolflow "\ -"-L lttv/modules/gui/detailedevents/.libs -m guievents "\ -"-L lttv/modules/gui/tracecontrol/.libs -m guitracecontrol "\ -"-L lttv/modules/gui/statistics/.libs -m guistatistics "\ -"-L lttv/modules/gui/resourceview/.libs -m resourceview "\ -"-L lttv/modules/gui/filter/.libs -m guifilter "\ -"-L lttv/modules/gui/interrupts/.libs -m interrupts "\ -"-L lttv/modules/gui/histogram/.libs -m guihistogram" +function usage { + echo "Usage: $0 OPTIONS TRACES..." >/dev/stderr + echo "" >/dev/stderr + echo "Options:" >/dev/stderr + echo -e "\t-m mode (modes: text)" >/dev/stderr + echo -e "\t-H helper (helpers: gdb, valgrind, massif, strace)" >/dev/stderr + echo "" >/dev/stderr +} if [ -e "lttv/lttv/.libs/lttv.real" ]; then LTTV_EXEC="lttv/lttv/.libs/lttv.real" @@ -39,24 +30,55 @@ else exit 1 fi -for a in $@; do - eval $(echo $a)"=1" -done - if [ -e "$RCFILE" ]; then source "$RCFILE"; fi -ARGS="$ARGS $LTTV_ARGS" +while getopts ":hH:m:" options; do + case $options in + H) HELPER=$OPTARG;; + m) MODE=$OPTARG;; + h) usage; + exit 0;; + \?) usage + exit 1;; + *) usage + exit 1;; + esac +done +shift $(($OPTIND - 1)) -echo $dbg +for trace in $@; +do + TRACEFILE="$TRACEFILE -t $trace " +done + +if [ "$MODE" = "text" ]; then + ARGS="-L lttv/modules/text/.libs -m textDump" +else + ARGS="-L lttv/modules/gui/lttvwindow/lttvwindow/.libs -m lttvwindow "\ +"-L lttv/modules/gui/controlflow/.libs -m guicontrolflow "\ +"-L lttv/modules/gui/detailedevents/.libs -m guievents "\ +"-L lttv/modules/gui/tracecontrol/.libs -m guitracecontrol "\ +"-L lttv/modules/gui/statistics/.libs -m guistatistics "\ +"-L lttv/modules/gui/resourceview/.libs -m resourceview "\ +"-L lttv/modules/gui/filter/.libs -m guifilter "\ +"-L lttv/modules/gui/interrupts/.libs -m interrupts "\ +"-L lttv/modules/gui/histogram/.libs -m guihistogram" +fi -if [ -n "$dbg" ]; then - LD_LIBRARY_PATH=ltt/.libs gdb --args $LTTV_EXEC $ARGS $TRACEFILE -elif [ -n "$valgrind" ]; then - LD_LIBRARY_PATH=ltt/.libs valgrind --track-origins=yes --show-reachable=yes --leak-check=full --error-limit=no $LTTV_EXEC $ARGS $TRACEFILE -elif [ -n "$strace" ]; then - LD_LIBRARY_PATH=ltt/.libs strace $LTTV_EXEC $ARGS $TRACEFILE +if [ "$HELPER" = "gdb" ]; then + shift + LD_LIBRARY_PATH=ltt/.libs gdb --args $LTTV_EXEC $ARGS $TRACEFILE $@ +elif [ "$HELPER" = "valgrind" ]; then + shift + LD_LIBRARY_PATH=ltt/.libs valgrind --track-origins=yes --show-reachable=yes --leak-check=full --error-limit=no $LTTV_EXEC $ARGS $TRACEFILE $@ +elif [ "$HELPER" = "massif" ]; then + shift + LD_LIBRARY_PATH=ltt/.libs valgrind --tool=massif $LTTV_EXEC $ARGS $TRACEFILE $@ +elif [ "$HELPER" = "strace" ]; then + shift + LD_LIBRARY_PATH=ltt/.libs strace $LTTV_EXEC $ARGS $TRACEFILE $@ else - LD_LIBRARY_PATH=ltt/.libs $LTTV_EXEC $ARGS $TRACEFILE + LD_LIBRARY_PATH=ltt/.libs $LTTV_EXEC $ARGS $TRACEFILE $@ fi