Пример #1
0
bool ErrorReport::GenerateReport(ErrorReport::IProgressNotifier* pProgressNotifier)
{
	ErrorReport* report = this;
	BOOST_SCOPE_EXIT((report))
	{
		// Allow the crashed process to exit
		report->ReleaseApplicationLock();
	} BOOST_SCOPE_EXIT_END

	pProgressNotifier->taskStarted("Generating crash report", 3);
	
	// Initialize shared memory
	pProgressNotifier->taskStepStarted("Connecting to crashed application");
	bool bInit = Initialize();
	pProgressNotifier->taskStepEnded();
	if(!bInit)
	{
		pProgressNotifier->setError("Could not generate the crash dump.");
		pProgressNotifier->setDetailedError(m_DetailedError);
		return false;
	}
	
	if(m_pCrashInfo->architecture != ARX_ARCH) {
		pProgressNotifier->setError("Architecture mismatch between the crashed process and the crash reporter.");
		pProgressNotifier->setDetailedError(m_DetailedError);
		return false;
	}
	
	// Generate minidump
	pProgressNotifier->taskStepStarted("Generating crash dump");
	bool bCrashDump = GetCrashDump("crash.dmp");
	pProgressNotifier->taskStepEnded();
	if(!bCrashDump)
	{
		pProgressNotifier->setError("Could not generate the crash dump.");
		pProgressNotifier->setDetailedError(m_DetailedError);
		return false;
	}

	// Generate manifest
	pProgressNotifier->taskStepStarted("Generating report manifest");
	bool bCrashXml = WriteReport("crash.xml");
	pProgressNotifier->taskStepEnded();
	if(!bCrashXml)
	{
		pProgressNotifier->setError("Could not generate the manifest.");
		pProgressNotifier->setDetailedError(m_DetailedError);
		return false;
	}

	return true;
}
Пример #2
0
bool ErrorReport::GenerateReport(ErrorReport::IProgressNotifier* pProgressNotifier)
{
	ErrorReport* report = this;
	BOOST_SCOPE_EXIT((report))
	{
		// Allow the crashed process to exit
		report->ReleaseApplicationLock();
	} BOOST_SCOPE_EXIT_END

	pProgressNotifier->taskStarted("Generating crash report", 3);
	
	// Initialize shared memory
	pProgressNotifier->taskStepStarted("Connecting to crashed application");
	bool bInit = Initialize();
	pProgressNotifier->taskStepEnded();
	if(!bInit)
	{
		pProgressNotifier->setError("Could not generate the crash dump.");
		pProgressNotifier->setDetailedError(m_DetailedError);
		return false;
	}
	
	// Wait for crash to be processed
	pProgressNotifier->taskStepStarted("Processing crash information");
	while(platform::isProcessRunning(m_pCrashInfo->processorProcessId)) {
		boost::posix_time::ptime timeout
		 = boost::posix_time::microsec_clock::universal_time()
		 + boost::posix_time::milliseconds(100);
		if(m_pCrashInfo->processorDone.timed_wait(timeout)) {
			break;
		}
	}
	pProgressNotifier->taskStepEnded();
	
	// Generate minidump
	pProgressNotifier->taskStepStarted("Retrieving crash information");
	bool bCrashInfo = getCrashInfo();
	pProgressNotifier->taskStepEnded();
	if(!bCrashInfo)
	{
		pProgressNotifier->setError("Could not retrieve crash information.");
		pProgressNotifier->setDetailedError(m_DetailedError);
		return false;
	}

	return true;
}