How to match a crash's "Fault offset" to the source code?

JeffR picture JeffR · Feb 13, 2014 · Viewed 9.3k times · Source

An EXE I compiled keeps crashing. I have the following info in the Event Viewer when it crashes:

Exception code: 0xc0000008
Fault offset: 0x00000000000cb8e8

How do I match the "Fault offset" with my C++ code? There is a .PDB file in the Release folder, just not sure what steps to figure this out.

Answer

josh poley picture josh poley · Feb 13, 2014

You also need to know what module the offset belongs too, if you are getting 0xC0000008 (STATUS_INVALID_HANDLE), then the exception is likely thrown from ntdll.dll, which isn't going to help you debug your program, since what you care about is deeper in the stack.

What you should be doing is have your customer enable LocalDumps, and then send you a minidump file which you can debug.

Sample registry setup:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps]
"DumpFolder"="d:\\miniDumps"
"DumpType"=dword:00000002
"CustomDumpFlags"=dword:00001124