异常处理之不要放过First-chance exception

引自:https://blog.csdn.net/m_star_jy_sy/article/details/5578998

不要放过First-chance exception

1)什么是First-chance exception
 VC6调试环境下(debug)运行程序时,经常在output窗口看到有
 First-chance exception in hotfoxd.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
 的输出字样。
 当调试程序时,若引发了异常,那么调试器会得到通知,应用程序被挂起,由调试器决定如何来处理这个异常。而VC6调试器debug下对异常的默认处理为Stop if no handled,
 即异常未处理(捕获)时才停止。如果异常被程序捕获(try...catch...),那么调试器不会中断程序,而是继续运行,并在Output窗口输出First-chance exception字样。

2)怎么解决First-chance exception
 First-chance exception的输出表示程序产生了异常并被捕获了。对于异常在调试阶段应该尽可能解决掉,不让其出现异常。当然有些异常是预期的,有些异常是非预期的。
 例如,ado的查询语句,如果语句非法,则ado会报出异常。虽然有异常捕获,程序能继续运行,但这种错误明显的是需要解决的。 
 对于一个高可用服务器而言,要求7×24小时的连续运行,如果异常频繁出现,则会影响到服务器的持久运行能力。
 所以,在程序发布之前,过一遍First-chance exception是很有必要的。
 VC6能够修改调试器的默认行为(Stop if no handled),改为Stop always。通过[Debug/Exceptions]菜单。
 

这样,当出现异常时,即便是有异常捕获,也会弹出提示对话框,并停在异常代码处。

 改为Stop always后,查出几个供应包平台后台线程扫描数据库的几个sql语句不对的bug。这样的异常在后台线程频繁抛出,想必对服务器有些影响。
 

3)调试器还能对其他异常作出停止处理
 Stack Overflow exception
 Access Violation exception
 等。
 在程序发布前,建议对这些异常过一遍。

 

As an AI language model, I do not have access to your system's context or logs to provide a specific solution to your issue. However, I can provide general information about the error message you have reported. A "break instruction exception" is a type of software exception that occurs when the CPU encounters a breakpoint instruction in the code. This instruction is typically inserted by developers during debugging to halt the program execution at a specific point so that they can inspect the program state and variables. The code "80000003" is a hexadecimal representation of the exception code, which indicates the type of exception that occurred. In this case, it is a first chance exception, which means that the exception was caught by the debugger before it caused any harm to the program. To troubleshoot this error, you can try the following steps: 1. Check if any debugging tools or breakpoints are active in your code. If yes, disable them and see if the error still occurs. 2. Check if any third-party software or drivers are interfering with your program's execution. You can try disabling them one by one and see if the error goes away. 3. If the error persists, you may need to analyze the program's code and identify the specific instruction that is causing the exception. You can use a debugger or a code analysis tool for this purpose. 4. Once you have identified the problematic instruction, you can try fixing the code or updating any related libraries or dependencies. It is recommended to seek assistance from a qualified professional or the software vendor in case you are not comfortable with the above steps.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值