Open mbeckem opened 3 years ago
If panic stack traces are enabled (a flag during vm construction, off by default), a very simple stack trace is attached to every exception.
The stack trace reflects function names only at the moment.
Example:
import std;
export func test() {
nested(2);
}
func nested(n) {
if n == 0 {
std.panic("help!");
}
nested(n - 1);
}
Calling test produces the following trace (most nested function on top):
Coroutine-1:
- nested
- nested
- nested
- test
Note: module names etc. are currently not part of the function name. Modules are not fleshed out well, yet.
The exception type needs support for stack traces. When an exception is thrown, the N topmost tiro function names should be represented in the trace.
Exact positions within those functions (e.g. line numbers) are currently out of scope because the compiler does not yet emit those information.