What is an exception handling personality function?

白昼怎懂夜的黑 提交于 2019-12-03 11:37:51
Maël Nison

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).

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