Beispiel #1
0
    virtual int OnRun()
    {
        // a real program would be presumably be a bit harder to crash than
        // just pressing "yes" in a dialog... but this is just an example
        switch ( wxMessageBox
                 (
                    _T("Generate report for crash (or just current context)?"),
                    _T("wxDebugReport Test"),
                    wxYES_NO | wxCANCEL
                 ) )
        {
            case wxYES:
                // this call is going to crash
                foo(32);
                foo(17);
                break;

            case wxNO:
                // example of manually generated report, this could be also
                // used in wxApp::OnAssert()
                GenerateReport(wxDebugReport::Context_Current);
                break;

            case wxCANCEL:
                break;
        }

        return 0;
    }
Beispiel #2
0
void FAutomatedTestManager::Tick( float DeltaTime )
{
	// Update the automation controller to keep it running
	AutomationController->Tick();

	// Update the automation process
	switch( AutomationTestState )
	{
	case EAutomationTestState::FindWorkers :
		{
			FindWorkers( DeltaTime );
			break;
		}
	case EAutomationTestState::MonitorTests :
		{
			MonitorTests();
			break;
		}
	case EAutomationTestState::GenerateReport :
		{
			GenerateReport();
			break;
		}
	case EAutomationTestState::Complete :
	case EAutomationTestState::Idle:
	default:
		{
			// Do nothing while we are waiting for something
			break;
		}
	}
}
Beispiel #3
0
///////////////////////////////////////////////////////
// Report base
///////////////////////////////////////////////////////
wxWindow *reportBaseFactory::StartDialog(frmMain *form, pgObject *obj)
{
	parent = form;

	wxBeginBusyCursor();
	frmReport *report = new frmReport(GetFrmMain());

	// Generate the report header
	wxDateTime now = wxDateTime::Now();
	report->XmlAddHeaderValue(wxT("generated"), now.Format(wxT("%c")));
	if (obj->GetServer())
		report->XmlAddHeaderValue(wxT("server"), obj->GetServer()->GetFullIdentifier());
	if (obj->GetDatabase())
		report->XmlAddHeaderValue(wxT("database"), obj->GetDatabase()->GetName());
	if (obj->GetSchema())
	{
		if (obj->GetSchema()->GetMetaType() == PGM_CATALOG)
			report->XmlAddHeaderValue(wxT("catalog"), obj->GetSchema()->GetDisplayName());
		else
			report->XmlAddHeaderValue(wxT("schema"), obj->GetSchema()->GetName());
	}
	if (obj->GetJob())
		report->XmlAddHeaderValue(wxT("job"), obj->GetJob()->GetName());
	if (obj->GetTable())
		report->XmlAddHeaderValue(wxT("table"), obj->GetTable()->GetName());

	GenerateReport(report, obj);
	wxEndBusyCursor();

	report->ShowModal();
	return 0;
}
Beispiel #4
0
void VSPTree::LoadVSP(QString fileName)
{
	m_callTreeWidget->clear();
	m_flatCallTreeWidget->clear();
	m_functionSummaryTreeWidget->clear();

	GenerateReport(fileName);
	m_lastVSP = fileName;
}
        //------------------------------------------------------------------------------
        BenchmarkReport Run() noexcept
        {
            auto benchmarks = BenchmarkRegistry::Get().GetBenchmarks();

            std::unordered_map<std::string, std::vector<BenchmarkReport::Benchmark>> benchmarkResults;

            for (const auto& benchmark : benchmarks)
            {
                benchmarkResults[benchmark.GetBenchmarkGroupName()].push_back(RunBenchmark(benchmark));
            }

            return GenerateReport(benchmarkResults);
        }
Beispiel #6
0
void camcal::calibrate()
{
   if( m_image_number == 0 )
      return;

   // Extract World and Image Coordinates
   FindCorners();

   // Find CameraMatrix, Distortion Params, Rotation Matrices, Translation Vectors
   CalibrateCamera();

   // Backproject Points and Calculate Errors on X and Y direction
   CalculateCalibrationErrors( true );

   // Generates Reports concerning Calibration and Error
   GenerateReport();
}
Beispiel #7
0
void ProfileEngine::OnRootConsoleCommand2(const char *cmdname, const ICommandArgs *command)
{
	if (command->ArgC() >= 3)
	{
		if (strcmp(command->Arg(2), "flush") == 0)
		{
			FILE *fp;
			char path[256];

			g_pSM->BuildPath(Path_SM, path, sizeof(path), "logs/profile_%d.xml", (int)time(NULL));

			if ((fp = fopen(path, "wt")) == NULL)
			{
				rootmenu->ConsolePrint("Failed, could not open file for writing: %s", path);
				return;
			}

			GenerateReport(fp);

			fclose(fp);
			
			Clear();

			rootmenu->ConsolePrint("Profiler report generated as: %s\n", path);

			return;
		}
		else if (strcmp(command->Arg(2), "report") == 0)
		{
			FILE *fp;
			char path[256];

			g_pSM->BuildPath(Path_SM, path, sizeof(path), "logs/profile_%d.xml", (int)time(NULL));

			if ((fp = fopen(path, "wt")) == NULL)
			{
				rootmenu->ConsolePrint("Failed, could not open file for writing: %s", path);
				return;
			}

			GenerateReport(fp);

			fclose(fp);
			
			rootmenu->ConsolePrint("Profiler report generated as: %s\n", path);
			return;
		}
		else if (strcmp(command->Arg(2), "clear") == 0)
		{
			Clear();

			rootmenu->ConsolePrint("Profiler statistics cleared.\n");
			return;
		}
	}

	rootmenu->ConsolePrint("Profiler commands:");
	rootmenu->DrawGenericOption("flush", "Flushes statistics to disk and starts over");
	rootmenu->DrawGenericOption("report", "Flushes statistics to disk");
	rootmenu->DrawGenericOption("clear", "Clears statistics");
}
Beispiel #8
0
/**
 * @brief Generate report and save it to file.
 * @param [out] errStr Empty if succeeded, otherwise contains error message.
 * @return TRUE if report was created, FALSE if user canceled report.
 */
BOOL DirCmpReport::GenerateReport(String &errStr)
{
	ASSERT(m_pList != NULL);
	ASSERT(m_pFile == NULL);
	BOOL bRet = FALSE;

	DirCmpReportDlg dlg;
	if (dlg.DoModal() == IDOK) try
	{
		WaitStatusCursor waitstatus(IDS_STATUS_CREATEREPORT);
		if (dlg.m_bCopyToClipboard)
		{
			if (!CWnd::GetSafeOwner()->OpenClipboard())
				return FALSE;
			if (!EmptyClipboard())
				return FALSE;
			CSharedFile file(GMEM_DDESHARE|GMEM_MOVEABLE|GMEM_ZEROINIT);
			m_pFile = &file;
			GenerateReport(dlg.m_nReportType);
			SetClipboardData(CF_TEXT, file.Detach());
			// If report type is HTML, render CF_HTML format as well
			if (dlg.m_nReportType == REPORT_TYPE_SIMPLEHTML)
			{
				// Reconstruct the CSharedFile object
				file.~CSharedFile();
				file.CSharedFile::CSharedFile(GMEM_DDESHARE|GMEM_MOVEABLE|GMEM_ZEROINIT);
				// Write preliminary CF_HTML header with all offsets zero
				static const char header[] =
					"Version:0.9\n"
					"StartHTML:%09d\n"
					"EndHTML:%09d\n"
					"StartFragment:%09d\n"
					"EndFragment:%09d\n";
				static const char start[] = "<html><body>\n<!--StartFragment -->";
				static const char end[] = "\n<!--EndFragment -->\n</body>\n</html>\n";
				char buffer[256];
				int cbHeader = wsprintfA(buffer, header, 0, 0, 0, 0);
				file.Write(buffer, cbHeader);
				file.Write(start, sizeof start - 1);
				GenerateHTMLHeaderBodyPortion();
				GenerateXmlHtmlContent(false);
				file.Write(end, sizeof end); // include terminating zero
				DWORD size = GetLength32(file);
				// Rewrite CF_HTML header with valid offsets
				file.SeekToBegin();
				wsprintfA(buffer, header, cbHeader, size - 1,
					cbHeader + sizeof start - 1, size - sizeof end + 1);
				file.Write(buffer, cbHeader);
				SetClipboardData(CF_HTML, GlobalReAlloc(file.Detach(), size, 0));
			}
			CloseClipboard();
		}
		if (!dlg.m_sReportFile.IsEmpty())
		{
			String path;
			SplitFilename(dlg.m_sReportFile, &path, NULL, NULL);
			if (!paths_CreateIfNeeded(path.c_str()))
			{
				errStr = LoadResString(IDS_FOLDER_NOTEXIST);
				return FALSE;
			}
			CFile file(dlg.m_sReportFile,
				CFile::modeWrite|CFile::modeCreate|CFile::shareDenyWrite);
			m_pFile = &file;
			GenerateReport(dlg.m_nReportType);
		}
		bRet = TRUE;
	}
	catch (CException *e)
	{
		e->ReportError(MB_ICONSTOP);
		e->Delete();
	}
	m_pFile = NULL;
	return bRet;
}
void FLinuxCrashContext::GenerateCrashInfoAndLaunchReporter(bool bReportingNonCrash) const
{
	// do not report crashes for tools (particularly for crash reporter itself)
#if !IS_PROGRAM

	// create a crash-specific directory
	FString CrashGuid;
	if (!FParse::Value(FCommandLine::Get(), TEXT("CrashGUID="), CrashGuid) || CrashGuid.Len() <= 0)
	{
		CrashGuid = FGuid::NewGuid().ToString();
	}

	FString CrashInfoFolder = FString::Printf(TEXT("%sinfo-%s-pid-%d-%s"), bReportingNonCrash ? TEXT("ensure") : TEXT("crash"), FApp::GetGameName(), getpid(), *CrashGuid);
	FString CrashInfoAbsolute = FPaths::ConvertRelativePathToFull(CrashInfoFolder);
	if (IFileManager::Get().MakeDirectory(*CrashInfoFolder))
	{
		// generate "minidump"
		GenerateReport(FPaths::Combine(*CrashInfoFolder, TEXT("Diagnostics.txt")));

		// generate "WER"
		GenerateWindowsErrorReport(FPaths::Combine(*CrashInfoFolder, TEXT("wermeta.xml")), bReportingNonCrash);

		// generate "minidump" (just >1 byte)
		GenerateMinidump(FPaths::Combine(*CrashInfoFolder, TEXT("minidump.dmp")));

		// Introduces a new runtime crash context. Will replace all Windows related crash reporting.
		//FCStringAnsi::Strncpy(FilePath, CrashInfoFolder, PATH_MAX);
		//FCStringAnsi::Strcat(FilePath, PATH_MAX, "/" );
		//FCStringAnsi::Strcat(FilePath, PATH_MAX, FGenericCrashContext::CrashContextRuntimeXMLNameA );
		//SerializeAsXML( FilePath ); @todo uncomment after verification

		// copy log
		FString LogSrcAbsolute = FPlatformOutputDevices::GetAbsoluteLogFilename();
		FString LogDstAbsolute = FPaths::Combine(*CrashInfoAbsolute, *FPaths::GetCleanFilename(LogSrcAbsolute));
		FPaths::NormalizeDirectoryName(LogDstAbsolute);
		static_cast<void>(IFileManager::Get().Copy(*LogDstAbsolute, *LogSrcAbsolute));	// best effort, so don't care about result: couldn't copy -> tough, no log

		// try launching the tool and wait for its exit, if at all
		const TCHAR * RelativePathToCrashReporter = TEXT("../../../Engine/Binaries/Linux/CrashReportClient");	// FIXME: painfully hard-coded
		if (!FPaths::FileExists(RelativePathToCrashReporter))
		{
			RelativePathToCrashReporter = TEXT("../../../engine/binaries/linux/crashreportclient");	// FIXME: even more painfully hard-coded
		}

		FString CrashReportClientArguments;

		// Suppress the user input dialog if we're running in unattended mode
		bool bNoDialog = FApp::IsUnattended() || IsRunningDedicatedServer();
		if (bNoDialog)
		{
			CrashReportClientArguments += TEXT(" -Unattended ");
		}

		CrashReportClientArguments += CrashInfoAbsolute + TEXT("/");

		if (bReportingNonCrash)
		{
			// If we're reporting non-crash, try to avoid spinning here and instead do that in the tick.
			// However, if there was already a crash reporter running (i.e. we hit ensure() too quickly), take a hitch here
			if (FPlatformProcess::IsProcRunning(LinuxCrashReporterTracker::CurrentlyRunningCrashReporter))
			{
				// do not wait indefinitely, allow 45 second hitch (anticipating callstack parsing)
				const double kEnsureTimeOut = 45.0;
				const double kEnsureSleepInterval = 0.1;
				if (!LinuxCrashReporterTracker::WaitForProcWithTimeout(LinuxCrashReporterTracker::CurrentlyRunningCrashReporter, kEnsureTimeOut, kEnsureSleepInterval))
				{
					FPlatformProcess::TerminateProc(LinuxCrashReporterTracker::CurrentlyRunningCrashReporter);
				}

				LinuxCrashReporterTracker::Tick(0.001f);	// tick one more time to make it clean up after itself
			}

			LinuxCrashReporterTracker::CurrentlyRunningCrashReporter = FPlatformProcess::CreateProc(RelativePathToCrashReporter, *CrashReportClientArguments, true, false, false, NULL, 0, NULL, NULL);
			LinuxCrashReporterTracker::CurrentTicker = FTicker::GetCoreTicker().AddTicker(FTickerDelegate::CreateStatic(&LinuxCrashReporterTracker::Tick), 1.f);
		}
		else
		{
			// spin here until CrashReporter exits
			FProcHandle RunningProc = FPlatformProcess::CreateProc(RelativePathToCrashReporter, *CrashReportClientArguments, true, false, false, NULL, 0, NULL, NULL);
			// do not wait indefinitely - can be more generous about the hitch than in ensure() case
			const double kCrashTimeOut = 3 * 60.0;
			const double kCrashSleepInterval = 1.0;
			if (!LinuxCrashReporterTracker::WaitForProcWithTimeout(RunningProc, kCrashTimeOut, kCrashSleepInterval))
			{
				FPlatformProcess::TerminateProc(RunningProc);
			}

			FPlatformProcess::CloseProc(RunningProc);
		}
	}

#endif

	if (!bReportingNonCrash)
	{
		// remove the handler for this signal and re-raise it (which should generate the proper core dump)
		// print message to stdout directly, it may be too late for the log (doesn't seem to be printed during a crash in the thread) 
		printf("Engine crash handling finished; re-raising signal %d for the default handler. Good bye.\n", Signal);
		fflush(stdout);

		struct sigaction ResetToDefaultAction;
		FMemory::Memzero(ResetToDefaultAction);
		ResetToDefaultAction.sa_handler = SIG_DFL;
		sigfillset(&ResetToDefaultAction.sa_mask);
		sigaction(Signal, &ResetToDefaultAction, nullptr);

		raise(Signal);
	}
}
Beispiel #10
0
VOID
DisplayReportGenerator(
  IN EFI_MENU_PAGE                *Page
  )
{

  EFI_STATUS               Status;
  EFI_FILE_DIALOG_CONTEXT *DialogContext;
  CHAR16                  *FileName;
  EFI_DIALOG_CONTEXT       MsgDialogContext;
  CHAR16                  *MsgDialogTitle;
  CHAR16                  *LogFilePath;

  DialogContext = NULL;
  //
  //allocate a new efi file dialog context.
  //
  Status = BS->AllocatePool (
                 EfiBootServicesData,
                 sizeof(EFI_FILE_DIALOG_CONTEXT),
                 (VOID **)&DialogContext
                 );
  if (EFI_ERROR (Status)) {
    return;
  }

  BS->SetMem (DialogContext, sizeof(EFI_FILE_DIALOG_CONTEXT), 0);
  DialogContext->DialogType = EFI_FILE_DIALOG_TYPE_SAVE_FILE;
  DialogContext->FileType = EFI_FILTER_FILE_TYPE_CSV;

  //
  //get filename through FileDialog
  //
  Status = DoFileDialog (DialogContext);

  if (EFI_ERROR (Status)) {
    MsgDialogTitle = StrDuplicate (L"Generate Report Error!");
    MsgDialogContext.Type = EFI_DIALOG_TYPE_MESSAGE;
    MenuPageRefresh (Page);
    DoDialog (MsgDialogTitle, &MsgDialogContext);
  } else if (DialogContext->DevicePath != NULL && DialogContext->FileName != NULL
      && DialogContext->FileName[0] != L'\0') {
    //
    //make up file name
    //
    if (StrLen (DialogContext->FileName) > 4 &&
      StriCmp (DialogContext->FileName + StrLen (DialogContext->FileName) - 4, L".csv") == 0) {
      FileName = StrDuplicate (DialogContext->FileName);
    } else if ( StrLen (DialogContext->FileName) > 1 &&
      StriCmp (DialogContext->FileName + StrLen (DialogContext->FileName) - 1, L".") == 0) {
      FileName = PoolPrint (L"%scsv", DialogContext->FileName);
    } else {
      FileName = PoolPrint (L"%s.csv", DialogContext->FileName);
    }
    if (FileName == NULL) {
      BS->FreePool (DialogContext->DevicePath);
      BS->FreePool (DialogContext->FileName);
      BS->FreePool (DialogContext);
      return;
    }

    MsgDialogTitle = StrDuplicate (L"Wait a few minutes...");
    MsgDialogContext.Type = EFI_DIALOG_TYPE_REMINDER;
    MenuPageRefresh (Page);
    DoDialog (MsgDialogTitle, &MsgDialogContext);

    LogFilePath = PoolPrint (
                    L"%s\\%s",
                    gFT->FilePath,
                    EFI_SCT_PATH_LOG
                    );
    if (LogFilePath == NULL) {
      return;
    }

    //
    // Generate the report file
    //
    Status = GenerateReport (
               gFT->DevicePath,
               LogFilePath,
               DialogContext->DevicePath,
               FileName
               );

    if (EFI_ERROR (Status)) {
      MsgDialogTitle = StrDuplicate (L"Generate Report Error!");
    } else {
      MsgDialogTitle = StrDuplicate (L"Generate Report Succeed!");
    }

    MsgDialogContext.Type = EFI_DIALOG_TYPE_MESSAGE;

    DoDialog (MsgDialogTitle, &MsgDialogContext);

    BS->FreePool (FileName);
    BS->FreePool (DialogContext->DevicePath);
    BS->FreePool (DialogContext->FileName);
  } else {
    if (DialogContext->FileName != NULL) {
      BS->FreePool (DialogContext->FileName);
    }
    if (DialogContext->DevicePath != NULL) {
      BS->FreePool (DialogContext->DevicePath);
    }
  }

  BS->FreePool (DialogContext);
  MenuPageRefresh (Page);
  return;
}
Beispiel #11
0
HRESULT CAutotest::Autotest()
{
	HRESULT hr = S_OK;
	DWORD dwTableSize = sizeof(m_sResultTable) / sizeof(m_sResultTable[0]);

	SW_TRACE_NORMAL("Info: Autotest begins...\n");
	
	SaveAutotestProgress();

	
	for (INT i = m_iRunCount; i < m_iTestCount; i++)
	{	
		m_dwTestProgress = 1;
		
		SW_TRACE_NORMAL("Info: TestLoop #%d\n", i+1);	
		
		if (GetAutotestStopFlag())
		{
			SW_TRACE_DEBUG("Info: Autotest is forced to stop!\n");
			break;
		}
		
		if( i < 10)
		{
			CTester::Product_SwitcherTest(3);
			CTester::Product_DcCtl_TEST(5);
		}
		
		AutotestRunOnce(m_sResultTable, dwTableSize);
		m_iRunCount++;

		if (GetAutotestStopFlag())
		{
			SW_TRACE_DEBUG("Info: Autotest is forced to stop!\n");
			break;
		}
		CHAR* pszReport = NULL;
		BOOL bOK = TRUE;
		
		GenerateReport((DWORD)i+1, m_sResultTable, dwTableSize, &pszReport, &bOK);		
		
		if (GetAutotestStopFlag())
		{
			SW_TRACE_DEBUG("Info: Autotest is forced to stop!\n");
			SAFE_MEM_FREE(pszReport);
			break;
		}
		
		SaveReport(pszReport);

		if (GetAutotestStopFlag())
		{
			SW_TRACE_DEBUG("Info: Autotest is forced to stop!\n");
			SAFE_MEM_FREE(pszReport);
			break;
		}

		SendReport(pszReport, bOK);

		if (GetAutotestStopFlag())
		{
			SW_TRACE_DEBUG("Info: Autotest is forced to stop!\n");
			SAFE_MEM_FREE(pszReport);
			break;
		}

		SAFE_MEM_FREE(pszReport);

	}

	if (0 == m_iNGCount)
	{
		m_dwTestProgress = 0;//test OK
	}
	else
	{
		m_dwTestProgress = 2;//test failed
	}

	SetAutotestStopFlag(TRUE);
	SW_TRACE_NORMAL("Info: Autotest %s!\n", m_iRunCount >= m_iTestCount-1 ? "Done" : "Canceled");	
	
	return S_OK;
}
Beispiel #12
0
 virtual void OnFatalException()
 {
     GenerateReport(wxDebugReport::Context_Exception);
 }
Beispiel #13
0
void StatisticsViewer::OnLogfileLoaded()
{
  ui->statistics->setText(GenerateReport(m_Ctx));
}