Merge pull request #514 from pzychotic/windows-crashdumps

Windows crashdumps
This commit is contained in:
Louis Gombert 2024-08-11 12:34:38 +02:00 committed by GitHub
commit 6ec444d9cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 60 additions and 951 deletions

View File

@ -313,8 +313,12 @@ target_link_libraries(Descent3 PRIVATE
music networking physics renderer rtperformance sndlib ui unzip vecmat md5
${PLATFORM_LIBS})
target_include_directories(Descent3 PRIVATE ${PROJECT_BINARY_DIR}/lib)
target_link_options(Descent3 PRIVATE $<$<PLATFORM_ID:Windows>:/DEBUG:FULL>)
add_dependencies(Descent3 get_git_hash Direct_TCP_IP_Hog HogFull NetgamesDir Parallax_Online_Hog)
install(TARGETS Descent3 RUNTIME BUNDLE DESTINATION .)
if(MSVC)
install(FILES $<TARGET_PDB_FILE:Descent3> DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
if(BUILD_TESTING)
add_subdirectory(tests)

View File

@ -1059,7 +1059,7 @@ void PreInitD3Systems() {
debugging = true;
#endif
error_Init(debugging, false, PRODUCT_NAME);
error_Init(debugging, PRODUCT_NAME);
if (FindArg("-lowmem"))
Mem_low_memory_mode = true;

View File

@ -41,6 +41,7 @@
#include "appdatabase.h"
#include "args.h"
#include "init.h"
#include "debug.h"
#include "osiris_dll.h"
@ -134,7 +135,9 @@ void install_signal_handlers() {
fprintf(stderr, "SIG: Unable to install SIGTRAP\n");
}
#else
void install_signal_handlers() {}
void install_signal_handlers() {
SetUnhandledExceptionFilter(RecordExceptionInfo);
}
#endif
// ---------------------------------------------------------------------------

View File

@ -152,7 +152,7 @@ constexpr const int OSMBOX_OKCANCEL = 5;
extern bool Debug_break;
// if we are running under a debugger, then pass true
bool Debug_Init(bool debugger, bool mono_debug);
bool Debug_Init(bool debugger);
// Does a messagebox with a stack dump
// Messagebox shows topstring, then stack dump, then bottomstring
// Return types are the same as the Windows return values
@ -184,6 +184,6 @@ void ddio_InternalKeyClose();
// We forward declare PEXCEPTION_POINTERS so that the function
// prototype doesn't needlessly require windows.h.
typedef struct _EXCEPTION_POINTERS EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
int __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data, const char *Message);
long __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data);
#endif
#endif

View File

@ -50,7 +50,7 @@ bool Debug_break = false;
static char *Debug_DumpInfo();
// if we are running under a debugger, then pass true
bool Debug_Init(bool debugger, bool mono_debug) {
bool Debug_Init(bool debugger) {
#ifndef RELEASE
Debug_break = debugger;

File diff suppressed because it is too large Load Diff

View File

@ -576,8 +576,13 @@ target_link_libraries(Descent3Editor PRIVATE
fix grtext manage mem misc model module stream_audio
music networking physics renderer rtperformance sndlib ui unzip vecmat md5
${PLATFORM_LIBS})
target_link_options(Descent3Editor PRIVATE $<$<PLATFORM_ID:Windows>:/DEBUG:FULL>)
add_dependencies(Descent3Editor get_git_hash)
# FIXME: enable installation again when the editor is stable/usable
# install(TARGETS Descent3Editor RUNTIME)
# if(MSVC)
# install(FILES $<TARGET_PDB_FILE:Descent3Editor> DESTINATION ${CMAKE_INSTALL_BINDIR})
# endif()

View File

@ -77,8 +77,6 @@
#define MAX_MSG_LEN 2000
void Default_dbgbrk_callback();
// Debug break chain handlers
void (*DebugBreak_callback_stop)() = NULL;
void (*DebugBreak_callback_resume)() = NULL;
@ -97,8 +95,8 @@ void error_Spew();
//////////////////////////////////////////////////////////////////////////////
// initializes error handler.
bool error_Init(bool debugger, bool mono_debug, const char *app_title) {
Debug_Init(debugger, mono_debug);
bool error_Init(bool debugger, const char *app_title) {
Debug_Init(debugger);
Error_initialized = true;
Exit_message[0] = 0;
@ -114,8 +112,6 @@ bool error_Init(bool debugger, bool mono_debug, const char *app_title) {
return true;
}
int no_debug_dialog = 0;
// exits the application and prints out a standard error message
void Error(const char *fmt, ...) {
std::va_list arglist;
@ -139,13 +135,10 @@ void Error(const char *fmt, ...) {
if (Debug_break)
answer = Debug_ErrorBox(OSMBOX_ABORTRETRYIGNORE, Exit_title_str, Exit_message, "Press RETRY to debug.");
else if (!no_debug_dialog)
else
answer = Debug_ErrorBox(OSMBOX_OKCANCEL, Exit_title_str, Exit_message,
"Press OK to exit, CANCEL to ignore this error and continue.");
if (no_debug_dialog)
answer = IDOK;
switch (answer) {
case IDRETRY:
debug_break(); // Step Out of this function to see where Error() was called
@ -225,7 +218,7 @@ void AssertionFailed(const char *expstr, const char *file, int line) {
// error message output function
void error_Spew() {
if (Exit_message[0] && !no_debug_dialog)
if (Exit_message[0])
Debug_MessageBox(OSMBOX_OK, Exit_title_str, Exit_message);
}

View File

@ -152,10 +152,8 @@
#include "debug.h"
#include "mono.h"
extern int no_debug_dialog;
// initializes error handler.
bool error_Init(bool debugger, bool mono_debug, const char *app_title);
bool error_Init(bool debugger, const char *app_title);
// exits the application and prints out a standard error message
void Error(const char *fmt, ...);
// prints out an assertion error