# crashlog.h

Go to the documentation of this file.

    00001 /* $Id: crashlog.h 18156 2009-11-17 23:12:42Z smatz $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef CRASHLOG_H
    00013 #define CRASHLOG_H
    00014
    00018 class CrashLog {
    00019 private:
    00021   static const char *message;
    00022
    00024   static char *gamelog_buffer;
    00025
    00027   static const char *gamelog_last;
    00028
    00033   static void GamelogFillCrashLog(const char *s);
    00034 protected:
    00041   virtual char *LogOSVersion(char *buffer, const char *last) const = 0;
    00042
    00050   virtual char *LogError(char *buffer, const char *last, const char *message) const = 0;
    00051
    00059   virtual char *LogStacktrace(char *buffer, const char *last) const = 0;
    00060
    00068   virtual char *LogRegisters(char *buffer, const char *last) const;
    00069
    00077   virtual char *LogModules(char *buffer, const char *last) const;
    00078
    00079
    00086   char *LogOpenTTDVersion(char *buffer, const char *last) const;
    00087
    00095   char *LogConfiguration(char *buffer, const char *last) const;
    00096
    00103   char *LogLibraries(char *buffer, const char *last) const;
    00104
    00111   char *LogGamelog(char *buffer, const char *last) const;
    00112
    00113 public:
    00115   virtual ~CrashLog() {}
    00116
    00123   char *FillCrashLog(char *buffer, const char *last) const;
    00124
    00134   bool WriteCrashLog(const char *buffer, char *filename, const char *filename_last) const;
    00135
    00145   virtual int WriteCrashDump(char *filename, const char *filename_last) const;
    00146
    00155   bool WriteSavegame(char *filename, const char *filename_last) const;
    00156
    00165   bool WriteScreenshot(char *filename, const char *filename_last) const;
    00166
    00173   bool MakeCrashLog() const;
    00174
    00180   static void InitialiseCrashLog();
    00181
    00186   static void SetErrorMessage(const char *message);
    00187
    00192   static void AfterCrashLogCleanup();
    00193 };
    00194
    00195 #endif /* CRASHLOG_H */