简体   繁体   English

什么会导致程序异常终止?

[英]What can cause an abnormal program termination?

MFC application (uses SQLite3.dll for DB access, along with other DLLs for accessing hardware) terminates abnormally. MFC应用程序(使用SQLite3.dll进行数据库访问,以及使用其他DLL访问硬件)异常终止。 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 使用超过6个DLL来访问不同的硬件
  4. Runs on WinXP SP2 在WinXP SP2上运行

Initially i thought it might be because of Stack Overflow , later i discovered its not. 最初我以为可能是因为Stack Overflow ,后来才发现不是。 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 提前致谢

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 free()一个指针不止一次

Possibly also: 可能还会:

  • have an unhanded exception 有一个异常的异常
  • found a bug in your MFC 在您的MFC中发现错误
  • one of your >6 hardware-access DLLs is doing any of the above 您的> 6个硬件访问DLL中的一个正在执行上述任一操作
  • 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. 也许您正在向一个硬件DLL传递错误的缓冲区,或者忘记了锁定某些内存,或者甚至在DLL及其标头之间存在版本不匹配的情况。

There are so many choices :P :P有太多选择

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. 写入文件后,请始终刷新输出缓冲区,因为这样可以更有可能在发生异常之前将最后一行写入文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 TRESTClient 关机时程序异常终止 - Abnormal program termination on shutdown with TRESTClient 程序的(三角形旋转)异常终止 - program's(rotation of triangle) abnormal termination MessageBox“异常程序终止”使我的应用程序保持运行 - MessageBox “Abnormal program termination” keeps my application running 即使异常终止,如何确保调用UnhookWindowsHookEx? - How can I ensure that UnhookWindowsHookEx is called even upon abnormal termination? 我的程序中出现 segsigv 错误的原因是什么? - what can be the cause of segsigv error in my program? 在C ++中的向量中使用向量时,异常程序终止错误访问元素 - Abnormal program termination error accessing elements while using vector inside a vector in c++ 调用cvCreateCameraCapture(-1)时异常终止 - Abnormal termination when calling `cvCreateCameraCapture(-1)` 执行levelOrder函数时,我无法弄清楚异常终止的原因吗? - I can't figure out the reason for abnormal termination while executing levelOrder function? 在这个非常简单的程序中,什么会导致“信号 SIGABRT”错误? - What can cause a 'signal SIGABRT' fault in this really simple program? 正常终止和异常终止之间的区别C ++ - Difference between normal and abnormal termination C++
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM