Skip to content

Commit

Permalink
engine: platform: enable crash handler for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed Feb 2, 2025
1 parent 0cb034a commit 1c7f4ca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion engine/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static inline void Platform_Sleep( int msec )
#endif
}

#if XASH_WIN32 || XASH_FREEBSD || XASH_NETBSD || XASH_OPENBSD || XASH_ANDROID || XASH_LINUX
#if XASH_WIN32 || XASH_FREEBSD || XASH_NETBSD || XASH_OPENBSD || XASH_ANDROID || XASH_LINUX || XASH_APPLE
void Sys_SetupCrashHandler( void );
void Sys_RestoreCrashHandler( void );
#else
Expand Down
2 changes: 1 addition & 1 deletion engine/platform/posix/crash_glibc.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void Sys_Crash( int signal, siginfo_t *si, void *context )
len = Q_snprintf( message, sizeof( message ), "Ver: " XASH_ENGINE_NAME " " XASH_VERSION " (build %i-%s, %s-%s)\n",
Q_buildnum(), g_buildcommit, Q_buildos(), Q_buildarch() );

#if !XASH_FREEBSD && !XASH_NETBSD && !XASH_OPENBSD
#if !XASH_FREEBSD && !XASH_NETBSD && !XASH_OPENBSD && !XASH_APPLE // they don't have si_ptr
len += Q_snprintf( message + len, sizeof( message ) - len, "Crash: signal %d errno %d with code %d at %p %p\n", signal, si->si_errno, si->si_code, si->si_addr, si->si_ptr );
#else
len += Q_snprintf( message + len, sizeof( message ) - len, "Crash: signal %d errno %d with code %d at %p\n", signal, si->si_errno, si->si_code, si->si_addr );
Expand Down
4 changes: 2 additions & 2 deletions engine/platform/posix/crash_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ GNU General Public License for more details.
// while this is mostly POSIX-compatible functions
// the contents of ucontext_t is platform-dependent
// before adding new OS here, check platform.h
#if XASH_FREEBSD || XASH_NETBSD || XASH_OPENBSD || XASH_ANDROID || XASH_LINUX
#if XASH_FREEBSD || XASH_NETBSD || XASH_OPENBSD || XASH_ANDROID || XASH_LINUX || XASH_APPLE
#ifndef XASH_OPENBSD
#include <ucontext.h>
#endif
Expand Down Expand Up @@ -118,7 +118,7 @@ void Sys_Crash( int signal, siginfo_t *si, void *context )
len = Q_snprintf( message, sizeof( message ), "Ver: " XASH_ENGINE_NAME " " XASH_VERSION " (build %i-%s, %s-%s)\n",
Q_buildnum(), g_buildcommit, Q_buildos(), Q_buildarch() );

#if !XASH_FREEBSD && !XASH_NETBSD && !XASH_OPENBSD
#if !XASH_FREEBSD && !XASH_NETBSD && !XASH_OPENBSD && !XASH_APPLE
len += Q_snprintf( message + len, sizeof( message ) - len, "Crash: signal %d errno %d with code %d at %p %p\n", signal, si->si_errno, si->si_code, si->si_addr, si->si_ptr );
#else
len += Q_snprintf( message + len, sizeof( message ) - len, "Crash: signal %d errno %d with code %d at %p\n", signal, si->si_errno, si->si_code, si->si_addr );
Expand Down

0 comments on commit 1c7f4ca

Please sign in to comment.