1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
|
(dbg-test1.sh:22):
22: x=22
+# Test break, watch, watche, step, next, continue and stack handling
+#
+### Try a simple line number breakpoint...
+break 23
Breakpoint 1 set in file dbg-test1.sh, line 23.
+info break
Num Type Disp Enb What
1 breakpoint keep y dbg-test1.sh:23
No watch expressions have been set.
+continue
Breakpoint 1 hit (1 times).
(dbg-test1.sh:23):
23: y=23
+info program
Program stopped.
It stopped at breakpoint 1.
+#
+### Try watch...
+watch x
0: ($x)==22 arith: 0
+info watchpoints
Num Type Disp Enb What
1 breakpoint keep y dbg-test1.sh:23
breakpoint already hit 1 time
Num Type Enb Expression
0 watchpoint y $x
+c
Watchpoint 1: $x changed:
old value: '22'
new value: '23'
(dbg-test1.sh:24):
24: for i in 0 1 3 ; do
+info program
Program stopped.
+### Try disable expression...
+disable 1w
Watchpoint entry 0 disabled.
+watche x > 26
1: (x > 26)==0 arith: 1
+info break
Num Type Disp Enb What
1 breakpoint keep y dbg-test1.sh:23
breakpoint already hit 1 time
Num Type Enb Expression
0 watchpoint n $x
breakpoint already hit 1 time
1 watchpoint y x > 26
+### Continuing with a one-time line break (but will watch expression)...
+cont 30
One-time breakpoint 2 set in file dbg-test1.sh, line 30.
Watchpoint 3: x > 26 changed:
old value: '0'
new value: '1'
(dbg-test1.sh:28):
28: y=b
+L
Num Type Disp Enb What
1 breakpoint keep y dbg-test1.sh:23
breakpoint already hit 1 time
2 breakpoint del y dbg-test1.sh:30
Num Type Enb Expression
0 watchpoint n $x
breakpoint already hit 1 time
1 watchpoint y x > 26
breakpoint already hit 1 time
No actions have been set.
+### Try deleting a watchpoint...
+delete 1W
+L
Num Type Disp Enb What
1 breakpoint keep y dbg-test1.sh:23
breakpoint already hit 1 time
2 breakpoint del y dbg-test1.sh:30
Num Type Enb Expression
0 watchpoint n $x
breakpoint already hit 1 time
No actions have been set.
+### Try break with a function...
+break fn1
Breakpoint 3 set in file dbg-test1.sh, line 5.
+### Stepping 2...
+step 2
(dbg-test1.sh:30):
30: echo $(fn3 30)
+### Try continue with a line number...
+cont 34
One-time breakpoint 4 set in file dbg-test1.sh, line 34.
Breakpoint 3 hit (1 times).
(dbg-test1.sh:5):
5: fn1() {
+info program
Program stopped.
It stopped at breakpoint 3.
+L
Num Type Disp Enb What
1 breakpoint keep y dbg-test1.sh:23
breakpoint already hit 1 time
3 breakpoint keep y dbg-test1.sh:5
breakpoint already hit 1 time
4 breakpoint del y dbg-test1.sh:34
Num Type Enb Expression
0 watchpoint n $x
breakpoint already hit 1 time
No actions have been set.
+### List stack frame...
+where
->0 in file `dbg-test1.sh' at line 5
##1 fn1() called from file `dbg-test1.sh' at line 32
##2 source("dbg-test1.sh") called from file `bashdb' at line 277
##3 main() called from file `bashdb' at line 0
+### Try up...
+up
(dbg-test1.sh:32):
32: fn1;
+list
32: fn1;
33: fn3 33
34: source dbg-test1.sub
35: exit 0;
36: #;;; Local Variables: ***
37: #;;; mode:shell-script ***
38: #;;; End: ***
+### Try down 1...
+down 1
(dbg-test1.sh:5):
5: fn1() {
+list
5:==>fn1() {
6: echo "fn1 here"
7: x=5
8: fn3
9: }
10:
11: fn2() {
12: name="fn2"
13: echo "$name here"
14: x=6
+### frame 0...
+frame 0
(dbg-test1.sh:5):
5: fn1() {
+### Try step (twice)...
+step
(dbg-test1.sh:6):
6: echo "fn1 here"
+info program
Program stopped.
It stopped after being stepped.
+step
fn1 here
(dbg-test1.sh:7):
7: x=5
+### Try next and check that it jumps over fn3
+next
(dbg-test1.sh:8):
8: fn3
+### Try continue file:line (but will hit another breakpoint)...
+cont ./dbg-test1.sh:35
One-time breakpoint 5 set in file dbg-test1.sh, line 35.
(dbg-test1.sh:34):
34: source dbg-test1.sub
+step 2
SOURCED LINENO 19
(dbg-test1.sub:20):
20: filename=${BASH_SOURCE[0]##*/}
+T
->0 in file `dbg-test1.sub' at line 20
##1 source("dbg-test1.sub") called from file `dbg-test1.sh' at line 34
##2 source("dbg-test1.sh") called from file `bashdb' at line 277
##3 main() called from file `bashdb' at line 0
+step 10
SOURCED BASH_SOURCE[0] dbg-test1.sub
SOURCED FN LINENO 5
(dbg-test1.sub:11):
11: local -i j=i+1
+T
->0 in file `dbg-test1.sub' at line 11
##1 sourced_fn() called from file `dbg-test1.sub' at line 22
##2 source("dbg-test1.sub") called from file `dbg-test1.sh' at line 34
##3 source("dbg-test1.sh") called from file `bashdb' at line 277
##4 main() called from file `bashdb' at line 0
+### Try x command...
+x j
j
+### Try continue break no args (here)...
+break
Breakpoint 6 set in file dbg-test1.sub, line 11.
+cont
FUNCNAME[0]: sourced_fn called from dbg-test1.sub at line 22
Breakpoint 6 hit (1 times).
(dbg-test1.sub:11):
11: local -i j=i+1
+### another x command...
+x j
declare -i j="1"
+### another x command (+5 than value above) ...
+x j+5
6
+### x command of string y
+x y
declare -- y="b"
+### x of a function ...
+x fn2
fn2 ()
{
name="fn2";
echo "$name here";
x=6
}
+### Bad x expressions ...
+x bogus
bogus
+x bogus+
bogus+
+x fn2+fn3
fn2+fn3
+x fn2+3
3
+### another continue. Count on breakpoint should go up.
+cont
FUNCNAME[1]: source called from dbg-test1.sh at line 34
Breakpoint 6 hit (2 times).
(dbg-test1.sub:11):
11: local -i j=i+1
+print "j: $j, name: $name"
j: 2, name: fn2
+### Try disable of break
+disable 5
Breakpoint entry 5 disabled.
+L
Num Type Disp Enb What
1 breakpoint keep y dbg-test1.sh:23
breakpoint already hit 1 time
3 breakpoint keep y dbg-test1.sh:5
breakpoint already hit 1 time
5 breakpoint del n dbg-test1.sh:35
6 breakpoint keep y dbg-test1.sub:11
Num Type Enb Expression
0 watchpoint n $x
breakpoint already hit 1 time
No actions have been set.
+cont
FUNCNAME[2]: source called from bashdb at line 277
Breakpoint 6 hit (3 times).
(dbg-test1.sub:11):
11: local -i j=i+1
+### Test temporary break and its reporting
+cont 13
One-time breakpoint 7 set in file dbg-test1.sub, line 13.
(dbg-test1.sub:13):
13: local filename=${BASH_SOURCE[$j]##*/}
+info program
Program stopped.
It stopped at a breakpoint that has since been deleted.
+### Should hit end of script but stay in debugger...
+cont
FUNCNAME[3]: main called from bashdb at line 0
Debugged program terminated normally. Use q to quit or R to restart.
+info files
Source files for which have been read in:
dbg-test1.sh (39 lines)
dbg-test1.sub (29 lines)
+### quitting...
+quit
|