# crashlog.h

Go to the documentation of this file.

    00001 /* $Id: crashlog.h 18855 2010-01-18 10:11:27Z 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
    00049   virtual char *LogCompiler(char *buffer, const char *last) const;
    00050
    00058   virtual char *LogError(char *buffer, const char *last, const char *message) const = 0;
    00059
    00067   virtual char *LogStacktrace(char *buffer, const char *last) const = 0;
    00068
    00076   virtual char *LogRegisters(char *buffer, const char *last) const;
    00077
    00085   virtual char *LogModules(char *buffer, const char *last) const;
    00086
    00087
    00094   char *LogOpenTTDVersion(char *buffer, const char *last) const;
    00095
    00103   char *LogConfiguration(char *buffer, const char *last) const;
    00104
    00111   char *LogLibraries(char *buffer, const char *last) const;
    00112
    00119   char *LogGamelog(char *buffer, const char *last) const;
    00120
    00121 public:
    00123   virtual ~CrashLog() {}
    00124
    00131   char *FillCrashLog(char *buffer, const char *last) const;
    00132
    00142   bool WriteCrashLog(const char *buffer, char *filename, const char *filename_last) const;
    00143
    00153   virtual int WriteCrashDump(char *filename, const char *filename_last) const;
    00154
    00163   bool WriteSavegame(char *filename, const char *filename_last) const;
    00164
    00173   bool WriteScreenshot(char *filename, const char *filename_last) const;
    00174
    00181   bool MakeCrashLog() const;
    00182
    00188   static void InitialiseCrashLog();
    00189
    00194   static void SetErrorMessage(const char *message);
    00195
    00200   static void AfterCrashLogCleanup();
    00201 };
    00202
    00203 #endif /* CRASHLOG_H */