Пример #1
0
void NORETURN sm_crash( std::string const &reason )
{
#if ( defined(_WINDOWS) && defined(CRASH_HANDLER) ) || defined(MACOSX) || defined(_XDBG)
	/* If we're being debugged, throw a debug break so it'll suspend the process. */
	if( IsDebuggerPresent() )
	{
		DebugBreak();
		for(;;); /* don't return */
	}
#endif

#if defined(CRASH_HANDLER)
	CrashHandler::ForceCrash( reason );
#else
	*(char*)0=0;

	/* This isn't actually reached.  We just do this to convince the compiler that the
	 * function really doesn't return. */
	for(;;);
#endif

#if defined(_WINDOWS)
	/* Do something after the above, so the call/return isn't optimized to a jmp; that
	 * way, this function will appear in backtrace stack traces. */
#if defined(_MSC_VER)
	_asm nop;
#elif defined(__GNUC__) // MinGW or similar
	asm("nop");
#endif
#else
	_exit( 1 );
#endif
}
Пример #2
0
int main(int argc, char **argv)
{
	try
	{
		QApplication app(argc,argv);
		QTranslator translator;
		QPrintDialog print_dlg;

		//Loads the ui translation for crashhandler
		translator.load(QLocale::system().name(), GlobalAttributes::LANGUAGES_DIR);
		app.installTranslator(&translator);

		CrashHandler crashhandler;

		if(argc > 1)
			crashhandler.loadReport(argv[1]);

		crashhandler.show();
		app.exec();

		return(0);
	}
	catch(Exception &e)
	{
		return(e.getErrorType());
	}
}
Пример #3
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

#if defined (USE_BREAKPAD)
    CrashHandler crashhandler;

    // Are we invoked through crash handler?
    if ( crashhandler.isHandlingCrash() )
        return 0;

    // Register it
    crashhandler.registerHandler();
#endif

    // Set data for QSettings
    QCoreApplication::setOrganizationName("ulduzsoft");
    QCoreApplication::setOrganizationDomain("ulduzsoft.com");
    QCoreApplication::setApplicationName("spivak");

    // Init logger after crash settings
    Logger::init();

    QScopedPointer<MainWindow> p (new MainWindow());
    p.data()->show();

    a.exec();
    return 0;
}
Пример #4
0
void CrashHandler::crashBySIGSERV(int /*signalid*/)
{
    QString crashMsg = QApplication::tr("We're sorry, but PGE Editor has crashed. \nReason: Signal Segmentation Violation [SIGSERV]\n\n");

    if(DevConsole::isConsoleShown())
        DevConsole::closeIfPossible();

    crashMsg += QString("\n\n") + getStacktrace();

    CrashHandler* crsh = new CrashHandler(crashMsg);
    crsh->exec();

    exit(EXIT_FAILURE);
}
Пример #5
0
void CrashHandler::crashByFlood()
{
    QString crashMsg = QApplication::tr("We're sorry, but PGE Editor has crashed. \nReason: Out of memory!\n\n"
                                        "To prevent this, try closing other uneccessary programs to free up more memory.");

    if(DevConsole::isConsoleShown())
        DevConsole::closeIfPossible();

    crashMsg += QString("\n\n") + getStacktrace();

    CrashHandler* crsh = new CrashHandler(crashMsg);
    crsh->exec();

    exit(EXIT_FAILURE);
}
Пример #6
0
void
signalHandler( int sig )
{
    signal( sig, SIG_DFL );

    #ifdef WITH_GUI
        GUIProjectManager::getInstance()->emergencyBackup();
    #else
        ProjectManager::getInstance()->emergencyBackup();
    #endif

    #ifdef WITH_CRASHHANDLER_GUI
        CrashHandler* ch = new CrashHandler( sig );
        ::exit( ch->exec() );
    #else
        ::exit( 1 );
    #endif
}
Пример #7
0
int main(int argc, char **argv)
{
 try
 {
  QApplication app(argc,argv);
  QTranslator tradutor;
  QString ling_fallback="pgmodeler.en_US";

  /** issue#23 **/
  /* Caso o pgModeler não encontre um arquivo de tradução da lingua nativa do sistema o qual está
     sendo executado será carregado o arquivo pgmodeler.en_US (lingua fallback) */
  if(!tradutor.load(QString("pgmodeler.") + QLocale::system().name(), AtributosGlobais::DIR_LINGUAS))
   //Carrega a lingua fallback
   tradutor.load(ling_fallback, AtributosGlobais::DIR_LINGUAS);

  //Instala o tradutor na aplicação
  app.installTranslator(&tradutor);

  CrashHandler crashhandler;

  //Atribui o formulário alocado à aplicação
  app.setMainWidget(&crashhandler);

  if(argc > 1)
   crashhandler.carregarRelatorio(argv[1]);

  //Exibe o formulário principal e prossegue com a execução da aplicação
  crashhandler.show();

  //Executa a aplicação
  app.exec();

  return(0);
 }
 //Caso um erro seja capturado durante a inicialização da aplicação
 catch(Excecao &e)
 {
  //Retorna o código de erro da última exceção e aborta a aplicação
  return(e.obterTipoErro());
 }
}
Пример #8
0
void CrashHandler::crashByUnhandledException()
{
    std::exception_ptr unhandledException = std::current_exception();
    try{
        std::rethrow_exception(unhandledException);
    }
    catch(const std::exception& e)
    {
        QString crashMsg = QApplication::tr("We're sorry, but PGE Editor has crashed. \nReason: %1\n\nPlease inform our forum staff so we can try to fix this problem, Thank you\n\nForum link: engine.wohlnet.ru/forum").arg(e.what());

        if(DevConsole::isConsoleShown())
            DevConsole::closeIfPossible();

        crashMsg += QString("\n\n") + getStacktrace();

        CrashHandler* crsh = new CrashHandler(crashMsg);
        crsh->exec();
    }

    exit(EXIT_FAILURE);
}
Пример #9
0
// Called by signal handler of qtcreator.
// Usage: $0 <name of signal causing the crash>
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    app.setApplicationName(QLatin1String(APPLICATION_NAME));
    app.setWindowIcon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical));

    // Check usage.
    Q_PID parentPid = getppid();
    QString parentExecutable = QFile::symLinkTarget(QString::fromLatin1("/proc/%1/exe")
        .arg(QString::number(parentPid)));
    if (argc > 2 || !parentExecutable.contains(QLatin1String("qtcreator"))) {
        QTextStream err(stderr);
        err << QString::fromLatin1("This crash handler will be called by Qt Creator itself. "
                                   "Do not call this manually.\n");
        return EXIT_FAILURE;
    }

    // Run.
    CrashHandler *crashHandler = new CrashHandler(parentPid, app.arguments().at(1));
    crashHandler->run();

    return app.exec();
}
void CrashHandler::doCrashScreenAndCleanup(QString crashMsg)
{
    //Force debug log enabling
    LogWriter::logLevel = PGE_LogLevel::Debug;
    //Append extra explanation to user how to report the crash
    crashMsg += g_messageToUser;
    //Write crash message into the log file first
    crashMsg += QString("\n\n") + getStacktrace();
    //Also save crash report into log file
    LogFatalNC(crashMsg);
    //Then, emergency save all opened files into reserve folder
    attemptCrashsave();

    //Close console box if possible
    if(DevConsole::isConsoleShown())
        DevConsole::closeIfPossible();

    MainWinConnect::pMainWin->hide();
    //And now, spawn dialog box with stack trance
    CrashHandler *crsh = new CrashHandler(crashMsg);
    crsh->exec();
    delete crsh;
}
Пример #11
0
/* This is no longer actually implemented by throwing an exception, but it acts
 * the same way to code in practice. */
void RageException::Throw( const char *sFmt, ... )
{
	va_list	va;
	va_start( va, sFmt );
	RString error = vssprintf( sFmt, va );
	va_end( va );

	RString msg = ssprintf(
		"\n"
		"//////////////////////////////////////////////////////\n"
		"Exception: %s\n"
		"//////////////////////////////////////////////////////\n",
		error.c_str() );
	if( LOG )
	{
		LOG->Trace( "%s", msg.c_str() );
		LOG->Flush();
	}
	else
	{
		puts( msg );
		fflush( stdout );
	}

#if (defined(WINDOWS) && defined(DEBUG)) || defined(_XDBG) || defined(MACOSX)
	if( IsDebuggerPresent() )
		DebugBreak();
#endif

	ASSERT_M( g_HandlerThreadID == RageThread::GetInvalidThreadID() || g_HandlerThreadID == RageThread::GetCurrentThreadID(),
		  ssprintf("RageException::Throw() on another thread: %s", error.c_str()) );
	if( g_CleanupHandler != NULL )
		g_CleanupHandler( error );

	exit(1);
}
Пример #12
0
int main(int argc, char **argv)
{
	try
	{
		QApplication app(argc,argv);
		QTranslator translator;

		//Loads the ui translation for crashhandler
		translator.load(QLocale::system().name(), GlobalAttributes::LANGUAGES_DIR);
		app.installTranslator(&translator);

		CrashHandler crashhandler;

		crashhandler.setAnalysisMode(argc > 1 && argv[1]==CrashHandler::ANALYSIS_MODE);
		crashhandler.show();
		app.exec();

		return(0);
	}
	catch(Exception &e)
	{
		return(e.getErrorType());
	}
}