Updates the in-memory copy of tracked data to account for truncates (this simply invalidates any data after truncate point)
| 162 | // Updates the in-memory copy of tracked data to account for truncates (this simply invalidates any data after truncate |
| 163 | // point) |
| 164 | void debugFileTruncate(std::string context, std::string file, int64_t offset) { |
| 165 | if (debugFileRegions.empty()) |
| 166 | debugFileSetup(); |
| 167 | if (debugFileTrim(file) == debugFileName) { |
| 168 | bool found = false; |
| 169 | for (auto itr = debugFileRegions.begin(); itr != debugFileRegions.end(); ++itr) { |
| 170 | if (itr->first + itr->second > offset) { |
| 171 | found = true; |
| 172 | TraceEvent("DebugFileTruncate") |
| 173 | .detail("Context", context) |
| 174 | .detail("Filename", file) |
| 175 | .detail("Offset", offset); |
| 176 | uint8_t* storeMask = debugFileMask[itr->first]; |
| 177 | ASSERT(storeMask); |
| 178 | |
| 179 | int64_t dbgOffset = std::max((int64_t)0, offset - itr->first); |
| 180 | memset(&storeMask[dbgOffset], 0, itr->second - dbgOffset); |
| 181 | } |
| 182 | } |
| 183 | if (!found) |
| 184 | TraceEvent("DebugFileSkippingTruncate") |
| 185 | .detail("Context", context) |
| 186 | .detail("Filename", file) |
| 187 | .detail("Offset", offset); |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | #else |
| 192 | void debugFileCheck(std::string context, std::string file, const void* data, int64_t offset, int length) {} |
no test coverage detected