2019-05-17 20:29:31 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
|
|
|
|
CrashReport.cpp
|
|
|
|
|
|
|
|
*//*******************************************************************/
|
|
|
|
|
|
|
|
#include "Audacity.h"
|
|
|
|
#include "CrashReport.h"
|
|
|
|
#include "Experimental.h"
|
|
|
|
|
|
|
|
#if defined(EXPERIMENTAL_CRASH_REPORT)
|
2021-02-09 18:38:07 +00:00
|
|
|
#include <atomic>
|
|
|
|
#include <thread>
|
|
|
|
|
2021-02-09 18:31:04 +00:00
|
|
|
#include <wx/progdlg.h>
|
2019-05-17 20:29:31 +00:00
|
|
|
|
2020-05-26 20:20:10 +00:00
|
|
|
#if defined(__WXMSW__)
|
|
|
|
#include <wx/evtloop.h>
|
|
|
|
#endif
|
|
|
|
|
2019-05-17 20:29:31 +00:00
|
|
|
#include "wxFileNameWrapper.h"
|
|
|
|
#include "AudacityLogger.h"
|
2019-06-10 18:25:50 +00:00
|
|
|
#include "AudioIOBase.h"
|
2019-05-17 20:29:31 +00:00
|
|
|
#include "FileNames.h"
|
|
|
|
#include "Internat.h"
|
2021-02-13 07:58:09 +00:00
|
|
|
#include "Project.h"
|
|
|
|
#include "ProjectFileIO.h"
|
2019-05-17 20:29:31 +00:00
|
|
|
#include "prefs/GUIPrefs.h"
|
|
|
|
#include "widgets/ErrorDialog.h"
|
|
|
|
|
|
|
|
namespace CrashReport {
|
|
|
|
|
|
|
|
void Generate(wxDebugReport::Context ctx)
|
|
|
|
{
|
|
|
|
wxDebugReportCompress rpt;
|
2021-02-09 18:31:04 +00:00
|
|
|
|
|
|
|
// Bug 1927: Seems there problems with wxStackWalker, so don't even include
|
|
|
|
// the stack trace or memory dump. The former is pretty much useless in Release
|
|
|
|
// builds anyway and none of use have the skill/time/desire to fiddle with the
|
|
|
|
// latter.
|
|
|
|
// rpt.AddAll(ctx);
|
|
|
|
|
2019-05-17 20:29:31 +00:00
|
|
|
{
|
2021-02-10 18:27:42 +00:00
|
|
|
// Provides a progress dialog with indeterminate mode
|
|
|
|
wxGenericProgressDialog pd(XO("Audacity Support Data").Translation(),
|
|
|
|
XO("This may take several seconds").Translation(),
|
|
|
|
300000, // range
|
|
|
|
nullptr, // parent
|
|
|
|
wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_SMOOTH);
|
|
|
|
|
|
|
|
std::atomic_bool done = {false};
|
|
|
|
auto thread = std::thread([&]
|
2021-02-09 18:31:04 +00:00
|
|
|
{
|
2021-02-10 18:27:42 +00:00
|
|
|
wxFileNameWrapper fn{ FileNames::DataDir(), wxT("audacity.cfg") };
|
|
|
|
rpt.AddFile(fn.GetFullPath(), _TS("Audacity Configuration"));
|
|
|
|
rpt.AddFile(FileNames::PluginRegistry(), wxT("Plugin Registry"));
|
|
|
|
rpt.AddFile(FileNames::PluginSettings(), wxT("Plugin Settings"));
|
|
|
|
|
|
|
|
if (ctx == wxDebugReport::Context_Current)
|
|
|
|
{
|
|
|
|
auto saveLang = GUIPrefs::GetLangShort();
|
|
|
|
GUIPrefs::InitLang( wxT("en") );
|
|
|
|
auto cleanup = finally( [&]{ GUIPrefs::InitLang( saveLang ); } );
|
2019-05-17 20:29:31 +00:00
|
|
|
|
2021-02-10 18:27:42 +00:00
|
|
|
auto gAudioIO = AudioIOBase::Get();
|
|
|
|
rpt.AddText(wxT("audiodev.txt"), gAudioIO->GetDeviceInfo(), wxT("Audio Device Info"));
|
2021-02-13 07:58:09 +00:00
|
|
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
2021-02-10 18:27:42 +00:00
|
|
|
rpt.AddText(wxT("mididev.txt"), gAudioIO->GetMidiDeviceInfo(), wxT("MIDI Device Info"));
|
2021-02-13 07:58:09 +00:00
|
|
|
#endif
|
|
|
|
auto project = GetActiveProject();
|
|
|
|
auto &projectFileIO = ProjectFileIO::Get( *project );
|
|
|
|
rpt.AddText(wxT("project.txt"), projectFileIO.GenerateDoc(), wxT("Active project doc"));
|
2021-02-10 18:27:42 +00:00
|
|
|
}
|
2021-02-09 18:31:04 +00:00
|
|
|
|
2021-02-10 18:27:42 +00:00
|
|
|
auto logger = AudacityLogger::Get();
|
|
|
|
if (logger)
|
|
|
|
{
|
|
|
|
rpt.AddText(wxT("log.txt"), logger->GetLog(), _TS("Audacity Log"));
|
|
|
|
}
|
2021-02-09 18:31:04 +00:00
|
|
|
|
2021-02-10 18:27:42 +00:00
|
|
|
done = true;
|
|
|
|
});
|
2019-05-17 20:29:31 +00:00
|
|
|
|
2021-02-10 18:27:42 +00:00
|
|
|
// Wait for information to be gathered
|
|
|
|
while (!done)
|
|
|
|
{
|
|
|
|
wxMilliSleep(50);
|
|
|
|
pd.Pulse();
|
|
|
|
}
|
|
|
|
thread.join();
|
2019-05-17 20:29:31 +00:00
|
|
|
}
|
2021-02-09 18:31:04 +00:00
|
|
|
|
2019-05-17 20:29:31 +00:00
|
|
|
bool ok = wxDebugReportPreviewStd().Show(rpt);
|
|
|
|
|
|
|
|
#if defined(__WXMSW__)
|
|
|
|
wxEventLoop::SetCriticalWindow(NULL);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (ok && rpt.Process())
|
|
|
|
{
|
2019-12-18 05:07:58 +00:00
|
|
|
AudacityTextEntryDialog dlg(nullptr,
|
|
|
|
XO("Report generated to:"),
|
|
|
|
XO("Audacity Support Data"),
|
|
|
|
rpt.GetCompressedFileName(),
|
|
|
|
wxOK | wxCENTER);
|
2019-05-17 20:29:31 +00:00
|
|
|
dlg.SetName(dlg.GetTitle());
|
|
|
|
dlg.ShowModal();
|
|
|
|
|
|
|
|
wxLogMessage(wxT("Report generated to: %s"),
|
|
|
|
rpt.GetCompressedFileName());
|
|
|
|
|
|
|
|
rpt.Reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|