1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-01 08:29:27 +02:00

Add alpha-build-only crash-me buttons, for testing of crash reporting

This commit is contained in:
Paul Licameli 2021-06-03 08:36:08 -04:00 committed by Dmitry Vedenko
parent 87652aff23
commit d28554189d

View File

@ -360,6 +360,31 @@ void OnCrashReport(const CommandContext &WXUNUSED(context) )
}
#endif
#ifdef IS_ALPHA
void OnSegfault(const CommandContext &)
{
unsigned *p = nullptr;
*p = 0xDEADBEEF;
}
void OnException(const CommandContext &)
{
// Throw an exception that can be caught only as (...)
// The intent is to exercise detection of unhandled exceptions by the
// crash reporter
struct Unique{};
throw Unique{};
}
void OnAssertion(const CommandContext &)
{
// We don't use assert() much directly, but Breakpad does detect it
// This may crash the program only in debug builds
// See also wxSetAssertHandler, and wxApp::OnAssertFailure()
assert(false);
}
#endif
void OnMenuTree(const CommandContext &context)
{
auto &project = context.project;
@ -525,8 +550,20 @@ BaseItemSharedPtr HelpMenu()
#ifdef IS_ALPHA
,
// alpha-only items don't need to internationalize, so use
// Verbatim for labels
Command( wxT("RaiseSegfault"), Verbatim("Test segfault report"),
FN(OnSegfault), AlwaysEnabledFlag ),
Command( wxT("ThrowException"), Verbatim("Test exception report"),
FN(OnException), AlwaysEnabledFlag ),
Command( wxT("ViolateAssertion"), Verbatim("Test assertion report"),
FN(OnAssertion), AlwaysEnabledFlag ),
// Menu explorer. Perhaps this should become a macro command
Command( wxT("MenuTree"), XXO("Menu Tree..."),
Command( wxT("MenuTree"), Verbatim("Menu Tree..."),
FN(OnMenuTree),
AlwaysEnabledFlag )
#endif