summaryrefslogtreecommitdiffstats
path: root/tests/dbg-support.right
blob: 6e2194aae9cb162642751d9f2a558d464851c798 (plain)
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
debug lineno: 74 main
debug lineno: 77 main
FUNCNAME main
debug lineno: 81 main
debug lineno: 30 fn1
debug lineno: 31 fn1
LINENO 31
debug lineno: 32 fn1
LINENO 32
debug lineno: 33 fn1
BASH_SOURCE[0] ./dbg-support.tests
debug lineno: 34 fn1
FUNCNAME[0] fn1
debug lineno: 35 fn1
debug lineno: 35 fn1 81 ./dbg-support.tests
debug lineno: 36 fn1
debug lineno: 36 fn1 81 main ./dbg-support.tests
debug lineno: 37 fn1
debug lineno: 37 fn1
debug lineno: 38 fn1
./dbg-support.tests: line 38: caller: foo: invalid number
caller: usage: caller [expr]
debug lineno: 38 fn1
debug lineno: 30 fn1
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 30 fn1
debug lineno: 27 print_return_trap
debug lineno: 82 main
debug lineno: 41 fn2
debug lineno: 42 fn2
fn2 here. Calling fn1...
debug lineno: 43 fn2
debug lineno: 30 fn1
debug lineno: 31 fn1
LINENO 31
debug lineno: 32 fn1
LINENO 32
debug lineno: 33 fn1
BASH_SOURCE[0] ./dbg-support.tests
debug lineno: 34 fn1
FUNCNAME[0] fn1
debug lineno: 35 fn1
debug lineno: 35 fn1 43 ./dbg-support.tests
debug lineno: 36 fn1
debug lineno: 36 fn1 43 fn2 ./dbg-support.tests
debug lineno: 37 fn1
debug lineno: 37 fn1 82 main ./dbg-support.tests
debug lineno: 38 fn1
./dbg-support.tests: line 38: caller: foo: invalid number
caller: usage: caller [expr]
debug lineno: 38 fn1
debug lineno: 30 fn1
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 30 fn1
debug lineno: 27 print_return_trap
debug lineno: 41 fn2
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 41 fn2
debug lineno: 27 print_return_trap
debug lineno: 83 main
debug lineno: 46 fn3
debug lineno: 47 fn3
LINENO 47
debug lineno: 48 fn3
BASH_SOURCE[0] ./dbg-support.tests
debug lineno: 51 fn3
debug lineno: 52 fn3
debug lineno: 53 fn3
debug lineno: 53 fn3
debug lineno: 54 fn3
debug lineno: 55 fn3
debug lineno: 56 fn3
fn3 called from file  `./dbg-support.tests' at line 0
debug lineno: 53 fn3
debug lineno: 53 fn3
debug lineno: 54 fn3
debug lineno: 55 fn3
debug lineno: 55 fn3
debug lineno: 56 fn3
main called from file  `./dbg-support.tests' at line 0
debug lineno: 53 fn3
debug lineno: 53 fn3
debug lineno: 59 fn3
debug lineno: 31 source
SOURCED LINENO 31
debug lineno: 32 source
SOURCED BASH_SOURCE[0] ./dbg-support.sub
debug lineno: 33 source
debug lineno: 16 sourced_fn
debug lineno: 17 sourced_fn
debug lineno: 18 sourced_fn
SOURCED FN LINENO 18
debug lineno: 21 sourced_fn
debug lineno: 22 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 33
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[1]: source called from ./dbg-support.tests at line 59
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[2]: fn3 called from ./dbg-support.tests at line 83
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[3]: main called from ./dbg-support.tests at line 0
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 16 sourced_fn
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 16 sourced_fn
debug lineno: 27 print_return_trap
debug lineno: 59 fn3
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 59 fn3
debug lineno: 27 print_return_trap
debug lineno: 46 fn3
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 46 fn3
debug lineno: 27 print_return_trap
debug lineno: 84 main
debug lineno: 31 source
SOURCED LINENO 31
debug lineno: 32 source
SOURCED BASH_SOURCE[0] ./dbg-support.sub
debug lineno: 33 source
debug lineno: 16 sourced_fn
debug lineno: 17 sourced_fn
debug lineno: 18 sourced_fn
SOURCED FN LINENO 18
debug lineno: 21 sourced_fn
debug lineno: 22 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 33
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[1]: source called from ./dbg-support.tests at line 84
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[2]: main called from ./dbg-support.tests at line 0
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 16 sourced_fn
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 16 sourced_fn
debug lineno: 27 print_return_trap
debug lineno: 84 main
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 84 main
debug lineno: 27 print_return_trap
debug lineno: 87 main
debug lineno: 90 main
LINENO 31
LINENO 32
BASH_SOURCE[0] ./dbg-support.tests
FUNCNAME[0] fn1
90 ./dbg-support.tests
90 main ./dbg-support.tests

./dbg-support.tests: line 38: caller: foo: invalid number
caller: usage: caller [expr]

debug lineno: 91 main
fn2 here. Calling fn1...
LINENO 31
LINENO 32
BASH_SOURCE[0] ./dbg-support.tests
FUNCNAME[0] fn1
43 ./dbg-support.tests
43 fn2 ./dbg-support.tests
91 main ./dbg-support.tests
./dbg-support.tests: line 38: caller: foo: invalid number
caller: usage: caller [expr]

debug lineno: 92 main
LINENO 47
BASH_SOURCE[0] ./dbg-support.tests
fn3 called from file  `./dbg-support.tests' at line 0
main called from file  `./dbg-support.tests' at line 0
SOURCED LINENO 31
SOURCED BASH_SOURCE[0] ./dbg-support.sub
SOURCED FN LINENO 18
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 33
FUNCNAME[1]: source called from ./dbg-support.tests at line 59
FUNCNAME[2]: fn3 called from ./dbg-support.tests at line 92
FUNCNAME[3]: main called from ./dbg-support.tests at line 0
debug lineno: 93 main
fn4 here. Calling fn3...
LINENO 47
BASH_SOURCE[0] ./dbg-support.tests
fn3 called from file  `./dbg-support.tests' at line 93
fn4 called from file  `./dbg-support.tests' at line 0
main called from file  `./dbg-support.tests' at line 0
SOURCED LINENO 31
SOURCED BASH_SOURCE[0] ./dbg-support.sub
SOURCED FN LINENO 18
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 33
FUNCNAME[1]: source called from ./dbg-support.tests at line 59
FUNCNAME[2]: fn3 called from ./dbg-support.tests at line 64
FUNCNAME[3]: fn4 called from ./dbg-support.tests at line 93
FUNCNAME[4]: main called from ./dbg-support.tests at line 0
debug lineno: 94 main
SOURCED LINENO 31
SOURCED BASH_SOURCE[0] ./dbg-support.sub
SOURCED FN LINENO 18
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 33
FUNCNAME[1]: source called from ./dbg-support.tests at line 94
FUNCNAME[2]: main called from ./dbg-support.tests at line 0
return lineno: 94 main
debug lineno: 97 main
debug lineno: 100 main
debug lineno: 31 source
SOURCED LINENO 31
debug lineno: 32 source
SOURCED BASH_SOURCE[0] ./dbg-support.sub
debug lineno: 33 source
debug lineno: 16 sourced_fn
debug lineno: 17 sourced_fn
debug lineno: 18 sourced_fn
SOURCED FN LINENO 18
debug lineno: 21 sourced_fn
debug lineno: 22 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 33
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[1]: source called from ./dbg-support.tests at line 100
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[2]: main called from ./dbg-support.tests at line 0
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 16 sourced_fn
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 16 sourced_fn
debug lineno: 27 print_return_trap
debug lineno: 100 main
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 100 main
debug lineno: 27 print_return_trap
debug lineno: 101 main
debug lineno: 104 main
debug lineno: 104 main
debug lineno: 105 main
debug lineno: 108 main
debug lineno: 104 main
debug lineno: 104 main
debug lineno: 105 main
debug lineno: 108 main
debug lineno: 104 main
debug lineno: 104 main
debug lineno: 105 main
debug lineno: 106 main
Hit 2
debug lineno: 108 main
debug lineno: 104 main
debug lineno: 104 main
debug lineno: 114 main
SOURCED FN LINENO 18 FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 114 FUNCNAME[1]: main called from ./dbg-support.tests at line 0
debug lineno: 115 main
SOURCED FN LINENO 18 FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 115 FUNCNAME[1]: main called from ./dbg-support.tests at line 0
debug lineno: 116 main
debug lineno: 117 main
SOURCED FN LINENO 18
FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 117
FUNCNAME[1]: main called from ./dbg-support.tests at line 0
debug lineno: 121 main
debug lineno: 122 main
debug lineno: 16 sourced_fn
debug lineno: 17 sourced_fn
debug lineno: 18 sourced_fn
SOURCED FN LINENO 18
debug lineno: 21 sourced_fn
debug lineno: 22 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 122
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[1]: main called from ./dbg-support.tests at line 0
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 16 sourced_fn
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 16 sourced_fn
debug lineno: 27 print_return_trap
debug lineno: 125 main
debug lineno: 130 main
debug lineno: 134 main
got it
debug lineno: 142 main
debug lineno: 143 main
debug lineno: 144 main
debug lineno: 143 main
debug lineno: 144 main
debug lineno: 142 main
debug lineno: 143 main
debug lineno: 144 main
debug lineno: 143 main
debug lineno: 144 main
debug lineno: 148 main
main: calling f1
f1: calling f2
f2: calling f3
f3: calling callstack
deep 6
0 z
1 3
2 y
3 2
4 x
5 1
FUNCNAME stack: f3 f2 f1 main
39 f2 ./dbg-support3.sub
f3: returning
f2: return from f3
f1: return from f2
main: f1 returns