mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-21 16:37:12 +01:00
Add debug report (crash report) to Help menu
This captures crashes on Windows along with the stack backtrace. On Linux (fedora 21 at least), the necessary function to enable capture is not included in the system wx libs. But, a self built version works fine and capture the backtrace, so I'm assuming other distros will probably work as well. On OSX, the crashes are caught, but it does not include the backtrace. But, really, the backtraces aren't all that useful in a release build since we don't ship with debug symbols and optimization plays havoc with proper backtraces anyway. The real benefit will be for the support folks as they can now get consistent info from user by asking the to generate a report from the "Help->Generate Support Data" menu item.
This commit is contained in:
@@ -99,6 +99,12 @@ It handles initialization and termination by subclassing wxApp.
|
||||
|
||||
#include "import/Import.h"
|
||||
|
||||
#if defined(EXPERIMENTAL_CRASH_REPORT)
|
||||
#include <wx/debugrpt.h>
|
||||
#include <wx/evtloop.h>
|
||||
#include <wx/textdlg.h>
|
||||
#endif
|
||||
|
||||
#ifdef EXPERIMENTAL_SCOREALIGN
|
||||
#include "effects/ScoreAlignDialog.h"
|
||||
#endif
|
||||
@@ -184,6 +190,13 @@ It handles initialization and termination by subclassing wxApp.
|
||||
# pragma comment(lib, "libvamp")
|
||||
# endif
|
||||
|
||||
# if defined(EXPERIMENTAL_CRASH_REPORT)
|
||||
# if defined(__WXDEBUG__)
|
||||
# pragma comment(lib, "wxmsw28ud_qa")
|
||||
# else
|
||||
# pragma comment(lib, "wxmsw28u_qa")
|
||||
# endif
|
||||
# endif
|
||||
#endif //(__WXMSW__)
|
||||
|
||||
#include "../images/AudacityLogoWithName.xpm"
|
||||
@@ -925,7 +938,9 @@ bool AudacityApp::ShouldShowMissingAliasedFileWarning()
|
||||
|
||||
AudacityLogger *AudacityApp::GetLogger()
|
||||
{
|
||||
return static_cast<AudacityLogger *>(wxLog::GetActiveTarget());
|
||||
// Use dynamic_cast so that we get a NULL ptr if we haven't yet
|
||||
// setup our logger.
|
||||
return dynamic_cast<AudacityLogger *>(wxLog::GetActiveTarget());
|
||||
}
|
||||
|
||||
void AudacityApp::InitLang( const wxString & lang )
|
||||
@@ -984,12 +999,55 @@ void AudacityApp::InitLang( const wxString & lang )
|
||||
Internat::Init();
|
||||
}
|
||||
|
||||
// Only used when checking plugins
|
||||
void AudacityApp::OnFatalException()
|
||||
{
|
||||
#if defined(EXPERIMENTAL_CRASH_REPORT)
|
||||
GenerateCrashReport(wxDebugReport::Context_Exception);
|
||||
#endif
|
||||
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
#if defined(EXPERIMENTAL_CRASH_REPORT)
|
||||
void AudacityApp::GenerateCrashReport(wxDebugReport::Context ctx)
|
||||
{
|
||||
wxDebugReportCompress rpt;
|
||||
rpt.AddAll(ctx);
|
||||
|
||||
wxFileName fn(FileNames::DataDir(), wxT("audacity.cfg"));
|
||||
rpt.AddFile(fn.GetFullPath(), wxT("Audacity Configuration"));
|
||||
rpt.AddFile(FileNames::PluginRegistry(), wxT("Plugin Registry"));
|
||||
rpt.AddFile(FileNames::PluginSettings(), wxT("Plugin Settings"));
|
||||
|
||||
AudacityLogger *logger = GetLogger();
|
||||
if (logger)
|
||||
{
|
||||
rpt.AddText(wxT("log.txt"), logger->GetLog(), wxT("Audacity Log"));
|
||||
}
|
||||
|
||||
bool ok = wxDebugReportPreviewStd().Show(rpt);
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
wxEventLoop::SetCriticalWindow(NULL);
|
||||
#endif
|
||||
|
||||
if (ok && rpt.Process())
|
||||
{
|
||||
wxTextEntryDialog dlg(NULL,
|
||||
_("Report generated to:"),
|
||||
_("Audacity Support Data"),
|
||||
rpt.GetCompressedFileName(),
|
||||
wxOK | wxCENTER);
|
||||
dlg.ShowModal();
|
||||
|
||||
wxLogMessage(wxT("Report generated to: %s"),
|
||||
rpt.GetCompressedFileName().c_str());
|
||||
|
||||
rpt.Reset();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__WXGTK__)
|
||||
// On wxGTK, there's a focus issue where dialogs do not automatically pass focus
|
||||
// to the first child. This means that you can use the keyboard to navigate within
|
||||
@@ -1014,6 +1072,15 @@ int AudacityApp::FilterEvent(wxEvent & event)
|
||||
}
|
||||
#endif
|
||||
|
||||
AudacityApp::AudacityApp()
|
||||
{
|
||||
#if defined(EXPERIMENTAL_CRASH_REPORT)
|
||||
#if defined(wxUSE_ON_FATAL_EXCEPTION) && wxUSE_ON_FATAL_EXCEPTION
|
||||
wxHandleFatalExceptions();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
// The `main program' equivalent, creating the windows and returning the
|
||||
// main frame
|
||||
bool AudacityApp::OnInit()
|
||||
|
||||
Reference in New Issue
Block a user