The Lambda Lab
/
projects
/
scheme.forth.jl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Replaced full library.
[scheme.forth.jl.git]
/
src
/
debugging.4th
1
\ Words useful for debugging
2
3
: return-depth
4
RSP@ RSP0 - 1- ;
5
6
: stack-trace
7
RSP@ RSP0 1+ do
8
i 0> if
9
i @ 1- dup 0> if
10
@ dup 0> if
11
>name dup 0> if
12
cr .name
13
else
14
cr ." ***"
15
drop
16
then
17
else
18
cr ." ***"
19
drop
20
then
21
else
22
cr ." ***"
23
drop
24
then
25
else
26
cr ." ***"
27
drop
28
then
29
30
loop ;
31
32
: trace
33
cr ." ---" cr
34
." Return stack depth:" return-depth . cr
35
." Stack trace:"
36
stack-trace
37
cr ." ---" cr
38
39
trace
40
;
41
42
: abort-with-trace
43
stack-trace abort ;