Unwinding the Stack: Exploring How C++ Exceptions Work on Windows
summary
Shows exactly how Visual C++ turns throw into a structured exception: the runtime calls CxxThrowException with throw info and an exception object, the common handler (CxxFrameHandler/except_handler3) uses function metadata to pick a catch, calls RtlUnwind for global unwind and then local cleanup, and on x64 the OS looks up per-function records in .pdata so zero-cost unwinding is possible and noexcept triggers immediate terminate.
AI-written summary · about
chapters (12)
- 0:00Introduction to exceptions
- 1:29Structured exceptions
- 6:37The SEH mechanism
- 9:00Implementing manual handlers
- 12:41Compiler extensions
- 20:05SEH under the hood
- 26:21Exception handler mechanics
- 28:28Unwinding the stack
- 37:59Custom exceptions and C++
- 39:56C++ exception architecture
- 45:56Catching and cleanup
- 51:58Architecture and history
related talks
01h 02mExceptional C++
51mC++ Exceptions and Stack Unwinding
01h 01mInternals of Exceptions
01h 33mDe-fragmenting C++: Making Exceptions and RTTI More Affordable and Usable
01h 02mBack to Basics: Exception Handling and Exception Safety
44mError handling in C++: as easy as "use exceptions"?
01h 23mC++ Exceptions
01h 04mKEYNOTE: De-fragmenting C++: Making exceptions more affordable and usable
