What is an exception handling personality function?

大憨熊 提交于 2019-12-09 08:41:05

问题


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?


回答1:


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.

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.

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



来源:https://stackoverflow.com/questions/16597350/what-is-an-exception-handling-personality-function

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!