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

Method HandleException

CppCoverage/ExceptionHandler.cpp:71–108  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

69
70 //-------------------------------------------------------------------------
71 ExceptionHandlerStatus ExceptionHandler::HandleException(
72 HANDLE hProcess,
73 const EXCEPTION_DEBUG_INFO& exceptionDebugInfo,
74 std::wostream& message)
75 {
76 const auto& exceptionRecord = exceptionDebugInfo.ExceptionRecord;
77 const auto exceptionCode = exceptionRecord.ExceptionCode;
78
79 if (exceptionDebugInfo.dwFirstChance)
80 {
81 auto it = breakPointExceptionCode_.find(exceptionCode);
82
83 if (it != breakPointExceptionCode_.end())
84 {
85 auto& processHandles = it->second;
86 // Breakpoint exception need to be ignore the first time by process.
87 if (std::find(processHandles.begin(), processHandles.end(), hProcess) == processHandles.end())
88 processHandles.push_back(hProcess);
89 else
90 return ExceptionHandlerStatus::BreakPoint;
91 }
92
93 return ExceptionHandlerStatus::FirstChanceException;
94 }
95
96 message << std::endl << std::endl;
97 message << Tools::GetSeparatorLine() << std::endl;
98 message << L"*** ";
99 message << UnhandledExceptionErrorMessage << exceptionRecord.ExceptionCode;
100 message << L": " << GetExceptionStrFromCode(exceptionRecord.ExceptionCode) << std::endl;
101 message << Tools::GetSeparatorLine() << std::endl;
102 message << L"See https://github.com/OpenCppCoverage/OpenCppCoverage/wiki/FAQ";
103 message << L"#your-application-has-thrown-an-unhandled-exception-code-3221225477";
104 message << L"-exception_access_violation for additional information." << std::endl;
105
106 return (exceptionCode == CppExceptionErrorCode)
107 ? ExceptionHandlerStatus::CppError : ExceptionHandlerStatus::Error;
108 }
109
110 //-------------------------------------------------------------------------
111 void ExceptionHandler::OnExitProcess(HANDLE hProcess)

Callers 4

OnExceptionMethod · 0.80
OnExceptionMethod · 0.80
HandleExceptionTwiceMethod · 0.80
TEST_FFunction · 0.80

Calls 1

GetSeparatorLineFunction · 0.85

Tested by 3

OnExceptionMethod · 0.64
HandleExceptionTwiceMethod · 0.64
TEST_FFunction · 0.64