summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiculcy Brian <morlenxus@gmx.net>2009-12-29 16:23:34 +0000
committerMiculcy Brian <morlenxus@gmx.net>2009-12-29 16:23:34 +0000
commit95e44807d3f855b0f63733da8a83338459204ae3 (patch)
treee635a6056756ed3ad4cdb50a8aa25e60b85ddc05
parent5e5c3108ccbcf17f73eb206e93957279b7d75895 (diff)
rewrite of xnest.sh script, fixed bugs and added options, should be way more useable now...
SVN revision: 44758
-rwxr-xr-xxnest.sh181
1 files changed, 135 insertions, 46 deletions
diff --git a/xnest.sh b/xnest.sh
index 8a28e5d..a49aa34 100755
--- a/xnest.sh
+++ b/xnest.sh
@@ -1,54 +1,143 @@
1#!/usr/bin/env bash 1#!/usr/bin/env bash
2 2
3#export REDRAW_DEBUG=1 # To cause redraw- to happen slovly and obviously. 3
4#export ECORE_ERROR_ABORT=1 # To cause ecore to abort on errors. 4debugger_default="b"
5#export EVAS_NOCLEAN=1 # To cause evas to not unload modules. 5xnest_geo_default="800x600+0+0"
6 6
7disp_num=":1" # Which display do you want the xnest to be on? 7
8 8echo
9main=$DISPLAY 9for arg in $@; do
10tmp=`mktemp` || exit 1 10 option=`echo "'$arg'" | cut -d'=' -f1 | tr -d "'"`
11echo -e "run\nbt\nq\ny" > $tmp 11 value=`echo "'$arg'" | cut -d'=' -f2- | tr -d "'"`
12 12 if [ "$value" == "$option" ]; then
13case "$1" in 13 value=""
14 "") action="gdb -x $tmp --args" ; main=$disp_num ;; 14 fi
15 "-b") action="gdb -x $tmp --args" ; main=$disp_num ;; 15
16 "-c") action="cgdb" ; main=$disp_num ;; 16 case $option in
17 "-d") action="ddd -display $main --args" ;; 17 "--dbg-display")
18 "-e") action="" ; e_args="-display $disp_num" ;; 18 if [ -z "$value" ]; then
19 "-g") action="gdb --args" ; main=$disp_num ;; 19 echo "Missing value for $option= !"
20 "-l") action="valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --log-file=valgrind_log" ; main=$disp_num ;; 20 exit 1
21 "-m") action="valgrind --tool=memcheck --log-file=valgrind_log" ; main=$disp_num ;; 21 fi
22 "-p") action="memprof --display=$main" ; main=$disp_num ;; 22 xnest_display=$value
23 "-r") action="memprof_raster --display=$main" ; main=$disp_num ;; 23 ;;
24 "-s") action="strace -F -o strace_log" ;; 24 "--dbg-xnest-geo")
25 "-v") action="valkyrie -display $main" ; main=$disp_num ;; 25 if [ -z "$value" ]; then
26 *) echo -e "Usage : xnest.sh [debugger] ([enlightenment options])" 26 echo "Missing value for $option= !"
27 echo -e "\tdefault option is -b" 27 exit 1
28 echo -e "\t-b use text debugger with auto backtrace\tgdb" 28 fi
29 echo -e "\t-c use curses debugger\t\t\t\tcgdb" 29 xnest_geo=$value
30 echo -e "\t-d use the GUI debugger\t\t\t\tddd" 30 ;;
31 echo -e "\t-e enlightenment with no debugging" 31 "--dbg-mode")
32 echo -e "\t-g use text debugger\t\t\t\tgdb" 32 if [ -z "$value" ]; then
33 echo -e "\t-l leak check\t\t\t\t\tvalgrind" 33 echo "Missing value for $option= !"
34 echo -e "\t-m memory check\t\t\t\t\tvalgrind" 34 exit 1
35 echo -e "\t-p memory profiling\t\t\t\tmemprof" 35 fi
36 echo -e "\t-r raster's memory profiling\t\t\tmemprof_raster" 36 debugger=$value
37 echo -e "\t-s show syscalls\t\t\t\tstrace" 37 ;;
38 echo -e "\t-v GUI memory check\t\t\t\tvalkyrie" 38 "--dbg-ecore-errors") export ECORE_ERROR_ABORT=1 ;;
39 echo -e "" 39 "--dbg-ecore-noclean") export ECORE_NOCLEAN=1 ;;
40 echo -e "When you have finished with the text debugger, use the q command to quit." 40 "--dbg-redraw") export REDRAW_DEBUG=1 ;;
41 echo -e "The valgrind options will leave a log file with a name beginning with valgrind_log" 41 "--help")
42 exit 42 echo "Usage: $0 [DEBUG-OPTION] ..."
43 ;; 43 echo " --dbg-display=<NUMBER> = set the used display number"
44 echo " --dpg-xnest-geo=<WxH+X+Y> = set xnest geometry"
45 echo " --dbg-mode=<CHAR> = b: text debugger with auto backtrace (gdb)"
46 echo " c: curses debugger (cgdb)"
47 echo " d: GUI debugger (ddd)"
48 echo " e: no debugging"
49 echo " g: text debugger (gdb)"
50 echo " l: leak check (valgrind)"
51 echo " m: memory check (valgrind)"
52 echo " p: memory profiling (memprof)"
53 echo " r: raster's memory profiling (memprof_raster)"
54 echo " s: show syscalls (strace)"
55 echo " v: GUI memory check (valkyrie)"
56 echo " --dbg-ecore-errors = to cause ecore to abort on errors"
57 echo " --dbg-ecore-noclean = to cause ecore to not unload modules"
58 echo " --dbg-redraw = to cause redraw to happen slovly and obviously"
59 echo " --help = wysiwyg"
60 echo
61 echo "Usage: $0 [ENLIGHTENMENT-OPTION] ..."
62 enlightenment --help
63 exit 0
64 ;;
65 *) enlightenment_args="$enlightenment_args $arg" ;;
66 esac
67done
68
69
70if [ -z "$xnest_display" ]; then
71 if [ -z "$DISPLAY" ]; then
72 echo "Couldn't read your \$DISPLAY env variable, are you running X?"
73 exit 1
74 fi
75
76 dcnt=`echo "$DISPLAY" | tr -d ':' | cut -d '.' -f1`
77 xnest_display=$(($dcnt+1))
78fi
79if [ -z "$xnest_geo" ]; then
80 xnest_geo=$xnest_geo_default
81fi
82if [ -z "$debugger" ]; then
83 debugger=$debugger_default
84fi
85case $debugger in
86 "b")
87 tmpfile=`mktemp`
88 if [ -z "$tmpfile" ]; then
89 echo "Can't create tmp file!"
90 exit 1
91 fi
92 echo -e "run\nbt\nq\ny" > $tmpfile
93 debugcmd="gdb -x $tmpfile --args"
94 ;;
95 "c") debugcmd="cgdb" ;;
96 "d") debugcmd="ddd -display $DISPLAY --args" ;;
97 "e") debugcmd="" ;;
98 "g") debugcmd="gdb --args" ;;
99 "l") debugcmd="valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --log-file=valgrind_log" ;;
100 "m") debugcmd="valgrind --tool=memcheck --log-file=valgrind_log" ;;
101 "p") debugcmd="memprof --display=$DISPLAY" ;;
102 "r") debugcmd="memprof_raster --display=$DISPLAY" ;;
103 "s") debugcmd="strace -F -o strace_log" ;;
104 "v") debugcmd="valkyrie -display $DISPLAY" ;;
44esac 105esac
45e_args="`echo -- $@ | cut -d' ' -f2-` $e_args"
46 106
47Xnest $disp_num -ac &
48 107
49sleep 2 # Someone reported that it starts E before X has started properly. 108echo "- DISPLAY: $xnest_display"
109echo "- XNEST GEOMETRY: $xnest_geo"
110echo -n "- DEBUGMODE: "
111if [ "$debugcmd" ]; then
112 echo "$debugcmd"
113else
114 echo "NONE"
115fi
116if [ "$enlightenment_args" ]; then
117 echo "- ENLIGHTENMENT ARGUMENTS: $enlightenment_args"
118fi
119if [ "$ECORE_ERROR_ABORT" ]; then
120 echo "- ECORE ERROR ABORT"
121fi
122if [ "$ECORE_NOCLEAN" ]; then
123 echo "- ECORE NOCLEAN"
124fi
125if [ "$REDRAW_DEBUG" ]; then
126 echo "- REDRAW DEBUG"
127fi
128echo "======================================================"
129echo
130sleep 1
131
132
133Xnest :$xnest_display -ac -geometry $xnest_geo &
134sleep 2 # Someone reported that it starts E before X has started properly.
50 135
51export DISPLAY=$main; export E_START="enlightenment_start"; $action enlightenment $e_args 136export DISPLAY=":$xnest_display"
137export E_START="enlightenment_start"
138$debugcmd enlightenment $enlightenment_args
52 139
53rm -f $tmp 140if [ "$tmpfile" ]; then
141 rm "$tmpfile"
142fi
54killall -TERM Xnest 143killall -TERM Xnest