Minidump Modcomp

ls612

Deity
Moderator
Joined
Mar 10, 2008
Messages
8,278
Location
America
This is something I adapted for my own CiV mod development from my previous projects. In Civ 4 there was a modcomp which would create crash dumps when something went wrong, allowing for debugging of non-repeatable crashes in many instances. I've adapted the code for that and added it to the Gods & Kings DLL.

How to Use:

If you are doing DLL modding hopefully you will know what a crash dump is and how it is useful. The source changes are included in the download, and are all commented as part of the Minidump modcomp. To include this in your mod just merge the code with yours (it is quite localized), and compile. Then when the game crashes, it will create a crash dump named CvMiniDump.dmp in the same folder as the CiV EXE. To read the dump place it in the same folder as your custom DLL and it's debug database, and open it in Visual Studio. Then click the start debugging button and it will allow you to see what went wrong if it happened in the DLL.

Download

Credits:

terkhen, who originally wrote this for Civ 4.
 
I've rolled this into the next build (v19) of my Pick'N'Mix DLL, so it will be interesting to see if it helps with the occasional "random" crashes that get reported.
 
I've rolled this into the next build (v19) of my Pick'N'Mix DLL, so it will be interesting to see if it helps with the occasional "random" crashes that get reported.

From my experience working on a large civ 4 mod project with this it is insanely helpful in helping those with non-repeatable crashes. Many random crashes are in my experience localized code assuming things it shouldn't, which this will help find.
 
Any ideas what would cause Civ 5 to crash so badly/quickly that the mini-dump file gets created but with no content? (ie it's a zero byte file)
 
In case anybody else hits the same "insta-crash" issue, mine was caused by a recursive routine filling the stack, which presumably meant that the mini-dump code had no stack space to operate on.
 
Any ideas what would cause Civ 5 to crash so badly/quickly that the mini-dump file gets created but with no content? (ie it's a zero byte file)

In case anybody else hits the same "insta-crash" issue, mine was caused by a recursive routine filling the stack, which presumably meant that the mini-dump code had no stack space to operate on.

That sounds right to me. The only reason it should be empty is if it has nowhere to write to (which could be caused by a stack overflow or by simply running out of memory in the 32 bit address space), but if the crash is repeatable you can still pin it down in the VS live debugger.
 
Passing an invalid query as the second parameter into CvDatabaseUtility::PrepareResults() will generate useless info in the dump file, as all it shows is "RaiseException" from the main .exe file ... you really can't beat lots of print statements ;)
 
Passing an invalid query as the second parameter into CvDatabaseUtility::PrepareResults() will generate useless info in the dump file, as all it shows is "RaiseException" from the main .exe file ... you really can't beat lots of print statements ;)

Yes, it isn't perfect, as we only have the symbols for the gamecoreDLL some things that involve crashes outside of that will be useless. Using the built-in logging system helps, as does live debugging, which is what you should always do if you are running the mod locally. Minidumps are as I said primarily useful when a user is experiencing a crash and you can't repeat it.

Also, you can edit some source files (or project configs) to build a DLL with the CvAssert system enabled, and then use that to make sure all queries are valid.
 
I am getting a CTD with my mod. I have not done any DLL modding but am using a downloaded dll.

The crash is generating a CivMiniDump.dmp file.

Is this file only generatable by Dlls with your modification... will the base game not generate one?

In which case, will such files only be generated by errors due to Dll alterations or can altered Dlls generate dump files even though the crash occurred due to the Firaxis part of the code.

I really know nothing about this sort of thing... I've attached the file to another post at:

HTML:
http://forums.civfanatics.com/showthread.php?t=519310

Any assistance would be appreciated.

BTW The Dll is DLL-Various Mod Components (I'm assuming William Howard is watching this thread and might respond if he thinks it may be his Dll causing the crash).

Thank-you.
 
I am getting a CTD with my mod. I have not done any DLL modding but am using a downloaded dll.

The crash is generating a CivMiniDump.dmp file.

Is this file only generatable by Dlls with your modification... will the base game not generate one?

In which case, will such files only be generated by errors due to Dll alterations or can altered Dlls generate dump files even though the crash occurred due to the Firaxis part of the code.

I really know nothing about this sort of thing... I've attached the file to another post at:

HTML:
http://forums.civfanatics.com/showthread.php?t=519310

Any assistance would be appreciated.

BTW The Dll is DLL-Various Mod Components (I'm assuming William Howard is watching this thread and might respond if he thinks it may be his Dll causing the crash).

Thank-you.

Any crashes will almost certainly be from a custom DLL, or something else wrong with the mod. Whoward would be the best person to debug it, as he maintains the DLL modcomps.

I'm not certain if the base game creates dumps when it crashes, but if it does that would be overriden by my dump code.
 
Back
Top Bottom