Stack traces: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
|||
Line 619: | Line 619: | ||
Outer [line: 18, column: 4] |
Outer [line: 18, column: 4] |
||
[line: 21, column: 1]</pre> |
[line: 21, column: 1]</pre> |
||
=={{header|Elena}}== |
=={{header|Elena}}== |
||
{{trans|C#}} |
{{trans|C#}} |
||
Line 1,487: | Line 1,488: | ||
main::g() called at Print a Stack Trace line 4 |
main::g() called at Print a Stack Trace line 4 |
||
main::f() called at Print a Stack Trace line 6</pre> |
main::f() called at Print a Stack Trace line 6</pre> |
||
=={{header|Perl 6}}== |
|||
{{works with|Rakudo|2013-03-03}} |
|||
<lang perl6>sub g { say Backtrace.new.concise } |
|||
sub f { g } |
|||
sub MAIN { f }</lang> |
|||
{{out}} |
|||
<pre> in sub g at bt:1 |
|||
in sub f at bt:2 |
|||
in sub MAIN at bt:3</pre> |
|||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
Line 1,611: | Line 1,602: | ||
#1 StackTraceDemo::middle() called at [/home/cweiske/Dev/cvs/test/php-stacktrace.php:10] |
#1 StackTraceDemo::middle() called at [/home/cweiske/Dev/cvs/test/php-stacktrace.php:10] |
||
#2 StackTraceDemo::outer() called at [/home/cweiske/Dev/cvs/test/php-stacktrace.php:14]</pre> |
#2 StackTraceDemo::outer() called at [/home/cweiske/Dev/cvs/test/php-stacktrace.php:14]</pre> |
||
=={{header|PL/I}}== |
|||
<lang PL/I> |
|||
/* The SNAP option in the ON statement is sufficient to obtain */ |
|||
/* a traceback. The SYSTEM option specifies that standard */ |
|||
/* system action is to occur, which resume execution after the */ |
|||
/* SIGNAL statement. */ |
|||
on condition(traceback) snap system; |
|||
... |
|||
signal condition(traceback); |
|||
</lang> |
|||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |
||
Line 1,685: | Line 1,665: | ||
-> 9 |
-> 9 |
||
:</pre> |
:</pre> |
||
=={{header|PL/I}}== |
|||
<lang PL/I> |
|||
/* The SNAP option in the ON statement is sufficient to obtain */ |
|||
/* a traceback. The SYSTEM option specifies that standard */ |
|||
/* system action is to occur, which resume execution after the */ |
|||
/* SIGNAL statement. */ |
|||
on condition(traceback) snap system; |
|||
... |
|||
signal condition(traceback); |
|||
</lang> |
|||
=={{header|PureBasic}}== |
=={{header|PureBasic}}== |
||
Line 1,759: | Line 1,750: | ||
Selection: |
Selection: |
||
</pre> |
</pre> |
||
=={{header|Racket}}== |
|||
<lang Racket> |
|||
#lang racket |
|||
;; To see these calls we do two things: mutate the binding to prevent |
|||
;; Racket from inlining the value; use a (void) call at the end so the |
|||
;; calls are not tail calls (which will otherwise not show on the |
|||
;; stack). |
|||
(define foo #f) |
|||
(set! foo (λ() (bar) (void))) |
|||
(define bar #f) |
|||
(set! bar (λ() (show-stacktrace) (void))) |
|||
(define (show-stacktrace) |
|||
(for ([s (continuation-mark-set->context (current-continuation-marks))] |
|||
[i (in-naturals)]) |
|||
;; show just the names, not the full source information |
|||
(when (car s) (printf "~s: ~s\n" i (car s))))) |
|||
(foo) |
|||
</lang> |
|||
Output: |
|||
<pre> |
|||
0: show-stacktrace |
|||
1: bar |
|||
2: foo |
|||
3: |[running body]| |
|||
</pre> |
|||
=={{header|Raku}}== |
|||
(formerly Perl 6) |
|||
{{works with|Rakudo|2013-03-03}} |
|||
<lang perl6>sub g { say Backtrace.new.concise } |
|||
sub f { g } |
|||
sub MAIN { f }</lang> |
|||
{{out}} |
|||
<pre> in sub g at bt:1 |
|||
in sub f at bt:2 |
|||
in sub MAIN at bt:3</pre> |
|||
=={{header|Raven}}== |
|||
<lang Raven> [1 2 3 4] 42 { 'a' 1 'b' 2 'c' 3 } 34.1234 ( -1 -2 -3 ) "The quick brown fox" FILE dump</lang> |
|||
{{out}} |
|||
<pre>hash (4 items) |
|||
usage => 1 |
|||
index => 65836 |
|||
flags => 256 |
|||
buffer => " 98252f8 73 74 64 69 6e 00 stdin." |
|||
The quick brown fox |
|||
28.1234 |
|||
hash (3 items) |
|||
a => 1 |
|||
b => 2 |
|||
c => 3 |
|||
42 |
|||
list (4 items) |
|||
0 => 1 |
|||
1 => 2 |
|||
2 => 3 |
|||
3 => 4</pre> |
|||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
Line 1,825: | Line 1,877: | ||
Error 16 running "/demos/callstack.rexx", line 20: Label not found |
Error 16 running "/demos/callstack.rexx", line 20: Label not found |
||
Error 16.1: Label "NONAME" not found</pre> |
Error 16.1: Label "NONAME" not found</pre> |
||
=={{header|Racket}}== |
|||
<lang Racket> |
|||
#lang racket |
|||
;; To see these calls we do two things: mutate the binding to prevent |
|||
;; Racket from inlining the value; use a (void) call at the end so the |
|||
;; calls are not tail calls (which will otherwise not show on the |
|||
;; stack). |
|||
(define foo #f) |
|||
(set! foo (λ() (bar) (void))) |
|||
(define bar #f) |
|||
(set! bar (λ() (show-stacktrace) (void))) |
|||
(define (show-stacktrace) |
|||
(for ([s (continuation-mark-set->context (current-continuation-marks))] |
|||
[i (in-naturals)]) |
|||
;; show just the names, not the full source information |
|||
(when (car s) (printf "~s: ~s\n" i (car s))))) |
|||
(foo) |
|||
</lang> |
|||
Output: |
|||
<pre> |
|||
0: show-stacktrace |
|||
1: bar |
|||
2: foo |
|||
3: |[running body]| |
|||
</pre> |
|||
=={{header|Raven}}== |
|||
<lang Raven> [1 2 3 4] 42 { 'a' 1 'b' 2 'c' 3 } 34.1234 ( -1 -2 -3 ) "The quick brown fox" FILE dump</lang> |
|||
{{out}} |
|||
<pre>hash (4 items) |
|||
usage => 1 |
|||
index => 65836 |
|||
flags => 256 |
|||
buffer => " 98252f8 73 74 64 69 6e 00 stdin." |
|||
The quick brown fox |
|||
28.1234 |
|||
hash (3 items) |
|||
a => 1 |
|||
b => 2 |
|||
c => 3 |
|||
42 |
|||
list (4 items) |
|||
0 => 1 |
|||
1 => 2 |
|||
2 => 3 |
|||
3 => 4</pre> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||
Line 2,066: | Line 2,068: | ||
=={{header|VBA}}== |
=={{header|VBA}}== |
||
In VBE the VBA Editor hitting Control+L while stepping through your code in debug mode will pop up a window which displays the call stack. |
In VBE the VBA Editor hitting Control+L while stepping through your code in debug mode will pop up a window which displays the call stack. |
||
=={{header|zkl}}== |
=={{header|zkl}}== |
||
<lang zkl>fcn f{println("F");vm.stackTrace().println()} fcn g{println("G")} |
<lang zkl>fcn f{println("F");vm.stackTrace().println()} fcn g{println("G")} |