mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
write a crash report when an assertion fails
Assertions ship in every configuration - Ja2/builddefines.h defines FORCE_ASSERTS_ON unconditionally - so a player on a release build hits the runtime error screen with a line and a file, and that is all anyone ever gets. The crash handler that would have written a report never runs, because an assertion faults nothing. Raise a software exception from _FailMessage so it does. The code has the customer bit set, the handler recognizes it, and the report carries the assertion's line, file and message alongside the usual registers, module table and frame chain, which symbolizes back to the assertion site. The exception is swallowed again immediately: first-chance is all the handler needs, and letting it travel further would kill a game that means to show its error screen. The dumper needed two adjustments to cope with an exception nobody faulted: its one-report-per-address rule keys on the assertion's own file and line, since every raise shares RaiseException's address, and the re-entry latch is lifted in the __except, which is the only code that runs if writing a report faults. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
committed by
majcosta
co-authored by
Claude Opus 5
parent
06b115a293
commit
56e6873b80
@@ -393,6 +393,10 @@ void _FailMessage(const char* message, unsigned lineNum, const char * functionNa
|
||||
return;
|
||||
alreadyInThisFunction = true;
|
||||
|
||||
// Before anything else: this leaves a crash report the player can upload, and
|
||||
// everything below it (a stack walk, a save, a screen) can die trying.
|
||||
sgp::raiseAssertException(lineNum, sourceFileName, message);
|
||||
|
||||
sgp::dumpStackTrace(message);
|
||||
|
||||
mprintf( 10, 10, L"%s: %s %s", pMessageStrings[ MSG_VERSION ], zProductLabel, zBuildInformation );
|
||||
|
||||
Reference in New Issue
Block a user