tstrace.nim 780 B

12345678910111213141516171819202122232425262728293031323334353637
  1. discard """
  2. exitcode: 1
  3. output: '''
  4. Traceback (most recent call last)
  5. tstrace.nim(36) tstrace
  6. tstrace.nim(28) recTest
  7. tstrace.nim(28) recTest
  8. tstrace.nim(28) recTest
  9. tstrace.nim(28) recTest
  10. tstrace.nim(28) recTest
  11. tstrace.nim(28) recTest
  12. tstrace.nim(28) recTest
  13. tstrace.nim(28) recTest
  14. tstrace.nim(28) recTest
  15. tstrace.nim(28) recTest
  16. tstrace.nim(31) recTest
  17. SIGSEGV: Illegal storage access. (Attempt to read from nil?)
  18. '''
  19. """
  20. # Test the new stacktraces (great for debugging!)
  21. {.push stack_trace: on.}
  22. proc recTest(i: int) =
  23. # enter
  24. if i < 10:
  25. recTest(i+1)
  26. else: # should printStackTrace()
  27. var p: ptr int = nil
  28. p[] = 12
  29. # leave
  30. {.pop.}
  31. recTest(0)