As the title says, sometimes the user gets an
stack overflow error like the following:
thread 'main' has overflowed its stack fatal runtime error: stack overflow Aborted
And, especially when the call “hierarchy” is deeply nested, he has no clue where the issues is “coming from”.
Therefore my questions are:
(A) Is there a way to get a hint of the last few functions called, so that the user can start a targeted debugging of the problem? (Currently he has no hint of the probable cause…)
(B) Is there a away for the user code to “catch” this kind of error? Similar to how the user can intercept panics?
Hopefully there is an answer for (A), at least in debug mode.
For (B) one could – if it makes sense for the particular use-case – start a separate thread and catch if it aborts from the main thread. (For example my use-case is a Scheme interpreter, thus this technique, although cumbersome, could be used to provide more useful error messages.)
Thanks for the feedback,