OpenTTD Source: CrashLogWindows Class Reference

OpenTTD Source 1.11.0-RC1

Public Member Functions | Data Fields | Static Public Attributes | Private Member Functions | Private Attributes
CrashLogWindows Class Reference

Windows implementation for the crash logger. More...

Inheritance diagram for CrashLogWindows:

## Public Member Functions
char * | AppendDecodedStacktrace (char *buffer, const char *last) const
| CrashLogWindows (EXCEPTION_POINTERS *ep=nullptr)
| A crash log is always generated when it's generated. More...
Public Member Functions inherited from CrashLog
virtual | ~CrashLog ()
| Stub destructor to silence some compilers.
char * | FillCrashLog (char *buffer, const char *last) const
| Fill the crash log buffer with all data of a crash log. More...
bool | WriteCrashLog (const char *buffer, char *filename, const char *filename_last) const
| Write the crash log to a file. More...
virtual int | WriteCrashDump (char *filename, const char *filename_last) const
| Write the (crash) dump to a file. More...
bool | WriteSavegame (char *filename, const char *filename_last) const
| Write the (crash) savegame to a file. More...
bool | WriteScreenshot (char *filename, const char *filename_last) const
| Write the (crash) screenshot to a file. More...
bool | MakeCrashLog () const
| Makes the crash log, writes it to a file and then subsequently tries to make a crash dump and crash savegame. More...

## Data Fields
char | crashlog [65536]
| Buffer for the generated crash log.
char | crashlog_filename [MAX_PATH]
| Buffer for the filename of the crash log.
char | crashdump_filename [MAX_PATH]
| Buffer for the filename of the crash dump.
char | screenshot_filename [MAX_PATH]
| Buffer for the filename of the crash screenshot.

## Static Public Attributes
static CrashLogWindows * | current = nullptr
| Points to the current crash log.

## Private Member Functions
char * | LogOSVersion (char *buffer, const char *last) const override
| Writes OS' version to the buffer. More...
char * | LogError (char *buffer, const char *last, const char *message) const override
| Writes actually encountered error to the buffer. More...
char * | LogStacktrace (char *buffer, const char *last) const override
| Writes the stack trace to the buffer, if there is information about it available. More...
char * | LogRegisters (char *buffer, const char *last) const override
| Writes information about the data in the registers, if there is information about it available. More...
char * | LogModules (char *buffer, const char *last) const override
| Writes the dynamically linked libraries/modules to the buffer, if there is information about it available. More...

## Private Attributes
EXCEPTION_POINTERS * | ep
| Information about the encountered exception.

## Additional Inherited Members
Static Public Member Functions inherited from CrashLog
static void | InitialiseCrashLog ()
| Initialiser for crash logs; do the appropriate things so crashes are handled by our crash handler instead of returning straight to the OS. More...
static void | InitThread ()
| Prepare crash log handler for a newly started thread. More...
static void | SetErrorMessage (const char *message)
| Sets a message for the error message handler. More...
static void | AfterCrashLogCleanup ()
| Try to close the sound/video stuff so it doesn't keep lingering around incorrect video states or so, e.g. More...
Protected Member Functions inherited from CrashLog
virtual char * | LogCompiler (char *buffer, const char *last) const
| Writes compiler (and its version, if available) to the buffer. More...
char * | LogOpenTTDVersion (char *buffer, const char *last) const
| Writes OpenTTD's version to the buffer. More...
char * | LogConfiguration (char *buffer, const char *last) const
| Writes the (important) configuration settings to the buffer. More...
char * | LogLibraries (char *buffer, const char *last) const
| Writes information (versions) of the used libraries. More...
char * | LogGamelog (char *buffer, const char *last) const
| Writes the gamelog data to the buffer. More...
char * | LogRecentNews (char *buffer, const char *list) const
| Writes up to 32 recent news messages to the buffer, with the most recent first. More...

## Detailed Description

Windows implementation for the crash logger.

Definition at line 38 of file crashlog_win.cpp.

## Constructor & Destructor Documentation

## ◆ CrashLogWindows()

CrashLogWindows::CrashLogWindows | ( | EXCEPTION_POINTERS * | ep = `nullptr` | ) |
| inline

A crash log is always generated when it's generated.

Parameters

  ep | the data related to the exception.

Definition at line 68 of file crashlog_win.cpp.

## Member Function Documentation

## ◆ LogError()

char * CrashLogWindows::LogError | ( | char * | buffer,
|  | const char * | last,
|  | const char * | message
| ) |  | const
| overrideprivatevirtual

Writes actually encountered error to the buffer.

Parameters

  buffer | The begin where to write at.
  last | The last position in the buffer to write to.
  message | Message passed to use for possible errors. Can be nullptr.

Returns
  the position of the `'\0'` character after the buffer.

Implements CrashLog.

Definition at line 103 of file crashlog_win.cpp.

References ep, CrashLog::message, and seprintf().

## ◆ LogModules()

char * CrashLogWindows::LogModules | ( | char * | buffer,
|  | const char * | last
| ) |  | const
| overrideprivatevirtual

Writes the dynamically linked libraries/modules to the buffer, if there is information about it available.

Parameters

  buffer | The begin where to write at.
  last | The last position in the buffer to write to.

Returns
  the position of the `'\0'` character after the buffer.

Reimplemented from CrashLog.

Definition at line 206 of file crashlog_win.cpp.

## ◆ LogOSVersion()

char * CrashLogWindows::LogOSVersion | ( | char * | buffer,
|  | const char * | last
| ) |  | const
| overrideprivatevirtual

Writes OS' version to the buffer.

Parameters

  buffer | The begin where to write at.
  last | The last position in the buffer to write to.

Returns
  the position of the `'\0'` character after the buffer.

Implements CrashLog.

Definition at line 85 of file crashlog_win.cpp.

References seprintf().

## ◆ LogRegisters()

char * CrashLogWindows::LogRegisters | ( | char * | buffer,
|  | const char * | last
| ) |  | const
| overrideprivatevirtual

Writes information about the data in the registers, if there is information about it available.

Parameters

  buffer | The begin where to write at.
  last | The last position in the buffer to write to.

Returns
  the position of the `'\0'` character after the buffer.

Reimplemented from CrashLog.

Definition at line 234 of file crashlog_win.cpp.

References ep, and seprintf().

## ◆ LogStacktrace()

char * CrashLogWindows::LogStacktrace | ( | char * | buffer,
|  | const char * | last
| ) |  | const
| overrideprivatevirtual

Writes the stack trace to the buffer, if there is information about it available.

Parameters

  buffer | The begin where to write at.
  last | The last position in the buffer to write to.

Returns
  the position of the `'\0'` character after the buffer.

Implements CrashLog.

Definition at line 342 of file crashlog_win.cpp.

References ep, and seprintf().

The documentation for this class was generated from the following file:

- src/os/windows/crashlog_win.cpp