3 ms·
In other compiled languages, stack traces can be supported by looking up code references on the stack in a map of executable addresses to source code locations.
by barrkel 6y ago
In other compiled languages, stack traces can be supported by looking up code references on the stack in a map of executable addresses to source code locations.
Even in the absence of stack frames, the mere contents of the stack with lookups where possible is really useful, and usually more than enough.
The cost is a little code to do lookups at runtime, and making the mapping data available (typically compressed and embedded in the executable).
(Note that this isn't stack unwinding or exceptions. This is backtraces. Rust, like most languages which embed errors in return values, makes the developer do the stack unwinding manually.)
- _ek94 6y agoThat’s exactly how rust generates backtraces though. They just are not typically attached to errors.