Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make my code creating dump file before crash?

I have some code in C# and C++ ( in one project ). This code have some crash and i trying t find it. but this crash is not reproduce any time - and i can't find it.

I want to configure the code / the windows OS to create dump file on the crash.

the limitation that i have are ... I have limited access to the machine that this crash reproduce on - this is not developing machine .. this is testing Lab machine

So, How to do it ? How can i change the properties in the solution that a new dump file will created on any crash?

(the aim is to be able to analyze the dump in the windbg tool)

like image 588
Yanshof Avatar asked Apr 10 '12 11:04

Yanshof


People also ask

How do you do a crash dump analysis?

In order for DSS or CCS to analyze the crash dump, the data must first be converted to a format that the debugger understands. At this time there is only one available format, however, since it is text-based, it should not be difficult to write a small script that convert datas from any format into this format.


3 Answers

You can register an unhandled exception filter and PInvoke MiniDumpWriteDump. A code sample to do that is located here

like image 128
John Avatar answered Oct 09 '22 15:10

John


You can enable saving dumps on vista in the registry:

  1. Open RegEdit
  2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting
  3. Under Windows Error Reporting, create a new registry key named LocalDumps.
like image 32
Peter Avatar answered Oct 09 '22 14:10

Peter


I find it easier to use ProcDump. Try the -e (create dump on unhandled exceptions), -ma (w/ full process memory), and -t (create dump on app termination) options.

like image 31
Ilian Avatar answered Oct 09 '22 16:10

Ilian