在調(diào)試器中運(yùn)行程序時(shí)迟隅,如果程序產(chǎn)生異常乞巧,調(diào)試器會(huì)首先獲得通知(即First-chance exception)铭腕,而后此異常由產(chǎn)生它的程序負(fù)責(zé)捕獲扔字。
如果程序沒有捕獲并處理此異常,那么調(diào)試器會(huì)再次被通知(即Second-chance exception格嘁,Last-chance exception)笛求,并結(jié)束程序。
通常見到的“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.
如果程序遇到異常蜂嗽,首先會(huì)被"first chance" exception這種機(jī)制來捕獲和進(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.
如果捕獲到異常后,程序沒有進(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/