MCPcopy Create free account
hub / github.com/apitrace/apitrace / VectoredHandler

Function VectoredHandler

wrappers/glmemshadow.cpp:101–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99
100#ifdef _WIN32
101static LONG CALLBACK
102VectoredHandler(PEXCEPTION_POINTERS pExceptionInfo)
103{
104 PEXCEPTION_RECORD pExceptionRecord = pExceptionInfo->ExceptionRecord;
105 DWORD ExceptionCode = pExceptionRecord->ExceptionCode;
106
107 if (ExceptionCode == EXCEPTION_ACCESS_VIOLATION &&
108 pExceptionRecord->NumberParameters >= 2 &&
109 pExceptionRecord->ExceptionInformation[0] == 1) { // writing
110
111 const uintptr_t addr = static_cast<uintptr_t>(pExceptionRecord->ExceptionInformation[1]);
112 const size_t page = addr / sPageSize;
113
114 std::unique_lock<std::mutex> lock(mutex);
115
116 const auto it = sPages.find(page);
117 if (it != sPages.end()) {
118 GLMemoryShadow *shadow = it->second;
119 shadow->onAddressWrite(addr, page);
120 return EXCEPTION_CONTINUE_EXECUTION;
121 }
122 }
123
124 return EXCEPTION_CONTINUE_SEARCH;
125}
126
127#else
128

Callers

nothing calls this directly

Calls 3

onAddressWriteMethod · 0.80
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected