windows C++ 异常调用栈简析( 二 )


Catch理顺了RcConsolidateFrames函数调用顺序,RcConsolidateFrames自己则调用了函数CxxCallCatchBlock 。这个函数里面调用了catch处理异常 。CxxCallCatchBlock函数源码地址:
D:\Visual Studio\IDE\VC\Tools\MSVC\14.33.31629\crt\src\vcruntime\frame.cpp(1344行)源码:
void * RENAME_EH_EXTERN(__FrameHandler4)::CxxCallCatchBlock(EXCEPTION_RECORD *pExcept){//为了方便观看,此处省略一万行continuationAddress = RENAME_EH_EXTERN(_CallSettingFrame_LookupContinuationIndex)}RENAME_EH_EXTERN(_CallSettingFrame_LookupContinuationIndex)这段的原型是:

windows C++ 异常调用栈简析

文章插图

windows C++ 异常调用栈简析

文章插图
总结下:堆栈的调用如下:
vcruntime140_1d.dll!__FrameHandler4::CxxCallCatchBlock (jmp rdx)ntdll.dll!RcConsolidateFrames ntdll.dll!RtlRestoreContext ntdll.dll!RtlGuardRestoreContextntdll.dll!RtlUnwindExvcruntime140_1d.dll!__FrameHandler4::UnwindNestedFramesvcruntime140_1d.dll!CatchItvcruntime140_1d.dll!FindHandlervcruntime140_1d.dll!__InternalCxxFrameHandlervcruntime140_1d.dll!__CxxFrameHandler4ntdll.dll!RtlpExecuteHandlerForException()ntdll.dll!RtlDispatchExceptionntdll.dll!KiUserExceptionDispatch()KernelBase.dll!RaiseException()vcruntime140d.dll!_CxxThrowExceptionConsoleApplication2.exe!main作者:江湖评谈版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可 。
windows C++ 异常调用栈简析

文章插图
【windows C++ 异常调用栈简析】

经验总结扩展阅读