Merge branch 'crashlog_improvements' into jgrpp
This commit is contained in:
@@ -352,6 +352,14 @@ char *CrashLog::FillCrashLog(char *buffer, const char *last) const
|
|||||||
{
|
{
|
||||||
time_t cur_time = time(NULL);
|
time_t cur_time = time(NULL);
|
||||||
buffer += seprintf(buffer, last, "*** OpenTTD Crash Report ***\n\n");
|
buffer += seprintf(buffer, last, "*** OpenTTD Crash Report ***\n\n");
|
||||||
|
|
||||||
|
if (GamelogTestEmergency()) {
|
||||||
|
buffer += seprintf(buffer, last, "-=-=- As you loaded an emergency savegame no crash information would ordinarily be generated. -=-=-\n\n");
|
||||||
|
}
|
||||||
|
if (SaveloadCrashWithMissingNewGRFs()) {
|
||||||
|
buffer += seprintf(buffer, last, "-=-=- As you loaded a savegame for which you do not have the required NewGRFs no crash information would ordinarily be generated. -=-=-\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
buffer += seprintf(buffer, last, "Crash at: %s", asctime(gmtime(&cur_time)));
|
buffer += seprintf(buffer, last, "Crash at: %s", asctime(gmtime(&cur_time)));
|
||||||
|
|
||||||
YearMonthDay ymd;
|
YearMonthDay ymd;
|
||||||
@@ -536,6 +544,22 @@ bool CrashLog::MakeCrashLog() const
|
|||||||
if (VideoDriver::GetInstance() != NULL) VideoDriver::GetInstance()->Stop();
|
if (VideoDriver::GetInstance() != NULL) VideoDriver::GetInstance()->Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */ const char *CrashLog::GetAbortCrashlogReason()
|
||||||
|
{
|
||||||
|
if (_settings_client.gui.developer > 0) return NULL;
|
||||||
|
|
||||||
|
if (GamelogTestEmergency()) {
|
||||||
|
return "As you loaded an emergency savegame no crash information will be generated.\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SaveloadCrashWithMissingNewGRFs()) {
|
||||||
|
return "As you loaded an savegame for which you do not have the required NewGRFs\n" \
|
||||||
|
"no crash information will be generated.\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(WITH_BFD)
|
#if defined(WITH_BFD)
|
||||||
sym_info_bfd::sym_info_bfd(bfd_vma addr_) : addr(addr_), abfd(NULL), syms(NULL), sym_count(0),
|
sym_info_bfd::sym_info_bfd(bfd_vma addr_) : addr(addr_), abfd(NULL), syms(NULL), sym_count(0),
|
||||||
file_name(NULL), function_name(NULL), function_addr(0), line(0), found(false) {}
|
file_name(NULL), function_name(NULL), function_addr(0), line(0), found(false) {}
|
||||||
|
@@ -138,6 +138,8 @@ public:
|
|||||||
static void AfterCrashLogCleanup();
|
static void AfterCrashLogCleanup();
|
||||||
|
|
||||||
inline const char *GetMessage() const { return this->message; }
|
inline const char *GetMessage() const { return this->message; }
|
||||||
|
|
||||||
|
static const char *GetAbortCrashlogReason();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CRASHLOG_H */
|
#endif /* CRASHLOG_H */
|
||||||
|
@@ -226,16 +226,10 @@ void CDECL HandleCrash(int signum)
|
|||||||
signal(*i, SIG_DFL);
|
signal(*i, SIG_DFL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GamelogTestEmergency()) {
|
const char *abort_reason = CrashLog::GetAbortCrashlogReason();
|
||||||
|
if (abort_reason != NULL) {
|
||||||
ShowMacDialog("A serious fault condition occurred in the game. The game will shut down.",
|
ShowMacDialog("A serious fault condition occurred in the game. The game will shut down.",
|
||||||
"As you loaded an emergency savegame no crash information will be generated.\n",
|
abort_reason,
|
||||||
"Quit");
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SaveloadCrashWithMissingNewGRFs()) {
|
|
||||||
ShowMacDialog("A serious fault condition occurred in the game. The game will shut down.",
|
|
||||||
"As you loaded an savegame for which you do not have the required NewGRFs no crash information will be generated.\n",
|
|
||||||
"Quit");
|
"Quit");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
@@ -565,16 +565,10 @@ static void CDECL HandleCrash(int signum)
|
|||||||
signal(*i, SIG_DFL);
|
signal(*i, SIG_DFL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GamelogTestEmergency()) {
|
const char *abort_reason = CrashLog::GetAbortCrashlogReason();
|
||||||
|
if (abort_reason != NULL) {
|
||||||
printf("A serious fault condition occurred in the game. The game will shut down.\n");
|
printf("A serious fault condition occurred in the game. The game will shut down.\n");
|
||||||
printf("As you loaded an emergency savegame no crash information will be generated.\n");
|
printf(abort_reason);
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SaveloadCrashWithMissingNewGRFs()) {
|
|
||||||
printf("A serious fault condition occurred in the game. The game will shut down.\n");
|
|
||||||
printf("As you loaded an savegame for which you do not have the required NewGRFs\n");
|
|
||||||
printf("no crash information will be generated.\n");
|
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -540,23 +540,15 @@ static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
|
|||||||
ExitProcess(2);
|
ExitProcess(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GamelogTestEmergency()) {
|
const char *abort_reason = CrashLog::GetAbortCrashlogReason();
|
||||||
static const TCHAR _emergency_crash[] =
|
if (abort_reason != NULL) {
|
||||||
_T("A serious fault condition occurred in the game. The game will shut down.\n")
|
TCHAR _emergency_crash[512];
|
||||||
_T("As you loaded an emergency savegame no crash information will be generated.\n");
|
_sntprintf(_emergency_crash, lengthof(_emergency_crash),
|
||||||
|
_T("A serious fault condition occurred in the game. The game will shut down.\n"), OTTD2FS(abort_reason));
|
||||||
MessageBox(NULL, _emergency_crash, _T("Fatal Application Failure"), MB_ICONERROR);
|
MessageBox(NULL, _emergency_crash, _T("Fatal Application Failure"), MB_ICONERROR);
|
||||||
ExitProcess(3);
|
ExitProcess(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SaveloadCrashWithMissingNewGRFs()) {
|
|
||||||
static const TCHAR _saveload_crash[] =
|
|
||||||
_T("A serious fault condition occurred in the game. The game will shut down.\n")
|
|
||||||
_T("As you loaded an savegame for which you do not have the required NewGRFs\n")
|
|
||||||
_T("no crash information will be generated.\n");
|
|
||||||
MessageBox(NULL, _saveload_crash, _T("Fatal Application Failure"), MB_ICONERROR);
|
|
||||||
ExitProcess(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
CrashLogWindows *log = new CrashLogWindows(ep);
|
CrashLogWindows *log = new CrashLogWindows(ep);
|
||||||
CrashLogWindows::current = log;
|
CrashLogWindows::current = log;
|
||||||
char *buf = log->FillCrashLog(log->crashlog, lastof(log->crashlog));
|
char *buf = log->FillCrashLog(log->crashlog, lastof(log->crashlog));
|
||||||
|
Reference in New Issue
Block a user