Files
source/sgp/debug_util.h
T
7624daa904 delete the stack tracer that never captured a frame
ENABLE_STACK_TRACE has been 0 for as long as the file has been here, so
StackTrace's constructor captured nothing and every line it ever wrote to
stack_trace.log was a bare message with an empty frame list behind it. The
DbgHelp singleton underneath it resolved symbols for that empty list, and
the game linked dbghelp.lib to do it.

The crash reports cover what this was meant to cover, and the VFS errors
that were its only real content are already in vfs.log and game_log.log.
Drop the tracer, the log, and the dbghelp dependency.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 16:51:06 -03:00

53 lines
2.4 KiB
C++

// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Crash reporting: capture a fault (or an assertion) as a report file, and hand
// the pending reports to the telemetry uploader at startup.
#ifndef BASE_DEBUG_UTIL_H_
#define BASE_DEBUG_UTIL_H_
struct _EXCEPTION_POINTERS;
// Assertion failures raise this software exception so they get the same crash
// report as a real fault. Bit 29 set marks it customer-defined, so it can never
// collide with a system code; the top two bits mark it an error.
#define SGP_EXCEPTION_ASSERT 0xE1A55E27
namespace sgp
{
// Raise SGP_EXCEPTION_ASSERT and swallow it again, so the vectored crash
// handler writes a report for an assertion that never faults. Carries the
// assert's line, file and message (NULL for a plain Assert) as exception
// parameters.
void raiseAssertException(unsigned lineNum, const char* sourceFileName,
const char* message);
// Write a heap-free crash report (registers + a raw return-address backtrace)
// for the faulting context to a numbered crash_report file; symbolize it
// offline against the build's PDB. Call first-chance from a vectored handler.
void writeExceptionBacktrace(_EXCEPTION_POINTERS* ep);
// Record the build-id (game version string) to stamp into crash reports, so
// a report can be matched to the exact build's PDB. Call once at startup.
void setCrashBuildId(const char* id);
// What to tell the player: why we died and where the report landed. NULL if
// no crash was recorded. Built by the handler, shown from the exit path.
const wchar_t* crashReportMessage();
// Record the player's optional self-chosen handle (HANDLE in Ja2 Settings) to
// stamp into crash reports, so a report can be tied to whoever raises it with
// us on Discord. Empty or unset simply omits the field. Call once at startup.
void setCrashUserHandle(const wchar_t* handle);
// Startup crash-telemetry pass (heap is healthy here — never call from a
// crash handler). If url is empty the feature is off. On first run, asks the
// player for consent (native dialog) and remembers it; if granted, POSTs each
// pending crash_report_*.txt to url and deletes the ones that upload cleanly.
void processCrashTelemetry(const wchar_t* url);
}
#endif // BASE_DEBUG_UTIL_H_