8

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.

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
JeffR
  • 765
  • 2
  • 8
  • 23
  • 1
    Why not just use a debugger? – Captain Obvlious Feb 13 '14 at 20:35
  • The exe is at a customer's site. – JeffR Feb 13 '14 at 20:36
  • Again, why not just use a debugger? Most have the ability to take you to the code associated with a specific address. – Captain Obvlious Feb 13 '14 at 20:42
  • 1
    Sorry, noob here with no debugging experience unless inside stepping through code in VS! What steps in VS would I use to match the 'Fault offset' with the code? Do I have to send something special to the customer? Do I load something into VS? – JeffR Feb 13 '14 at 21:05
  • And...the exe is a service, so I can't run it from within VS even if the Release version contains debug info. – JeffR Feb 13 '14 at 21:09
  • When you build the EXE check the linker option to generate a map file. – brian beuning Feb 13 '14 at 21:21
  • You can use the dbghelp library to have your program print stack back traces about itself when it crashes. – brian beuning Feb 13 '14 at 21:22
  • You can change your program to generate a dump file on a crash. They send you the dump file and the debugger in your development environment can show you a stack back trace from the EXE and the dump file. – brian beuning Feb 13 '14 at 21:23

1 Answers1

10

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
josh poley
  • 7,236
  • 1
  • 25
  • 25
  • Ok...how would I load the mini dump file into VS to debug it? – JeffR Feb 13 '14 at 21:39
  • So I have the dmp file, I dragged it into VS2012, I attached it to the running service process...now what? – JeffR Feb 14 '14 at 15:38
  • can you tell me What vS2012 steps I would take to do that? – JeffR Feb 27 '14 at 12:25
  • I found that I have to have *all* source code in the Release folder. Then, I have to open it up into VS2012 and hit Run. The program will crash and put me right on the line in my code where it crashed, including variables. Awesome! – JeffR May 12 '14 at 12:32