summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiculcy Brian <morlenxus@gmx.net>2010-04-15 19:35:33 +0000
committerMiculcy Brian <morlenxus@gmx.net>2010-04-15 19:35:33 +0000
commit8093b22d11a40710ed907c1cb36be27010ed8433 (patch)
tree2fa7adccc6f1d68fac771b388d1844bed6f430b8
parentfadcb01bcb4c307d996e5013de7f1bda7ea979f1 (diff)
added Xephyr as default xserver (allows to debug composite module)
SVN revision: 48037
-rwxr-xr-xxdebug.sh157
1 files changed, 157 insertions, 0 deletions
diff --git a/xdebug.sh b/xdebug.sh
new file mode 100755
index 0000000..404fbb5
--- /dev/null
+++ b/xdebug.sh
@@ -0,0 +1,157 @@
1#!/usr/bin/env bash
2
3
4debugger_default="b"
5geo_default="800x600+0+0"
6
7
8echo
9xserver="Xephyr"
10if [ `type $xserver &>/dev/null; echo $?` -ne 0 ]; then
11 xserver="Xnest"
12 if [ `type $xserver &>/dev/null; echo $?` -ne 0 ]; then
13 echo "Please install either Xephyr (recommended) or Xnest!"
14 exit 1
15 fi
16fi
17
18
19for arg in $@; do
20 option=`echo "'$arg'" | cut -d'=' -f1 | tr -d "'"`
21 value=`echo "'$arg'" | cut -d'=' -f2- | tr -d "'"`
22 if [ "$value" == "$option" ]; then
23 value=""
24 fi
25
26 case $option in
27 "--dbg-display")
28 if [ -z "$value" ]; then
29 echo "Missing value for $option= !"
30 exit 1
31 fi
32 dbg_display=$value
33 ;;
34 "--dbg-geo")
35 if [ -z "$value" ]; then
36 echo "Missing value for $option= !"
37 exit 1
38 fi
39 dbg_geo=$value
40 ;;
41 "--dbg-mode")
42 if [ -z "$value" ]; then
43 echo "Missing value for $option= !"
44 exit 1
45 fi
46 debugger=$value
47 ;;
48 "--dbg-ecore-errors") export ECORE_ERROR_ABORT=1 ;;
49 "--dbg-ecore-noclean") export ECORE_NOCLEAN=1 ;;
50 "--dbg-redraw") export REDRAW_DEBUG=1 ;;
51 "--help")
52 echo "Usage: $0 [DEBUG-OPTION] ..."
53 echo " --dbg-display=<NUMBER> = set the used display number"
54 echo " --dpg-geo=<WxH+X+Y> = set xserver geometry"
55 echo " --dbg-mode=<CHAR> = b: text debugger with auto backtrace (gdb)"
56 echo " c: curses debugger (cgdb)"
57 echo " d: GUI debugger (ddd)"
58 echo " e: no debugging"
59 echo " g: text debugger (gdb)"
60 echo " l: leak check (valgrind)"
61 echo " m: memory check (valgrind)"
62 echo " p: memory profiling (memprof)"
63 echo " r: raster's memory profiling (memprof_raster)"
64 echo " s: show syscalls (strace)"
65 echo " v: GUI memory check (valkyrie)"
66 echo " --dbg-ecore-errors = to cause ecore to abort on errors"
67 echo " --dbg-ecore-noclean = to cause ecore to not unload modules"
68 echo " --dbg-redraw = to cause redraw to happen slovly and obviously"
69 echo " --help = wysiwyg"
70 echo
71 echo "Usage: $0 [ENLIGHTENMENT-OPTION] ..."
72 enlightenment --help
73 exit 0
74 ;;
75 *) enlightenment_args="$enlightenment_args $arg" ;;
76 esac
77done
78
79
80if [ -z "$dbg_display" ]; then
81 if [ -z "$DISPLAY" ]; then
82 echo "Couldn't read your \$DISPLAY env variable, are you running X?"
83 exit 1
84 fi
85
86 dcnt=`echo "$DISPLAY" | tr -d ':' | cut -d '.' -f1`
87 dbg_display=$(($dcnt+1))
88fi
89if [ -z "$dbg_geo" ]; then
90 dbg_geo=$geo_default
91fi
92if [ -z "$debugger" ]; then
93 debugger=$debugger_default
94fi
95case $debugger in
96 "b")
97 tmpfile=`mktemp`
98 if [ -z "$tmpfile" ]; then
99 echo "Can't create tmp file!"
100 exit 1
101 fi
102 echo -e "run\nbt\nq\ny" > $tmpfile
103 debugcmd="gdb -x $tmpfile --args"
104 ;;
105 "c") debugcmd="cgdb" ;;
106 "d") debugcmd="ddd -display $DISPLAY --args" ;;
107 "e") debugcmd="" ;;
108 "g") debugcmd="gdb --args" ;;
109 "l") debugcmd="valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --log-file=valgrind_log" ;;
110 "m") debugcmd="valgrind --tool=memcheck --log-file=valgrind_log" ;;
111 "p") debugcmd="memprof --display=$DISPLAY" ;;
112 "r") debugcmd="memprof_raster --display=$DISPLAY" ;;
113 "s") debugcmd="strace -F -o strace_log" ;;
114 "v") debugcmd="valkyrie -display $DISPLAY" ;;
115esac
116
117
118echo "- DISPLAY: $dbg_display"
119echo "- XSERVER GEOMETRY: $dbg_geo"
120echo -n "- DEBUGMODE: "
121if [ "$debugcmd" ]; then
122 echo "$debugcmd"
123else
124 echo "NONE"
125fi
126if [ "$enlightenment_args" ]; then
127 echo "- ENLIGHTENMENT ARGUMENTS: $enlightenment_args"
128fi
129if [ "$ECORE_ERROR_ABORT" ]; then
130 echo "- ECORE ERROR ABORT"
131fi
132if [ "$ECORE_NOCLEAN" ]; then
133 echo "- ECORE NOCLEAN"
134fi
135if [ "$REDRAW_DEBUG" ]; then
136 echo "- REDRAW DEBUG"
137fi
138echo "======================================================"
139echo
140sleep 1
141
142
143case $xserver in
144 "Xephyr") $xserver :$dbg_display -ac -screen $dbg_geo & ;;
145 "Xnest") $xserver :$dbg_display -ac -geometry $dbg_geo & ;;
146esac
147sleep 2 # Someone reported that it starts E before X has started properly.
148
149export DISPLAY=":$dbg_display"
150export E_START="enlightenment_start"
151$debugcmd enlightenment $enlightenment_args
152
153if [ "$tmpfile" ]; then
154 rm "$tmpfile"
155fi
156killall -TERM $xserver
157echo