MiniDump (Error Dump System)
MiniDump (Error Dump System) is a feature provided by ProudNet that allows you to collect error information directly from the developer when a game client or game server crashes while playing an online game service in order to track the cause and take quick action.
Error information is collected in a *.DMP file, and developers can open the collected dump file in a development tool (such as Visual Studio) to see on which lines of the source file the crash occurred.
Tutorial on building an error dump system
The Building an Error Dump System tutorial included a game server and client.
(1) Install the DbgHelp library
Copy dbghelp.dll to the folder where your OS is installed (C:\Windows\system32) or to the program's current folder. dbghelp.dll is located in (ProudNet installation path)\ProudNet\Sample\Bin.
(2) Setting Visual Studio Compilation Options
For MiniDump (Error Dump System), you need to configure C++ compilation as below.
For Visual Studio 2003, you cannot set it as above, so you need to select 'No' and add /EHa in Configuration Properties -> C/C++ -> Command Line -> Additional Options.
(3) Example of creating a dump server
Responsible for collecting error information dump files sent by the dump client.
(4) Example of creating a dump client
The dump client is responsible for sending dump files containing error information to the dump server.
If the process crashes, a temporary *.DMP dump file is automatically created and the error level information is attached to the Command Argument as the process runs again.
The error level information received as a command argument must be branched according to its severity, and in the case of MiniDumpAction_AlarmCrash, it is a critical error, so you must write code to send the dump file to the dump server.
(5) Creating a Dump Client for a Game Server
Since game servers typically do not provide a user UI, you will need to write code to send the *.DMP dump file directly to the dump server without popping up an error reporting dialog.
(6) Creating a Dump Client for Game Clients
Game clients typically have a user UI, so you will need to write code to prompt the game user if they want to send the generated *.DMP dump file to the dump server with an error report or skip it before proceeding.
Caution
We do not support dump clients on all mobile environments.
You must initialize the dump system using Proud.CMiniDumpParameter.
For the Unicode programming model, you can define a wide-character version of the main function, where the argv and envp parameters to the wmain function must use the wchar_t* format.
For MiniDumpAction_AlarmCrash, MiniDumpAction_DoNothing, you must terminate the program after branching because you can get stuck in an infinite loop by calling return.
Utilize an error dump system
- Intercepting C Runtime Errors from the Error Dump System
Out-of-range errors in the STL or errors where a purely virtual function is called at runtime are not detected by the error dump system by default.
The error dump system only handles Structured Exceptions, because these errors are digested by the C runtime library. Therefore, you must divert them to Structured Exceptions before they can be digested by the C runtime library to leave an error dump.
Below is how to leave an error dump.
- Uninterrupted error dump system(Exception Logger)
ProudNet provides a feature that, when an error occurs in a program, continues to log the location of the error without terminating the program. This is called a uninterrupted error dump system(Exception Logger).
A typical game server will immediately dump the situation and restart the program when it crashes, but in some cases it may be necessary to force the game server to stay up and running without restarting the program.
However, it is dangerous to continue running a server program that has already corrupted its memory state.
Checklist for creating a uninterrupted error dump system
You need to install the DbgHelp library (dbghelp.dll).
You need to set the C++ Exception compilation option in Visual Studio.
Include : DumpCommon.h, MiniDumper.h
Link : ProudNetCommon.lib
Production examples
Make sure to initialize the CExceptionLogger instance by calling the CExceptionLogger::Instance().Init() function at the Main Entry Point of the program. Define the path to the dump file by inheriting from the IExceptionLoggerDelegate abstract class and overriding the GetDumpDirectory() member. If it returns a blank (""), the dumpfile is saved in the current folder.
Works on Windows XP and Windows 2003 Server or later versions of the operating system. If you mix the CExceptionLogger class with ATLTRACE() or OutputDebugString(), the load of log entries can degrade program performance.
The source files for this example are located in <install folder>\Sample\SimpleExceptionLogger.
The SimpleExceptionLogger example is not supported since version 1.7.33863.
- Leave a dump file of the current state of the process
It has the ability to leave a dump file of the current state of the process, even if it is not in an error situation, which can be opened along with the debug information file (.pdb) that was generated when the program that it dumped was built, to see what the process was doing at the source level.
This feature allows you to leave a dump of the current state of the process, even in difficult debugging environments. Calling Proud.CMiniDumper.WriteDumpFromHere saves the call stack of all threads in the process at the time of the call to a dump file.
Last updated