void assertSignalMask(uint32_t expected) { #if (defined(AVMPLUS_MAC) || defined(linux)) && defined(DEBUG) sigset_t current_mask; sigemptyset(¤t_mask); if (sigprocmask(0, NULL, ¤t_mask) == -1) { VMPI_debugLog("signal mask query failed\n"); VMPI_debugBreak(); } else { for (int i = 0; i< 32; i++) { bool result = sigismember(¤t_mask, i); if (result != (bool)(expected & (1 << i))) { VMPI_debugLog("masks not equal\n"); VMPI_debugBreak(); } } } #else // do nothing (void)expected; // will use the setjmp/longjmp calls that do save and restore // signal masks, so no need to verify that the signal mask // hasn't changed. #endif }
void AvmDebugMsg(const char* p, bool debugBreak) { #ifdef _DEBUG VMPI_debugLog(p); if(debugBreak) VMPI_debugBreak(); #else (void)p; (void)debugBreak; #endif }
uint32_t querySignalMask() { #if (defined(AVMPLUS_MAC) || defined(linux)) && defined(DEBUG) // will save just the 32 signals to avoid exposing sigset_t in ExceptionFrame sigset_t set; uint32_t mask = 0; if (sigprocmask(0, NULL, &set) == -1) { VMPI_debugLog("signal mask query failed\n"); VMPI_debugBreak(); } for (int i = 0; i< 32; i++) { if (sigismember(&set, i)) mask |= (1 << i); } return mask; #else // will use the setjmp/longjmp calls that do save and restore // signal masks, so no need to verify that the signal mask // hasn't changed. return 0; #endif }
void GCDebugMsg(const char* p, bool debugBreak) { VMPI_debugLog(p); if(debugBreak) VMPI_debugBreak(); }