Scroom 0.14-49-gb7ae7a6d
Loading...
Searching...
No Matches
Scroom::Utils::Detail Namespace Reference

Classes

class  ErrorSignalHandler
 
class  ProgressStore
 
class  Registration
 

Functions

void assertionFailed (std::string_view type, std::string_view expr, std::string_view function, std::string_view filename, unsigned int line) __attribute__((noreturn))
 
std::string stackTrace (size_t cutoff)
 
void abort () __attribute__((noreturn))
 

Variables

Scroom::Logger logger
 
static ErrorSignalHandler errorSignalHandler
 

Function Documentation

◆ abort()

void Scroom::Utils::Detail::abort ( )
130 {
131 signal(SIGABRT, SIG_DFL);
132 ::abort();
134 }
Semaphore signal
Definition async-deleter-tests.cc:64
static void handler(int)
Definition assertions.cc:78
static ErrorSignalHandler errorSignalHandler
Definition assertions.cc:127

Referenced by assertionFailed().

Here is the caller graph for this function:

◆ assertionFailed()

void Scroom::Utils::Detail::assertionFailed ( std::string_view  type,
std::string_view  expr,
std::string_view  function,
std::string_view  filename,
unsigned int  line 
)

Gets called when an assertion failed

58 {
59 logger->critical("PROGRAM DEFECTIVE: {}:{}: {} {} violated in {}", filename, line, type, expr, function);
60 logger->critical("Stack trace: {}", stackTrace(1));
61
62 abort();
63 }
std::string stackTrace(size_t cutoff)
Definition assertions.cc:26
void abort() __attribute__((noreturn))
Definition assertions.cc:129
Here is the call graph for this function:

◆ stackTrace()

std::string Scroom::Utils::Detail::stackTrace ( size_t  cutoff)
27 {
28 std::stringstream os;
29
30#ifdef _WIN32
31 // Stack traces generated by this are not very informative, they just show the DLLs.
32 // Showing more than then DDLs would probably require an additional dependency
33 os << boost::stacktrace::stacktrace();
34#else
35 os << "stack trace (innermost first):" << std::endl;
36 static const size_t maxTraces = 100;
37 void* array[maxTraces];
38 const size_t nTraces = backtrace(array, maxTraces);
39 char** strings = backtrace_symbols(array, static_cast<int>(nTraces));
40 for(size_t i = cutoff + 1; i < nTraces; i++)
41 {
42 os << '#' << i << " " << strings[i] << std::endl;
43 }
44 free(strings);
45#endif
46 return os.str();
47 }

Referenced by assertionFailed(), and Scroom::Utils::Detail::ErrorSignalHandler::handler().

Here is the caller graph for this function:

Variable Documentation

◆ errorSignalHandler

ErrorSignalHandler Scroom::Utils::Detail::errorSignalHandler
static

◆ logger

Scroom::Logger Scroom::Utils::Detail::logger

Referenced by assertionFailed().