Donner SVG main
0.8.0 ยท 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
FatalAbort.h File Reference

Names an abort site before terminating, so a release build without a stack still reports which invariant failed and on which thread. More...

#include <cstddef>
#include <cstdint>
#include <initializer_list>
#include <span>
Include dependency graph for FatalAbort.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::FatalAbortValue
 One named integer that explains why a fatal site was reached. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Functions

void donner::SetFatalAbortThreadRole (const char *role)
 Names the calling thread in later fatal messages, and in a WebAssembly build also in the JavaScript abort hook of the thread's worker until the thread exits.
void donner::SetFatalAbortRolePublisherForTesting (void(*publisher)(const char *role))
 Replaces how roles reach the JavaScript abort hook, for tests.
const char * donner::FatalAbortThreadRole ()
 The calling thread's role: the last SetFatalAbortThreadRole value, otherwise a role derived from the runtime (browser-main, runtime-main, pthread or native-thread).
std::size_t donner::FormatFatalAbortMessage (std::span< char > buffer, const char *site, const char *role, std::span< const FatalAbortValue > values)
 Formats a fatal message without allocating.
void donner::FatalAbort (const char *site, std::initializer_list< FatalAbortValue > values={})
 Emits one line naming site, the calling thread's role and values, then calls std::abort().

Variables

constexpr const char * donner::kFatalAbortPrefix = "[donner-fatal] Aborted at site="
 Prefix of every message FatalAbort emits; browser tests match the Aborted in it.

Detailed Description

Names an abort site before terminating, so a release build without a stack still reports which invariant failed and on which thread.


Class Documentation

◆ donner::FatalAbortValue

struct donner::FatalAbortValue

One named integer that explains why a fatal site was reached.

Class Members
const char * name Static identifier, printed as name=value.
int64_t value The value that explains the condition.