# crashlog.h

Go to the documentation of this file.

    00001 /* $Id: crashlog.h 24900 2013-01-08 22:46:42Z planetmaker $ */
    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
    00029   static void GamelogFillCrashLog(const char *s);
    00030 protected:
    00037   virtual char *LogOSVersion(char *buffer, const char *last) const = 0;
    00038
    00045   virtual char *LogCompiler(char *buffer, const char *last) const;
    00046
    00054   virtual char *LogError(char *buffer, const char *last, const char *message) const = 0;
    00055
    00063   virtual char *LogStacktrace(char *buffer, const char *last) const = 0;
    00064
    00072   virtual char *LogRegisters(char *buffer, const char *last) const;
    00073
    00081   virtual char *LogModules(char *buffer, const char *last) const;
    00082
    00083
    00084   char *LogOpenTTDVersion(char *buffer, const char *last) const;
    00085   char *LogConfiguration(char *buffer, const char *last) const;
    00086   char *LogLibraries(char *buffer, const char *last) const;
    00087   char *LogGamelog(char *buffer, const char *last) const;
    00088
    00089 public:
    00091   virtual ~CrashLog() {}
    00092
    00093   char *FillCrashLog(char *buffer, const char *last) const;
    00094   bool WriteCrashLog(const char *buffer, char *filename, const char *filename_last) const;
    00095
    00105   virtual int WriteCrashDump(char *filename, const char *filename_last) const;
    00106   bool WriteSavegame(char *filename, const char *filename_last) const;
    00107   bool WriteScreenshot(char *filename, const char *filename_last) const;
    00108
    00109   bool MakeCrashLog() const;
    00110
    00116   static void InitialiseCrashLog();
    00117
    00118   static void SetErrorMessage(const char *message);
    00119   static void AfterCrashLogCleanup();
    00120 };
    00121
    00122 #endif /* CRASHLOG_H */