internal errors during VM now produce a user code stacktrace #11642
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
before PR
internal errors don't give much context, eg this code from nitely/nim-regex#4
gives (before my fix in nitely/nim-unicodedb#7) this:
which gives very little hint for how to debug
after PR
we get VM stacktrace pointing to user code (ie, not compiler code); this actually helped me for fixing nitely/nim-regex#4:
after PR with nim compiled with
--stacktrace:on
we get both user code VM stacktrace followed by compiler code RT stacktrace:
note
generating this user code VM stacktrace doesn't incur additional cost (unlike
--stacktrace:on
which creates runtime frames) so IMO there's no need to hide it under a flag, it's always useful to show and gives more context pointing to user codethis shouldn't give rise to duplicate stacktraces, eg a
doAssert false
occurring somewhere inside VM would just give the same error msg with user code stacktrace as before this PR