-
-
Notifications
You must be signed in to change notification settings - Fork 457
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always use BugTrap to produce minidump
New command line key -detailed_minidump that produces more detailed bump than usual
- Loading branch information
1 parent
4d73bb3
commit 1fb38b0
Showing
2 changed files
with
12 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,8 +53,6 @@ static BOOL bException = FALSE; | |
|
||
#ifdef DEBUG | ||
#define USE_OWN_ERROR_MESSAGE_WINDOW | ||
#else | ||
#define USE_OWN_MINI_DUMP | ||
#endif | ||
|
||
#if defined XR_X64 | ||
|
@@ -618,11 +616,14 @@ void WINAPI xrDebug::PreErrorHandler(INT_PTR) | |
void xrDebug::SetupExceptionHandler(const bool& dedicated) | ||
{ | ||
#if defined(WINDOWS) | ||
const auto commandLine = GetCommandLine(); | ||
|
||
// disable 'appname has stopped working' popup dialog | ||
UINT prevMode = SetErrorMode(SEM_NOGPFAULTERRORBOX); | ||
const auto prevMode = SetErrorMode(SEM_NOGPFAULTERRORBOX); | ||
SetErrorMode(prevMode | SEM_NOGPFAULTERRORBOX); | ||
BT_InstallSehFilter(); | ||
if (!dedicated && !strstr(GetCommandLine(), "-silent_error_mode")) | ||
|
||
if (!dedicated && !strstr(commandLine, "-silent_error_mode")) | ||
BT_SetActivityType(BTA_SHOWUI); | ||
else | ||
BT_SetActivityType(BTA_SAVEREPORT); | ||
|
@@ -636,50 +637,23 @@ void xrDebug::SetupExceptionHandler(const bool& dedicated) | |
BT_SetAppName("X-Ray Engine"); | ||
BT_SetReportFormat(BTRF_TEXT); | ||
BT_SetFlags(BTF_DETAILEDMODE | BTF_ATTACHREPORT); | ||
|
||
#ifdef MASTER_GOLD | ||
#ifdef _EDITOR // MASTER_GOLD && EDITOR | ||
auto minidumpFlags = !dedicated ? MiniDumpNoDump : MiniDumpWithDataSegs; | ||
#else // MASTER_GOLD && !EDITOR | ||
auto minidumpFlags = !dedicated ? MiniDumpNoDump : MiniDumpWithDataSegs | MiniDumpWithIndirectlyReferencedMemory; | ||
#endif | ||
auto minidumpFlags = MiniDumpFilterMemory | MiniDumpScanMemory; | ||
|
||
if (strstr(commandLine, "-detailed_minidump")) | ||
minidumpFlags = MiniDumpWithDataSegs | MiniDumpWithIndirectlyReferencedMemory; | ||
#else | ||
#ifdef EDITOR // !MASTER_GOLD && EDITOR | ||
auto minidumpFlags = MiniDumpWithDataSegs; | ||
#else // !MASTER_GOLD && !EDITOR | ||
auto minidumpFlags = MiniDumpWithDataSegs | MiniDumpWithIndirectlyReferencedMemory; | ||
#endif | ||
const auto minidumpFlags = MiniDumpWithDataSegs | MiniDumpWithIndirectlyReferencedMemory; | ||
#endif | ||
|
||
BT_SetDumpType(minidumpFlags); | ||
//BT_SetSupportEMail("[email protected]"); | ||
BT_SetSupportEMail("[email protected]"); | ||
#endif | ||
} | ||
#endif // USE_BUG_TRAP | ||
|
||
#ifdef USE_OWN_MINI_DUMP | ||
void xrDebug::SaveMiniDump(EXCEPTION_POINTERS *exPtrs) | ||
{ | ||
#if defined(WINDOWS) | ||
string64 dateStr; | ||
timestamp(dateStr); | ||
string_path dumpPath; | ||
xr_sprintf(dumpPath, sizeof(dumpPath), "%s_%s_%s.mdmp", Core.ApplicationName, Core.UserName, dateStr); | ||
__try | ||
{ | ||
if (FS.path_exist("$logs$")) | ||
FS.update_path(dumpPath, "$logs$", dumpPath); | ||
} | ||
__except (EXCEPTION_EXECUTE_HANDLER) | ||
{ | ||
string_path temp; | ||
xr_strcpy(temp, dumpPath); | ||
xr_sprintf(dumpPath, sizeof(dumpPath), "logs/%s", temp); | ||
} | ||
WriteMiniDump(MINIDUMP_TYPE(MiniDumpFilterMemory | MiniDumpScanMemory), dumpPath, GetCurrentThreadId(), exPtrs); | ||
#endif | ||
} | ||
#endif | ||
|
||
void xrDebug::FormatLastError(char* buffer, const size_t& bufferSize) | ||
{ | ||
#if defined(WINDOWS) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters