1. DbgHelp Library Installation
- Copy dbghelp.dll and insert it into the folder (C:\Windows\system32) in which OS has been installed or the current folder of the program.
- dbghelp.dll is in \ProudNet\Sample\Bin (ProudNet installation directory).
2. Visual Studio Compile Option Setting
- Configuration Properties > C/C++ > Code Generation > Enable C++ Exceptions > Select Yes With SEH Exceptions (/EHa)
- Please refer to Compile Setting for Error Dump System for more information.
3. Example of Dump Server Production
- It collects error information dump files that have been received from a dump client.
#include "../../../include/ProudNetServer.h"
#include "../../../include/DumpServer.h"
#include "MyDumpServer.h"
class CMyDumpServer : public IDumpServerDelegate
{
...
virtual void OnStartServer(CStartServerParameter &refParam) override;
void Run();
}
void main(int argc, char* argv[])
{
CMyDumpServer srv;
srv.Run();
}
4. Example of Dump Client Production
- It must be executed as a dump client to send error information in case of crash at both a game server process and a game client process. The dump client generally sends a dump file that contains error information to the dump server.
- If there is a crash at the process, temporary *.DMP dump file will be created and the information of error level will be attached to the Command Argument as the process is executed again. Error level information (that has been attached by Command Argument) should be managed as route processing (route setting) depending on the severity and MiniDumpAction_AlarmCrash is considered as serious error, so you must design the code that sends a dump file to a dump server.
- Production of Dump Client for Game Server
- Code design must be completed as *.DMP dump file is directly sent to a dump server without error report dialog box. It is because a game server does not provide user UI.
- Production of Dump Client for Game Client
- Code design must be completed after checking (with a user) if *.DMP dump file needs to be sent to a dump server with error report dialog box. It is because a game client provides user UI.
- Note
- Dump client is not supported at mobile environment including smartphone.
- You must initialize the dump system by using Proud.CMiniDumpParameter.
- In case of Unicode programming model, you may define wide characters version of main function and argv & envp parameter for wmain function is wchar_t* type.
- In case of MiniDumpAction_AlarmCrash and MiniDumpAction_DoNothing, need to shut down the program by calling return after route processing (route setting). Otherwise, infinite loop might occur.
#include "stdafx.h"
#include <atlpath.h>
#include "../../include/MiniDumper.h"
#include "../../include/DumpCommon.h"
using namespace Proud;
const int _MAX_PATH2 = 8192;
#define _COUNTOF(array) (sizeof(array)/sizeof(array[0]))
void GetDumpFilePath(LPWSTR output)
{
WCHAR path[_MAX_PATH2];
WCHAR drive[_MAX_PATH2];
WCHAR dir[_MAX_PATH2];
WCHAR fname[_MAX_PATH2];
WCHAR ext[_MAX_PATH2];
WCHAR module_file_name[_MAX_PATH2];
GetModuleFileNameW(NULL, module_file_name, _COUNTOF(module_file_name));
_tsplitpath_s(module_file_name, drive, _MAX_PATH2, dir, _MAX_PATH2, fname, _MAX_PATH2, ext, _MAX_PATH2);
_tmakepath_s(path, _MAX_PATH2, drive, dir, L"", L"");
wsprintf(output, L"%s%s.DMP", path, fname);
};
void AccessViolation()
{
int* a = 0;
*a = 1;
}
int main(int argc, char* argv[])
{
int nRetCode = 0;
int *data = 0;
int menu = 0;
WCHAR dumpFileName[_MAX_PATH2] = { 0, };
GetDumpFilePath(dumpFileName);
switch (CMiniDumper::Instance().Startup(parameter))
{
...
return nRetCode;
...
return nRetCode;
default:
...
break;
}
while (1)
{
puts("MENU: 1. Access Violation('a')");
printf("> ");
menu = getchar();
switch (menu)
{
case 'a':
AccessViolation();
break;
default:
break;
}
}
return 0;
}