MCPcopy Create free account
hub / github.com/CppMicroServices/CppMicroServices / TerminateForDebug

Function TerminateForDebug

framework/src/util/Utils.cpp:162–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160 }
161
162 void
163 TerminateForDebug(std::exception_ptr const ex)
164 {
165#if defined(_MSC_VER) && !defined(NDEBUG) && defined(_DEBUG) && defined(_CRT_ERROR)
166 std::string message = util::GetLastExceptionStr();
167
168 // get the current report mode
169 int reportMode = _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_WNDW);
170 _CrtSetReportMode(_CRT_ERROR, reportMode);
171 int ret = _CrtDbgReport(_CRT_ERROR, __FILE__, __LINE__, CppMicroServices_VERSION_STR, message.c_str());
172 if (ret == 0 && reportMode & _CRTDBG_MODE_WNDW)
173 {
174 return; // ignore
175 }
176 else if (ret == 1)
177 {
178 _CrtDbgBreak();
179 }
180#else
181 (void)ex;
182#endif
183
184#ifdef US_PLATFORM_POSIX
185 abort(); // trap; generates core dump
186#else
187 exit(1); // goodbye cruel world
188#endif
189 }
190
191 namespace detail
192 {

Callers

nothing calls this directly

Calls 1

GetLastExceptionStrFunction · 0.85

Tested by

no test coverage detected