First-chance exception & Second-chance exception

在调试器中运行程序时,如果程序产生异常,调试器会首先获得通知(即First-chance exception),而后此异常由产生它的程序负责捕获。
如果程序没有捕获并处理此异常,那么调试器会再次被通知(即Second-chance exception,Last-chance exception),并结束程序。
通常见到的“First-chance exception”一般是“0xC0000005: Access Violation”,“0xC00000FD: Stack Overflow”等,这些都说明程序中有缺陷,需要修正
http://niernocry.blog.163.com/blog/static/1545292020071015105559513/

First-chance exception

What is a first chance exception?
When an application is being debugged, the debugger gets notified whenever an exception is encountered.
At this point, the application is suspended and the debugger decides how to handle the exception.
The first pass through this mechanism is called a "first chance" exception. Depending on the debugger's configuration, it will either resume the application and pass the exception on or it will leave the application suspended and enter debug mode.
If the application handles the exception, it continues to run normally.

如果程序遇到异常,首先会被"first chance" exception这种机制来捕获和进行后续处理,如果程序处理了异常,即可进行正常运行。

Second-chance exception

If the application does not handle the exception, the debugger is re-notified. This is known as a "second chance" exception. The debugger again suspends the application and determines how to handle this exception. Typically, debuggers are configured to stop on second chance (unhandled) exceptions and debug mode is entered, allowing you to debug.

如果捕获到异常后,程序没有进行处理,这时候的叫做"second chance" exception。程序会再次暂停,并决定去如何去处理这个异常。

示意图

示意图

References:

http://niernocry.blog.163.com/blog/static/1545292020071015105559513/
http://blog.csdn.net/m_star_jy_sy/article/details/5578998
http://blog.163.com/cp7618%40yeah/blog/static/702347772010226112255101/

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 9,921评论 0 23
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,973评论 19 139
  • 已经同步到gitbook,想阅读的请转到gitbook: Django 1.10 中文文档 URL dispatc...
    leyu阅读 14,257评论 0 16
  • 图文无关。 开始重读红楼。 曹公一开头便写宝钗病,可卿病,可卿死,写李贵,茗烟,磺大奶奶,金荣,薛蟠的龙阳之兴,宝...
    Tantalusqualenj阅读 242评论 0 0
  • 参考:内存缓存LruCache实现原理Android中图片的三级缓存策略Android官方教程:保存到文件andr...
    TTTqiu阅读 190评论 0 0