First-chance exception & Second-chance exception

在調(diào)試器中運(yùn)行程序時(shí),如果程序產(chǎn)生異常,調(diào)試器會(huì)首先獲得通知(即First-chance exception),而后此異常由產(chǎn)生它的程序負(fù)責(zé)捕獲。
如果程序沒(méi)有捕獲并處理此異常,那么調(diào)試器會(huì)再次被通知(即Second-chance exception,Last-chance exception),并結(jié)束程序。
通常見(jiàn)到的“First-chance exception”一般是“0xC0000005: Access Violation”,“0xC00000FD: Stack Overflow”等,這些都說(shuō)明程序中有缺陷,需要修正。
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.

如果程序遇到異常,首先會(huì)被"first chance" exception這種機(jī)制來(lái)捕獲和進(jìn)行后續(xù)處理,如果程序處理了異常,即可進(jìn)行正常運(yùn)行。

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.

如果捕獲到異常后,程序沒(méi)有進(jìn)行處理,這時(shí)候的叫做"second chance" exception。程序會(huì)再次暫停,并決定去如何去處理這個(gè)異常。

示意圖

示意圖

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/

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 11,256評(píng)論 0 23
  • Spring Cloud為開(kāi)發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見(jiàn)模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,711評(píng)論 19 139
  • 已經(jīng)同步到gitbook,想閱讀的請(qǐng)轉(zhuǎn)到gitbook: Django 1.10 中文文檔 URL dispatc...
    leyu閱讀 14,462評(píng)論 0 16
  • 圖文無(wú)關(guān)。 開(kāi)始重讀紅樓。 曹公一開(kāi)頭便寫(xiě)寶釵病,可卿病,可卿死,寫(xiě)李貴,茗煙,磺大奶奶,金榮,薛蟠的龍陽(yáng)之興,寶...
    Tantalusqualenj閱讀 263評(píng)論 0 0
  • 參考:內(nèi)存緩存LruCache實(shí)現(xiàn)原理Android中圖片的三級(jí)緩存策略Android官方教程:保存到文件andr...
    TTTqiu閱讀 282評(píng)論 0 0

友情鏈接更多精彩內(nèi)容