Stack traces: Difference between revisions

Added Forth
(Added Oz.)
(Added Forth)
Line 246:
SBCL's backtraces consist entirely of lists of the form <code>(<var>function-name</var> <var>args...</var>)</code>.
 
=={{header|Forth}}==
In Forth, calling sequence information is kept on the Return Stack.Some Forth compilers have the word "R.S" that dumps the contents of the Return Stack - just like ".S:, which dumps the contents of the Data Stack. Note this may also include stack frames, local variables and temporary values. Forth has no way of knowing which is which, because that is usually left to the programmer.
 
{{works with|4tH|3.60.0}}
<lang forth>[UNDEFINED] R.S [IF]
\ Return stack counterpart of DEPTH
\ Note the STACK-CELLS correction is there to hide RDEPTH itself
( -- n)
: RDEPTH STACK-CELLS -2 [+] CELLS RP@ - ;
 
\ Return stack counterpart of .S
\ Note the : R.S R> .. >R ; sequence is there to hide R.S itself
( --)
: R.S R> CR RDEPTH DUP 0> IF DUP
BEGIN DUP WHILE R> -ROT 1- REPEAT DROP DUP
BEGIN DUP WHILE ROT DUP . >R 1- REPEAT DROP
THEN ." (TORS) " DROP >R ;
[THEN]</lang>
=={{header|J}}==
 
374

edits