Module selection, and test signal handlers on Windows
VOID_ENABLED_MODULES (cache, empty for all) configures only the named modules and their INTERNAL_DEPS, followed transitively; OPTIONAL_DEPS are used when named too. A project embedding Void configures what it links, so the packages of modules it never builds (LibArchive, OpenSSL, SQLite, libsodium) need not exist, as in a mingw-w64 cross build. Testing's crash handlers use the C runtime's signal() on Windows, which has no sigaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3ef1013b85
commit
20893d1bf3
2 files changed
+48
No files matched your search
@@ -47,18 +47,27 @@ static void crash_handler(int sig) {
|
||||
|
||||
void install_signal_handlers(CrashCallback on_crash) {
|
||||
g_crash_callback = std::move(on_crash);
|
||||
#ifdef _WIN32
|
||||
// No sigaction on Windows: the C runtime's signal() covers these four.
|
||||
std::signal(SIGSEGV, crash_handler); std::signal(SIGABRT, crash_handler); std::signal(SIGFPE, crash_handler); std::signal(SIGILL, crash_handler);
|
||||
#else
|
||||
struct sigaction sa{}; sa.sa_handler = crash_handler; sigemptyset(&sa.sa_mask); sa.sa_flags = 0;
|
||||
sigaction(SIGSEGV, &sa, nullptr); sigaction(SIGABRT, &sa, nullptr); sigaction(SIGFPE, &sa, nullptr); sigaction(SIGILL, &sa, nullptr);
|
||||
#ifdef SIGBUS
|
||||
sigaction(SIGBUS, &sa, nullptr);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void uninstall_signal_handlers() {
|
||||
#ifdef _WIN32
|
||||
std::signal(SIGSEGV, SIG_DFL); std::signal(SIGABRT, SIG_DFL); std::signal(SIGFPE, SIG_DFL); std::signal(SIGILL, SIG_DFL);
|
||||
#else
|
||||
struct sigaction sa{}; sa.sa_handler = SIG_DFL;
|
||||
sigaction(SIGSEGV, &sa, nullptr); sigaction(SIGABRT, &sa, nullptr); sigaction(SIGFPE, &sa, nullptr); sigaction(SIGILL, &sa, nullptr);
|
||||
#ifdef SIGBUS
|
||||
sigaction(SIGBUS, &sa, nullptr);
|
||||
#endif
|
||||
#endif
|
||||
g_crash_callback = nullptr;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user