diff options
Diffstat (limited to 'tests/misc/tstrace.nim')
-rw-r--r-- | tests/misc/tstrace.nim | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/misc/tstrace.nim b/tests/misc/tstrace.nim new file mode 100644 index 000000000..00af0af69 --- /dev/null +++ b/tests/misc/tstrace.nim @@ -0,0 +1,36 @@ +discard """ +exitcode: 1 +output: ''' +Traceback (most recent call last) +tstrace.nim(36) tstrace +tstrace.nim(28) recTest +tstrace.nim(28) recTest +tstrace.nim(28) recTest +tstrace.nim(28) recTest +tstrace.nim(28) recTest +tstrace.nim(28) recTest +tstrace.nim(28) recTest +tstrace.nim(28) recTest +tstrace.nim(28) recTest +tstrace.nim(28) recTest +tstrace.nim(31) recTest +SIGSEGV: Illegal storage access. (Attempt to read from nil?) +''' +""" + +# Test the new stacktraces (great for debugging!) + +{.push stack_trace: on.} + +proc recTest(i: int) = + # enter + if i < 10: + recTest(i+1) + else: # should printStackTrace() + var p: ptr int = nil + p[] = 12 + # leave + +{.pop.} + +recTest(0) |