diff --git a/src/os/macosx/crashlog_osx.cpp b/src/os/macosx/crashlog_osx.cpp index 175c355a74..2cb984352d 100644 --- a/src/os/macosx/crashlog_osx.cpp +++ b/src/os/macosx/crashlog_osx.cpp @@ -16,6 +16,7 @@ #include "../../screenshot.h" #include "../../debug.h" #include "../../video/video_driver.hpp" +#include "../../scope.h" #include "macos.h" #include @@ -235,6 +236,10 @@ class CrashLogOSX : public CrashLog { #endif for (; frame != nullptr && i < MAX_STACK_FRAMES; i++) { + auto guard = scope_guard([&]() { + this->CrashLogFaultSectionCheckpoint(buffer); + }); + /* Get IP for current stack frame. */ #if defined(__ppc__) || defined(__ppc64__) void *ip = frame[2]; diff --git a/src/os/unix/crashlog_unix.cpp b/src/os/unix/crashlog_unix.cpp index 56406bc87c..a033772eaa 100644 --- a/src/os/unix/crashlog_unix.cpp +++ b/src/os/unix/crashlog_unix.cpp @@ -13,6 +13,7 @@ #include "../../string_func.h" #include "../../gamelog.h" #include "../../sl/saveload.h" +#include "../../scope.h" #include #include @@ -526,6 +527,9 @@ class CrashLogUnix : public CrashLog { #endif /* WITH_BFD */ for (int i = 0; i < trace_size; i++) { + auto guard = scope_guard([&]() { + this->CrashLogFaultSectionCheckpoint(buffer); + }); #if defined(WITH_DL) Dl_info info; #if defined(WITH_DL2) diff --git a/src/os/windows/crashlog_win.cpp b/src/os/windows/crashlog_win.cpp index 5c331bd0d6..1ea6e886b6 100644 --- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -24,6 +24,7 @@ #include "../../settings_type.h" #include "../../thread.h" #include "../../walltime_func.h" +#include "../../scope.h" #if defined(WITH_DEMANGLE) #include #endif @@ -515,6 +516,9 @@ char *CrashLogWindows::AppendDecodedStacktrace(char *buffer, const char *last) c /* Walk stack at most MAX_FRAMES deep in case the stack is corrupt. */ for (uint num = 0; num < MAX_FRAMES; num++) { + auto guard = scope_guard([&]() { + this->CrashLogFaultSectionCheckpoint(buffer); + }); if (!proc.pStackWalk64( #ifdef _M_AMD64 IMAGE_FILE_MACHINE_AMD64,