// This is invoked from a signal handler but in a sideline thread doing nothing // else so it is a little less fragile than a typical signal handler. static void takeSample(void *Arg) { u32 BitIdx = CurWorkingSetBitIdx; u32 Freq = 1; ++SnapshotNum; // Simpler to skip 0 whose mod matches everything. while (BitIdx <= MaxAccumBitIdx && (SnapshotNum % Freq) == 0) { u32 NumLines = computeWorkingSizeAndReset(BitIdx); VReport(1, "%s: snapshot #%5d bit %d freq %4d: %8u\n", SanitizerToolName, SnapshotNum, BitIdx, Freq, NumLines); SizePerFreq[BitIdx].push_back(NumLines); Freq = Freq << getFlags()->snapshot_step; BitIdx++; } }
void verifyAddressSpace() { #if SANITIZER_LINUX && defined(__x86_64__) // The kernel determines its mmap base from the stack size limit. // Our Linux 64-bit shadow mapping assumes the stack limit is less than a // terabyte, which keeps the mmap region above 0x7e00'. uptr StackLimit = GetStackSizeLimitInBytes(); if (StackSizeIsUnlimited() || StackLimit > MaxStackSize) { VReport(1, "The stack size limit is beyond the maximum supported.\n" "Re-execing with a stack size below 1TB.\n"); SetStackSizeLimitInBytes(MaxStackSize); ReExec(); } #endif }