OpenTTD
crashlog.h
Go to the documentation of this file.
1 /* $Id: crashlog.h 24900 2013-01-08 22:46:42Z planetmaker $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * 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.
6  * 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.
7  * 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/>.
8  */
9 
12 #ifndef CRASHLOG_H
13 #define CRASHLOG_H
14 
18 class CrashLog {
19 private:
21  static const char *message;
22 
24  static char *gamelog_buffer;
25 
27  static const char *gamelog_last;
28 
29  static void GamelogFillCrashLog(const char *s);
30 protected:
37  virtual char *LogOSVersion(char *buffer, const char *last) const = 0;
38 
45  virtual char *LogCompiler(char *buffer, const char *last) const;
46 
54  virtual char *LogError(char *buffer, const char *last, const char *message) const = 0;
55 
63  virtual char *LogStacktrace(char *buffer, const char *last) const = 0;
64 
72  virtual char *LogRegisters(char *buffer, const char *last) const;
73 
81  virtual char *LogModules(char *buffer, const char *last) const;
82 
83 
84  char *LogOpenTTDVersion(char *buffer, const char *last) const;
85  char *LogConfiguration(char *buffer, const char *last) const;
86  char *LogLibraries(char *buffer, const char *last) const;
87  char *LogGamelog(char *buffer, const char *last) const;
88 
89 public:
91  virtual ~CrashLog() {}
92 
93  char *FillCrashLog(char *buffer, const char *last) const;
94  bool WriteCrashLog(const char *buffer, char *filename, const char *filename_last) const;
95 
105  virtual int WriteCrashDump(char *filename, const char *filename_last) const;
106  bool WriteSavegame(char *filename, const char *filename_last) const;
107  bool WriteScreenshot(char *filename, const char *filename_last) const;
108 
109  bool MakeCrashLog() const;
110 
116  static void InitialiseCrashLog();
117 
118  static void SetErrorMessage(const char *message);
119  static void AfterCrashLogCleanup();
120 };
121 
122 #endif /* CRASHLOG_H */