简体   繁体   English

代码如何捕获异常?

[英]How code catches exceptions?

How code catches exceptions (try, catch(...))? 代码如何捕获异常(try,catch(...))?

push 0FFFFFFFFh
...
mov eax, dword ptr fs:[00000000h]
...
mov dword ptr fs:[00000000h],eax  
mov dword ptr [ebp-10h],esp

What this code mean in "head" of function, which catches exceptions? 这个代码在函数的“头部”中意味着什么,它捕获异常?

mov dword ptr [ebp-4], 0

And this (in head of "try")? 而这(在“尝试”的头部)? Function does not have any local variables. 函数没有任何局部变量。

Function: 功能:

int SUM(int a, int b)
{
    try{}
    catch(...){}
    return 0;
}

What store in FS segment? 什么存储在FS细分市场?

The value stored in fs:[0] is a pointer to a linked list of EXCEPTION_REGISTRATION structures. 存储在fs:[0]值是指向EXCEPTION_REGISTRATION结构的链接列表的指针。 Read here for more details: 阅读此处了解更多详情:

A Crash Course on the Depths of Win32 Structured Exception Handling, MSJ January 1997 关于Win32结构化异常处理深度的崩溃课程,MSJ 1997年1月

How MSVC implements exceptions (on x86): https://www.openrce.org/articles/full_view/21 MSVC如何实现异常(在x86上): https//www.openrce.org/articles/full_view/21

This covers both SEH ( __try/__catch/__finally ) and C++ ( try/catch ) exception implementation. 这包括SEH( __try/__catch/__finally try __try/__catch/__finally )和C ++( try/catch )异常实现。

How MSVC (x64) and GCC (Linux/iOS) implements exception handling: http://www.hexblog.com/?p=704 MSVC(x64)和GCC(Linux / iOS)如何实现异常处理: http//www.hexblog.com/ ?p = 704

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM