Backtrace

Keeping state

The first thing we are going to need is somewhere to store the stack backtrace. We could take the easier route and simply store it into an allocated block and keep the pointer as a custom payload in a result<T, std::pair<error_code, std::unique_ptr<stack_backtrace>>> (see previous section on Custom payloads). But let us assume that we care so deeply about bounded execution times that ever calling malloc is unacceptable. We therefore are going to need some completely static and trivially typed storage perhaps kept per-thread to avoid the need to keep mutexes. »