This entails several changes to capture the macOS-specific information in a way that's compatible with Crashpad. Note that rust-minidump expects this information to be stored according to what Crashpad does (and specifically how the exception code and subcode are stored) to format EXC_RESOURCE and EXC_GUARD exceptions.
Specifically:
MDException.exception_code should be set to the Mach exception kind (we already do that)
MDException.exception_flags should contain the low 32-bits of the Mach exception code save for EXC_RESOURCE and EXC_GUARD exceptions for which it must contain the upper 32-bits of the Mach exception code
MDException.exception_address should contain the Mach exception subcode for EXC_BAD_ACCESS instruction (which corresponds to the address of the access which faulted) and the IP of the instruction that threw the exception for all others or zero in case the subcode is not available (we're close but we need to explicitly check the type of exception)
MDException.number_parameters should be set to 2 if the subcode is 0, 3 otherwise
MDException.exception_information[0] should contain the Mach exception type
MDException.exception_information[1] should contain the Mach exception code
MDException.exception_information[2] should contain the non-zero Mach exception subcode
See here for the implementation in Firefox' forked Breakpad writer.
This entails several changes to capture the macOS-specific information in a way that's compatible with Crashpad. Note that rust-minidump expects this information to be stored according to what Crashpad does (and specifically how the exception code and subcode are stored) to format
EXC_RESOURCEandEXC_GUARDexceptions.Specifically:
MDException.exception_codeshould be set to the Mach exception kind (we already do that)MDException.exception_flagsshould contain the low 32-bits of the Mach exception code save forEXC_RESOURCEandEXC_GUARDexceptions for which it must contain the upper 32-bits of the Mach exception codeMDException.exception_addressshould contain the Mach exception subcode forEXC_BAD_ACCESSinstruction (which corresponds to the address of the access which faulted) and the IP of the instruction that threw the exception for all others or zero in case the subcode is not available (we're close but we need to explicitly check the type of exception)MDException.number_parametersshould be set to 2 if the subcode is 0, 3 otherwiseMDException.exception_information[0]should contain the Mach exception typeMDException.exception_information[1]should contain the Mach exception codeMDException.exception_information[2]should contain the non-zero Mach exception subcodeSee here for the implementation in Firefox' forked Breakpad writer.