Forum
    • Categories
    • Register
    • Login

    HISE Crash Reporter

    Scheduled Pinned Locked Moved C++ Development
    5 Posts 2 Posters 56 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      clevername27
      last edited by clevername27

      Has HISE crashed on you? Of course it has. Did it report anything to operating system? Of course not…where would the mystery be? Here to spoil all the fun is a crash reporter. So, at least you're not gaslit when you could swear HISE vanished from your screen. I'm on macOS, so no idea about other operating systems and I don't care.


      Save the below as crash-handler.patch, then run git apply crash-handler.patch.

      diff --git a/hi_backend/backend/BackendProcessor.cpp b/hi_backend/backend/BackendProcessor.cpp
      index 3b45c6d2e..95b42bc1a 100644
      --- a/hi_backend/backend/BackendProcessor.cpp
      +++ b/hi_backend/backend/BackendProcessor.cpp
      @@ -49,6 +49,47 @@ void printData()
       
       namespace hise { using namespace juce;
       
      +namespace
      +{
      +void installBackendCrashHandler()
      +{
      +	static bool installed = false;
      +
      +	if (installed)
      +		return;
      +
      +	installed = true;
      +
      +	SystemStats::setApplicationCrashHandler([](void*)
      +	{
      +		static bool handling = false;
      +
      +		if (handling)
      +			return;
      +
      +		handling = true;
      +
      +		auto crashDir = File::getSpecialLocation(File::userApplicationDataDirectory)
      +							.getChildFile("HISE")
      +							.getChildFile("CrashLogs");
      +
      +		crashDir.createDirectory();
      +
      +		auto logFile = crashDir.getChildFile("HISE_CrashBacktrace.txt");
      +		FileOutputStream stream(logFile);
      +
      +		if (stream.openedOk())
      +		{
      +			stream.setPosition(logFile.getSize());
      +			stream << "----\n";
      +			stream << Time::getCurrentTime().toString(true, true) << "\n";
      +			stream << SystemStats::getStackBacktrace() << "\n";
      +			stream.flush();
      +		}
      +	});
      +}
      +}
      +
      @@ -274,6 +315,8 @@ BackendProcessor::BackendProcessor(AudioDeviceManager *deviceManager_/*=nullptr*
         autosaver(this),
         pluginParameterRamp(this)
       {
      +	installBackendCrashHandler();
      +
       	//printData();
      

      This writes crashes to ~/Library/Application Support/HISE/CrashLogs/HISE_CrashBacktrace.txt

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @clevername27
        last edited by

        @clevername27 doesn't macOS write the crash reports already automatically?

        C 2 Replies Last reply Reply Quote 0
        • C
          clevername27 @Christoph Hart
          last edited by

          @Christoph-Hart It doesn't always. I'll do a little more research, and post info on why. It's Apple's way of saying, "We're Apple, and we don't think you need to worry about this. Because we're Apple."

          1 Reply Last reply Reply Quote 0
          • C
            clevername27 @Christoph Hart
            last edited by

            @Christoph-Hart So…macOS only reports crashes that terminate the process via an unhandled exception/signal. It might not read it's head because one (or more) of these applied:

            • HISE/JUCE intercepts the crash (custom crash handler) and exits cleanly, so CrashReporter never triggers.
            • Running under Xcode/LLDB suppresses the system crash dialog and routes it to the debugger.
            • It wasn’t a crash (hang, forced quit, graceful shutdown) → no CrashReporter event.

            Reports are silent even when generated; they live in ~/Library/Logs/DiagnosticReports (visible in Console.app) and may not show a dialog.

            That’s why the custom crash logger is useful: it captures a backtrace even when macOS doesn’t show or generate a report.

            Christoph HartC 1 Reply Last reply Reply Quote 0
            • Christoph HartC
              Christoph Hart @clevername27
              last edited by

              @clevername27 but 2 of the three reasons don't require a custom crash report (no crash => nothing to report. Running under debugger => even better diagnostics) and you're deliberately introducing the first reason with your custom crash handler :)

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              30

              Online

              2.1k

              Users

              13.3k

              Topics

              115.2k

              Posts