void CrashReport::GenerateReport(EXCEPTION_POINTERS* p) #endif { wxLogMessage( _T( "Report generated in " ) ); CwdGuard cwgGuard( wxFileName::GetTempDir() ); NetDebugReport* report = new NetDebugReport( "http://debug.springlobby.info/upload" ) ; // NetDebugReport* report = new NetDebugReport( "http://localhost/upload" ) ; // add all standard files: currently this means just a minidump and an // XML file with system info and stack trace report->AddAll( ); wxString dir = report->GetDirectory(); wxString SystemInfos; SystemInfos += _T( "SpringLobby version " ) + TowxString(GetSpringLobbyVersion()) + _T( "\n" ) ; SystemInfos += _T( "Built from " ) + wxString( wxVERSION_STRING ) + _T(" on ") + wxPlatformInfo::Get().GetOperatingSystemIdName() + _T( "\n" ) ; report->AddText( _T( "SystemInfos.txt" ), SystemInfos, _( "System informations" ) ); #if wxUSE_STD_IOSTREAM report->AddText( _T( "AppLog.txt" ), TowxString( crashlog.str() ), _( "Application verbose log" ) ); #endif wxString script_file = TowxString(SlPaths::GetDataDir()) + wxFileName::GetPathSeparator() + _T("script.txt"); if ( wxFile::Exists( script_file ) ) report->AddFile( script_file, _( "Last generated spring launching script" ) ); #if wxUSE_STACKWALKER && !__WXMSW__ StackTrace stacktrace; stacktrace.Walk( 3, 20 ); report->AddText( _T( "stacktrace.txt" ), _T("Call stack:\n") + stacktrace.GetStackTrace(), _( "StackTrace" ) ); #else wxString report_fn = ( wxGetCwd() + wxFileName::GetPathSeparator() + _T("stacktrace.txt") ); if ( wxFile::Exists( report_fn ) ) wxRemoveFile( report_fn ); wxCharBuffer report_fn_char = report_fn.mb_str(); DrMingwGenerateStacktrace( p, (const char*)report_fn_char ); report->AddFile( report_fn, _( "StackTrace" ) ); #endif wxString SlBuildFlags; #ifdef DISABLE_SOUND SlBuildFlags += _T("sound=0"); #else SlBuildFlags += _T("sound=1"); #endif report->AddText( _T("buildflags.txt"), SlBuildFlags, _T("BuildFlags") ); report->AddText( _T("nick.txt"), sett().GetServerAccountNick( sett().GetDefaultServer() ), _T("Nick") ); wxDebugReportPreviewStd* bkl = new wxDebugReportPreviewStd(); // calling Show() is not mandatory, but is more polite if ( bkl->Show( *report ) ) { if ( report->Process() ) { wxLogMessage( _T( "Report successfully uploaded." ) ); } else { wxLogMessage( _T( "Report generated in \"%s\", but failed to upload" ), report->GetCompressedFileName().c_str() ); report->Reset(); wxLogMessage( _T("report reset") ); } } //else: user cancelled the report delete report; wxLogMessage( _T("deleted report") ); }