On 06/11/2023 13:54, Sevan Janiyan wrote:
Sorry about the noise, I suspect the patch is invalid for Leopard.I will follow up with a new patch which splits the case for 10.5 & older, if that is the case, once I've done more testing.
Attached patch splits the powerpc case to Leopard and newer (there's a leaked beta build of Snow Leopard for PowerPC out there) and Tiger and prior.
Tested on Tiger 10.4.11 with libsigsegv and Leopard 10.5.8 without libsigsegv.
The 4 test-sigsegv-catch tests pass on both. Sevan
diff --git a/lib/sigsegv.c b/lib/sigsegv.c index 8263d9b7bd..163ffb1656 100644 --- a/lib/sigsegv.c +++ b/lib/sigsegv.c @@ -645,6 +645,8 @@ int libsigsegv_version = LIBSIGSEGV_VERSION; #if (defined __APPLE__ && defined __MACH__) /* macOS */ +#include <AvailabilityMacros.h> + # define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, siginfo_t *sip, void *ucp # define SIGSEGV_FAULT_ADDRESS sip->si_addr # define SIGSEGV_FAULT_CONTEXT ((ucontext_t *) ucp) @@ -676,11 +678,21 @@ int libsigsegv_version = LIBSIGSEGV_VERSION; # elif defined __powerpc__ +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 /* See the definitions of - 'ucontext_t' and 'struct __darwin_ucontext' in <sys/_structs.h>, - 'struct __darwin_mcontext' in <ppc/_structs.h>, and - 'struct __darwin_ppc_thread_state' in <mach/ppc/_structs.h>. */ # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext->__ss.__r1 +#endif + +#if MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_4 +/* See the definitions of + - 'ucontext_t' and 'struct __darwin_ucontext' in <sys/_types.h>, + - 'struct __darwin_mcontext' in <ppc/ucontext.h>, and + - 'struct __darwin_ppc_thread_state' in <mach/ppc/_types.h>. */ +# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext->ss.r1 +#endif # endif