RosettaCodeData/Task/Stack-traces/Nim/stack-traces.nim

13 lines
268 B
Nim
Raw Permalink Normal View History

2016-12-05 23:44:36 +01:00
proc g() =
2020-02-17 23:21:07 -08:00
# Writes the current stack trace to stderr.
2016-12-05 23:44:36 +01:00
writeStackTrace()
2020-02-17 23:21:07 -08:00
# Or fetch the stack trace entries for the current stack trace:
echo "----"
for e in getStackTraceEntries():
echo e.filename, "@", e.line, " in ", e.procname
2016-12-05 23:44:36 +01:00
proc f() =
g()
f()