4 ms·
But an issue is still that in the handler (catch clause), the stack has unwound, so if you want to access the stack trace "after the fact", you will have to do
by amelius 11y ago
But an issue is still that in the handler (catch clause), the stack has unwound, so if you want to access the stack trace "after the fact", you will have to do some work when throwing the exception.
- barrkel 11y agoYou'd normally use a library that hooks the exception throwing mechanism in the runtime library in a toolset-specific way.
- amelius 11y agoYes, but I mean that every exception will have an additional cost then, because you will have to copy the stack trace (implicitly or explicitly).
- ori_b 11y agoFor many common ABIs, unwinding the stack is relatively cheap compared to decoding the debug info to figure out how to unwind the stack. If you have frame pointers, it's especially cheap -- you're walking a 20 element linked list.