| 71 | } |
| 72 | |
| 73 | void |
| 74 | hostFaultWithStackTrace(const std::string &fault, |
| 75 | platform::StackTrace *stackTrace) |
| 76 | { |
| 77 | auto trace = platform::formatStackTrace(stackTrace); |
| 78 | |
| 79 | fmt::memory_buffer out; |
| 80 | fmt::format_to(std::back_inserter(out), "Encountered host cpu fault:\n"); |
| 81 | fmt::format_to(std::back_inserter(out), "Fault: {}\n", fault); |
| 82 | |
| 83 | if (trace.size()) { |
| 84 | fmt::format_to(std::back_inserter(out), "Stacktrace:\n{}\n", trace); |
| 85 | } |
| 86 | out.push_back('\0'); |
| 87 | |
| 88 | gLog->critical("{}", out.data()); |
| 89 | std::cerr << out.data() << std::endl; |
| 90 | |
| 91 | #ifdef PLATFORM_WINDOWS |
| 92 | if (IsDebuggerPresent()) { |
| 93 | OutputDebugStringW(platform::toWinApiString(out.data()).c_str()); |
| 94 | } else { |
| 95 | MessageBoxW(NULL, |
| 96 | platform::toWinApiString(fault).c_str(), |
| 97 | L"Encountered host cpu fault", |
| 98 | MB_OK | MB_ICONERROR); |
| 99 | } |
| 100 | #endif |
| 101 | } |
nothing calls this directly
no test coverage detected