Files
ReSkate/Engine/Core/Debug/protocol.h
T
AyeZeeBB 4ac1343b95 Crash reports: self-hosted Sentry instead of Backtrace, and opt-in performance timings
Crash dumps now go to the project's own Sentry server. The launcher's
out-of-process helper is unchanged; only where it posts and what it expects
back are:

- The default endpoint is the Sentry project's minidump URL. Report
  attributes travel as Sentry tags, with the release as reskate@<version>.
- An upload counts as accepted when the server answers with an event ID.
- "backtrace" is "crash_report" throughout: the namespace, files, CMake
  targets, DINGOSDK_CRASH_REPORT_URL, DINGOSDK_BUILD_CRASH_REPORT_TESTS and
  the RESKATE_CRASH_REPORT_URL override.

Performance timings are new, and off unless "Send performance timings" is
ticked in the launcher's settings (RESKATE_TRACING=1). A small tracer
(Engine/Core/Debug/trace.h) posts each finished step to Sentry as a
transaction from a background thread; the launcher and the game it starts
share one trace. Timed: the update check, the Steam download, Thunderstore
installs, the mod merge, starting the game, the launch up to the first
playable level, each level load, joining a session, fetching the identity
lists, and the time spent in each level with its average frame rate and
long frames. Turning crash reports off turns timings off too.
2026-10-12 23:24:33 -05:00

35 lines
1.4 KiB
C++

#pragma once
#include <Windows.h>
#include <array>
#include <string>
namespace dingosdk::crash_report {
inline constexpr DWORD protocol_version = 2;
inline constexpr DWORD capture_timeout_ms = 15000;
struct SharedReport {
DWORD version{protocol_version};
DWORD thread_id{};
EXCEPTION_POINTERS* exception{}; // Address in the parent; MiniDumpWriteDump uses ClientPointers=TRUE.
std::array<wchar_t, 4096> url{};
std::array<wchar_t, 32768> directory{};
std::array<wchar_t, 260> application{};
std::array<wchar_t, 32768> native_directory{};
};
// Explicitly inherited unnamed handles; no token or paths on the command line.
enum HandleIndex : std::size_t { mapping, requested, captured, stopping, ready, parent, handle_count };
struct Handle {
HANDLE value{};
Handle() = default;
explicit Handle(HANDLE handle) : value(handle) {}
~Handle() { if (value && value != INVALID_HANDLE_VALUE) CloseHandle(value); }
Handle(const Handle&) = delete;
Handle& operator=(const Handle&) = delete;
HANDLE release() { const auto result = value; value = nullptr; return result; }
};
inline std::wstring environment(const wchar_t* name) {
std::array<wchar_t, 32768> buffer{};
const auto size = GetEnvironmentVariableW(name, buffer.data(), static_cast<DWORD>(buffer.size()));
return size && size < buffer.size() ? std::wstring(buffer.data(), size) : std::wstring{};
}
}