MCPcopy Create free account
hub / github.com/OpenCppCoverage/OpenCppCoverage / OnException

Method OnException

CppCoverage/Debugger.cpp:167–219  ·  view source on GitHub ↗

-------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

165
166 //-------------------------------------------------------------------------
167 Debugger::ProcessStatus
168 Debugger::OnException(
169 const DEBUG_EVENT& debugEvent,
170 IDebugEventsHandler& debugEventsHandler,
171 HANDLE hProcess,
172 HANDLE hThread) const
173 {
174 const auto& exception = debugEvent.u.Exception;
175 auto exceptionType = debugEventsHandler.OnException(hProcess, hThread, exception);
176
177 switch (exceptionType)
178 {
179 case IDebugEventsHandler::ExceptionType::BreakPoint:
180 {
181 return ProcessStatus{ boost::none, DBG_CONTINUE };
182 }
183 case IDebugEventsHandler::ExceptionType::InvalidBreakPoint:
184 {
185 LOG_WARNING << Tools::GetSeparatorLine();
186 LOG_WARNING << "It seems there is an assertion failure or you call DebugBreak() in your program.";
187 LOG_WARNING << Tools::GetSeparatorLine();
188
189 if (stopOnAssert_)
190 {
191 LOG_WARNING << "Stop on assertion.";
192 return ProcessStatus{ boost::none, DBG_EXCEPTION_NOT_HANDLED };
193 }
194 else
195 {
196 return ProcessStatus(EXCEPTION_BREAKPOINT, DBG_CONTINUE);
197 }
198 }
199 case IDebugEventsHandler::ExceptionType::NotHandled:
200 {
201 return ProcessStatus{ boost::none, DBG_EXCEPTION_NOT_HANDLED };
202 }
203 case IDebugEventsHandler::ExceptionType::Error:
204 {
205 return ProcessStatus{ boost::none, DBG_EXCEPTION_NOT_HANDLED };
206 }
207 case IDebugEventsHandler::ExceptionType::CppError:
208 {
209 if (continueAfterCppException_)
210 {
211 const auto& exceptionRecord = exception.ExceptionRecord;
212 LOG_WARNING << "Continue after a C++ exception.";
213 return ProcessStatus{ static_cast<int>(exceptionRecord.ExceptionCode), DBG_CONTINUE };
214 }
215 return ProcessStatus{ boost::none, DBG_EXCEPTION_NOT_HANDLED };
216 }
217 }
218 THROW("Invalid exception Type.");
219 }
220
221 //-------------------------------------------------------------------------
222 void Debugger::OnCreateProcess(

Callers

nothing calls this directly

Calls 2

GetSeparatorLineFunction · 0.85
ProcessStatusClass · 0.85

Tested by

no test coverage detected