Stack traces: Difference between revisions

Added Elixir
(Added Elixir)
Line 6:
The task should allow the program to continue after generating the stack trace. The task report here must include the trace from a sample program.
<br clear=all>
 
=={{header|Ada}}==
{{works with|GNAT}}
Line 490 ⟶ 491:
at Program.Outer()
at Program.Main()</lang>
 
=={{header|Clojure}}==
{{works with|Java|1.6+}}
Line 512 ⟶ 514:
...
</pre>
 
=={{header|Common Lisp}}==
 
Line 608 ⟶ 611:
Outer [line: 18, column: 4]
[line: 21, column: 1]</pre>
 
=={{header|Elixir}}==
{{trans|Erlang}}
<lang elixir>defmodule Stack_traces do
def main do
{:ok, a} = outer
IO.inspect a
end
defp outer do
{:ok, a} = middle
{:ok, a}
end
defp middle do
{:ok, a} = inner
{:ok, a}
end
defp inner do
try do
throw(42)
catch 42 -> {:ok, :erlang.get_stacktrace}
end
end
end
 
Stack_traces.main</lang>
 
{{out}}
<pre>
[{Stack_traces, :inner, 0, [file: 'stack_trace.exs', line: 19]},
{Stack_traces, :middle, 0, [file: 'stack_trace.exs', line: 13]},
{Stack_traces, :outer, 0, [file: 'stack_trace.exs', line: 8]},
{Stack_traces, :main, 0, [file: 'stack_trace.exs', line: 3]},
{:elixir_compiler, :dispatch_loaded, 6,
[file: 'src/elixir_compiler.erl', line: 125]},
{:elixir_lexical, :run, 3, [file: 'src/elixir_lexical.erl', line: 16]},
{:elixir_compiler, :quoted, 3, [file: 'src/elixir_compiler.erl', line: 30]},
{Code, :require_file, 2, [file: 'lib/code.ex', line: 363]}]
</pre>
 
=={{header|Erlang}}==
Line 630 ⟶ 674:
inner() ->
try throw(42) catch 42 -> {ok,erlang:get_stacktrace()} end.</lang>
{{out}}
Output:<pre>[{stack_traces,inner,0,[{file,"stack_traces.erl"},{line,18}]},
{stack_traces,middle,0,[{file,"stack_traces.erl"},{line,14}]},
{stack_traces,outer,0,[{file,"stack_traces.erl"},{line,10}]},
Line 934 ⟶ 979:
}
foo();</lang>
 
=={{header|Lasso}}==
By default Lasso tracks the file path, line and column numbers. You can create a trace method to track type and method names illustrated below or use one of the public libraries like L-Debug [https://github.com/zeroloop/l-debug].
Line 1,266 ⟶ 1,312:
main::g() called at Print a Stack Trace line 4
main::f() called at Print a Stack Trace line 6</pre>
=={{header|Perl 6}}==
{{works with|Rakudo|2013-03-03}}
Anonymous user