views:

298

answers:

2

MFC application (uses SQLite3.dll for DB access, along with other DLLs for accessing hardware) terminates abnormally. There is no particular sequence of termination :( My application is a

  1. Single threaded Application
  2. Uses exception handling
  3. Uses more than 6 DLLs to access different hardwares
  4. Runs on WinXP SP2

Initially i thought it might be because of Stack Overflow, later i discovered its not. Can someone tell me what are all the general causes for an abnormal program termination? If someone has come across similar problems or has any hints or clues, please pass them on.

Thanks in Advance

+1  A: 

Generally speaking, the general causes of crashes are when you:

  • read memory that isn't yours
  • write memory that isn't yours
  • divide by zero
  • do something inside an interrupt that you shouldn't
  • free() a pointer more than once

Possibly also:

  • have an unhanded exception
  • found a bug in your MFC
  • one of your >6 hardware-access DLLs is doing any of the above
  • You are encountering some kind of hardware fault

Maybe you're passing a bad buffer to one of your hardware DLLs, or are forgetting to lock some memory, or you could even have a version mismatch between the DLLs and their headers.

There are so many choices :P

Seth
A: 

Since this is a run-time issue, I suggest you send debug statements to a log file. Include the function name and perhaps a timestamp. Always flush the output buffer after writing to the file, as this provides better probability that the last line was written to the file before the exception occurs.

Thomas Matthews