Make it possible to override the Mach fault recovery scheme through an

environment variable: SIGSEGV_MACH_FAULT. It can be set to "direct" to
assume the fault address comes from code[1] argument, or "slow" to use
the slow path through thread_get_status(EXCEPTION_STATE)->faultvaddr.
This commit is contained in:
gbeauche 2008-01-07 22:44:39 +00:00
parent 58ff9aba45
commit b1fa25128a

View File

@ -2437,8 +2437,17 @@ sigsegv_address_t sigsegv_get_fault_address(sigsegv_info_t *SIP)
mach_get_exception_state(SIP);
sigsegv_address_t addr = (sigsegv_address_t)SIGSEGV_FAULT_ADDRESS;
if (use_fast_path < 0)
use_fast_path = addr == SIP->addr;
if (use_fast_path < 0) {
const char *machfault = getenv("SIGSEGV_MACH_FAULT");
if (machfault) {
if (strcmp(machfault, "fast") == 0)
use_fast_path = 1;
else if (strcmp(machfault, "slow") == 0)
use_fast_path = 0;
}
if (use_fast_path < 0)
use_fast_path = addr == SIP->addr;
}
SIP->addr = addr;
}
#endif