#include #include #include #include #include #include #include #include #include "system/hardware/hw.h" #include "selfdrive/ui/qt/qt_window.h" #include "selfdrive/ui/qt/util.h" #include "selfdrive/ui/qt/window.h" // CLEARPILOT: crash handler — prints stack trace to stderr on SIGSEGV/SIGABRT static void crash_handler(int sig) { const char *sig_name = (sig == SIGSEGV) ? "SIGSEGV" : (sig == SIGABRT) ? "SIGABRT" : "SIGNAL"; fprintf(stderr, "\n=== CRASH: %s (signal %d) ===\n", sig_name, sig); void *frames[64]; int count = backtrace(frames, 64); fprintf(stderr, "Backtrace (%d frames):\n", count); backtrace_symbols_fd(frames, count, STDERR_FILENO); fprintf(stderr, "=== END CRASH ===\n"); fflush(stderr); // Re-raise to get default behavior (core dump / exit) signal(sig, SIG_DFL); raise(sig); } int main(int argc, char *argv[]) { signal(SIGSEGV, crash_handler); signal(SIGABRT, crash_handler); setpriority(PRIO_PROCESS, 0, -20); qInstallMessageHandler(swagLogMessageHandler); initApp(argc, argv); QTranslator translator; QString translation_file = QString::fromStdString(Params().get("LanguageSetting")); if (!translator.load(QString(":/%1").arg(translation_file)) && translation_file.length()) { qCritical() << "Failed to load translation file:" << translation_file; } QApplication a(argc, argv); a.installTranslator(&translator); MainWindow w; setMainWindow(&w); a.installEventFilter(&w); return a.exec(); }