void passert_failed( const char *expr, const char *file, unsigned line ) { POLLOG_ERROR << "Assertion Failed: " << expr << ", " << file << ", line " << line << "\n"; if( passert_dump_stack ) { POLLOG_ERROR << "Forcing stack backtrace.\n"; force_backtrace(); } else { #ifdef _WIN32 HiddenMiniDumper::print_backtrace(); #endif } if( passert_shutdown ) { POLLOG_ERROR << "Shutting down due to assertion failure.\n"; exit_signalled = true; passert_shutdown_due_to_assertion = true; } if( passert_abort ) { POLLOG_ERROR << "Aborting due to assertion failure.\n"; abort(); } throw std::runtime_error( "Assertion Failed: " + std::string( expr ) + ", " + std::string(file) + ", line " + tostring( line ) ); }
void passert_failed(const char *expr, const std::string& reason, const char *file, unsigned line) { if(reason != "") POLLOG_ERROR << "Assertion Failed: " << expr << " (" << reason << "), " << file << ", line " << line << "\n"; else POLLOG_ERROR << "Assertion Failed: " << expr << ", " << file << ", line " << line << "\n"; if( passert_dump_stack ) { POLLOG_ERROR << "Forcing stack backtrace.\n"; force_backtrace(); } else { #ifdef _WIN32 HiddenMiniDumper::print_backtrace(); #endif } /** * use the program abort reporting system */ if(Plib::systemstate.config.report_program_aborts) { char reportedReason[512]; if(sprintf(reportedReason, "ASSERT(%s, reason: \"%s\") failed in %s:%d", expr, reason.c_str(),file, line) > 0) ExceptionParser::reportProgramAbort(ExceptionParser::getTrace(), std::string(reportedReason)); else ExceptionParser::reportProgramAbort(ExceptionParser::getTrace(), "ASSERT failed"); } if( passert_shutdown ) { POLLOG_ERROR << "Shutting down due to assertion failure.\n"; exit_signalled = true; passert_shutdown_due_to_assertion = true; } if( passert_abort ) { POLLOG_ERROR << "Aborting due to assertion failure.\n"; abort(); } if(reason != "") { throw std::runtime_error("Assertion Failed: " + std::string(expr) + " (" + std::string(reason) + "), " + std::string(file) + ", line " + tostring(line)); }else{ throw std::runtime_error("Assertion Failed: " + std::string(expr) + ", " + std::string(file) + ", line " + tostring(line)); } }