Loading…
CppCon 2018 has ended
View analytic
Monday, September 24 • 16:45 - 17:45
Unwinding the Stack: Exploring How C++ Exceptions Work on Windows

Sign up or log in to save this to your schedule and see who's attending!

If you’re writing modern C++ code, then it’s likely that you are using exceptions—whether you’re throwing them yourself or just using library code that might throw (e.g., std::vector). Have you ever stopped to think about how exceptions work under the hood? What actually happens at runtime when you throw an exception? How is the right catch statement found?

In this session, we’ll explore how C++ exceptions actually work in the Visual C++ implementation on Windows. This session will discuss:

* A very, very brief overview of how exceptions work in the C++ language
* The code and data structures the Visual C++ compiler generates to facilitate proper stack unwinding
* Exactly what happens when an exception is thrown, how the right catch statement is found, and how the stack is unwound
* Structured Exception Handling (SEH), the Windows OS feature atop which C++ exceptions are built
* How the Visual C++ runtime library interacts with the OS during stack unwinding
* Interoperation with non-C++ exceptions, like hardware exceptions
* How termination handling works when no matching catch statement is found or when a noexcept boundary is reached
* How things differ on different architectures (x86 is very different from x64 and ARM!)

This information can be very useful when debugging tricky problems—especially during postmortem debugging when you’re trying to figure out what went wrong before a program crashed—and we’ll highlight particular pieces of information that are most useful.

Speakers
avatar for James McNellis

James McNellis

Principal Software Engineer, Microsoft Corporation
James McNellis is a Principal Software Engineer at Microsoft where he works on the Time Travel Debugging (TTD) reverse debugging toolkit. Prior to joining the Windows Debuggers team in 2016, he worked on the Visual C++ team and was responsible for the Microsoft C Runtime (CRT) and... Read More →


Monday September 24, 2018 16:45 - 17:45
Copper Mountain Theater (2nd Floor)

Attendees (198)