什么是异常处理人格功能? [英] What is an exception handling personality function?

查看:67
本文介绍了什么是异常处理人格功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查看了LLVM EH内在函数的文档,以及Itanium ABI的文档,而我对其中的一些内容感到困惑.

I've looked at the documentation for the LLVM EH intrinsics, and also the Itanium ABI, and I'm stumped on a few things.

什么是异常人格功能?它执行什么工作?我将如何创建一个?

What is an exception personality function? What jobs does it perform? How would I go about creating one?

推荐答案

我有完全相同的问题.我刚刚找到了这些文章,其中详细解释了如何可以正常工作,包括完整的异常处理过程,包括个性功能的确切目的和分步实施.

I had exactly the same question. I've just found these articles which thoroughly explains how it works, the full exception handling process, including the exact purpose of the personality function and a step-by-step implementation.

为了对SO做出回答,以下是发生异常时的人格行为的简短摘要(但您确实应该看一下该人为此撰写的18篇文章!):

For the sake of having an answer on SO, here is a brief summary of the personality behavior when an exception occurs (but you really should look at the 18 articles that this guy wrote about this !):

  • 首先,将为每个堆栈帧调用一次(查找阶段),并且必须返回一个值(来自枚举)以告知当前堆栈帧是否能够捕获异常.个性应使用位于函数末尾的一组特定表来获取此信息.

  • First, it will be called once for each stack frame (lookup phase), and has to return a value (from an enumeration) telling to unwind if the current stack frame is able to catch the exception. The personality is expected to use a specific set of tables located at the end of the function in order to fetch this information.

如果堆栈框架可以捕获异常,则使用不同的actions参数(清理阶段)再次调用个性.

If the stack frame can catch the exception, the personality will be called a second time with a different actions argument (cleanup phase).

这篇关于什么是异常处理人格功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆