12 #include <format/format.h> 48 EXCEPTION_EXECUTE_HANDLER )
57 tmp <<
"=== Stack Backtrace ===\n" << stack_trace;
70 void passert_failed(
const char* expr,
const std::string& reason,
const char* file,
unsigned line )
73 POLLOG_ERROR <<
"Assertion Failed: " << expr <<
" (" << reason <<
"), " << file <<
", line " 76 POLLOG_ERROR <<
"Assertion Failed: " << expr <<
", " << file <<
", line " << line <<
"\n";
78 if ( passert_dump_stack )
95 char reportedReason[512];
96 if ( sprintf( reportedReason,
"ASSERT(%s, reason: \"%s\") failed in %s:%d", expr,
97 reason.c_str(), file, line ) > 0 )
99 std::string( reportedReason ) );
105 if ( passert_shutdown )
107 POLLOG_ERROR <<
"Shutting down due to assertion failure.\n";
109 passert_shutdown_due_to_assertion =
true;
119 throw std::runtime_error(
"Assertion Failed: " + std::string( expr ) +
" (" +
120 std::string( reason ) +
"), " + std::string( file ) +
", line " +
125 throw std::runtime_error(
"Assertion Failed: " + std::string( expr ) +
", " +
126 std::string( file ) +
", line " +
tostring( line ) );
std::string scripts_thread_script
static LONG WINAPI TopLevelFilter(struct _EXCEPTION_POINTERS *pExceptionInfo)
void force_backtrace(bool complete)
static std::string getTrace()
Returns a string containing the current stack trace.
std::string tostring(const Bscript::BTokenType &v)
static bool programAbortReporting()
Returns true if the bug reporting is active.
static void reportProgramAbort(const std::string &stackTrace, const std::string &reason)
Reports a program abort to the program devs.
static void logAllStackTraces()
Logs stack traces of all threads to stdout and error output.
bool passert_shutdown_due_to_assertion
void passert_failed(const char *expr, const char *file, unsigned line)
std::atomic< bool > exit_signalled
unsigned scripts_thread_scriptPC
static void print_backtrace()