{"id":276007,"date":"2016-03-13T21:08:20","date_gmt":"2016-03-13T18:08:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=276007"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=276007","title":{"rendered":"\u0421++ exception handling \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c. \u0427\u0430\u0441\u0442\u044c 2"},"content":{"rendered":"<p>       \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u0431 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0432 \u0421++<\/p>\n<p>  <a href=\"https:\/\/habrahabr.ru\/post\/279111\/\">1 \u0447\u0430\u0441\u0442\u044c<\/a><br \/>  <a href=\"https:\/\/habrahabr.ru\/post\/279149\/\">3 \u0447\u0430\u0441\u0442\u044c<\/a><\/p>\n<h1>C++ exceptions \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c: \u043c\u0438\u043b\u0430\u044f \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/h1>\n<p>  \u041d\u0430\u0448\u0430 \u043f\u043e\u0435\u0437\u0434\u043a\u0430 \u0432 \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0438 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0435\u0449\u0435 \u0434\u0430\u043b\u0435\u043a\u0430 \u043e\u0442 \u043a\u043e\u043d\u0446\u0430, \u043d\u0430\u043c \u0435\u0449\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0435 &quot;call frame information&quot;, \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0449\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 Unwind \u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u044d\u043a\u0430, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u0438\u0448\u0435\u0442 \u0432 \u0447\u0435\u043c-\u0442\u043e, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u043c LSDA, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f, \u043a\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u0435\u0442\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c. \u0410 \u0442\u0430\u043a \u0436\u0435 \u043c\u044b \u0443\u0436\u0435 \u0443\u0437\u043d\u0430\u043b\u0438, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043c\u0430\u0433\u0438\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043f\u043e\u043a\u0430 \u0435\u0449\u0435 \u043d\u0435 \u0432\u0438\u0434\u0435\u043b\u0438 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438. \u0414\u0430\u0432\u0430\u0439 \u0442\u0435 \u0440\u0435\u0437\u044e\u043c\u0438\u0440\u0443\u0435\u043c, \u0447\u0442\u043e \u043c\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u0435\u043c \u043e \u043f\u0440\u043e\u0431\u0440\u043e\u0441\u0435 \u0438 \u043e\u0442\u043b\u043e\u0432\u0435 \u043e\u0448\u0438\u0431\u043e\u043a (\u0438\u043b\u0438, \u0442\u043e\u0447\u043d\u0435\u0435, \u0447\u0442\u043e \u043c\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u0435\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0431\u0440\u043e\u0448\u0435\u043d\u043d\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0447\u0435\u043d\u043e):<\/p>\n<ul>\n<li>\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 throw \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u043f\u0430\u0440\u0443 <strong><strong>cxa_allocate_exception\/<\/strong>xca_throw<\/strong><\/li>\n<li><strong>__cxa_allocate_exception<\/strong> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438<\/li>\n<li><strong>__cxa_throw<\/strong> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 \u043d\u0438\u0437\u043a\u043e-\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f, \u0432\u044b\u0437\u044b\u0432\u0430\u044f <em>_Unwind_RaiseException<\/em><\/li>\n<li>\u0420\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u044d\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 CFI, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u0441\u0435\u0439\u0447\u0430\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432 \u0441\u0442\u0435\u043a\u0435 <\/li>\n<li>\u041a\u0430\u0436\u0434\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 LSDA, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u0447\u0442\u043e-\u0442\u043e, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0435 <strong>.gcc_except_table<\/strong><\/li>\n<li>\u0420\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0444\u0440\u0435\u0439\u043c\u043e\u043c \u0441\u0442\u044d\u043a\u0430 \u0438 LSDA, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u0442\u044d\u043a, \u0435\u0441\u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430.<\/li>\n<\/ul>\n<p><a name=\"habracut\"><\/a><br \/>  \u041f\u043e\u043a\u0443\u0434\u0430 \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u0432\u0441\u0435 \u044d\u0442\u043e, \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u043b\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438! \u041d\u0430\u0448 ABI \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0432\u044b\u0431\u0440\u043e\u0448\u0435\u043d\u043e:<\/p>\n<pre><code>alloc ex 1 __cxa_throw called no one handled __cxa_throw, terminate!<\/code><\/pre>\n<p>  \u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043d\u0430\u0437\u0430\u0434 \u0432 \u043d\u0430\u0448\u0443 mycppabi \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<pre><code>void __gxx_personality_v0() {     printf(&quot;Personality function FTW\\n&quot;); }<\/code><\/pre>\n<p>  \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u0434 \u0432 <a href=\"https:\/\/github.com\/nicolasbrailo\/cpp_exception_handling_abi\/tree\/master\/abi_v02\">\u043c\u043e\u0435\u043c \u0433\u0438\u0442\u0445\u0430\u0431 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>.<\/p>\n<p>  \u0418, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u0430\u0448\u0430 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u0430. \u041c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043c\u044b \u043d\u0430 \u0432\u0435\u0440\u043d\u043e\u043c \u043f\u0443\u0442\u0438 \u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0438\u0434\u0435\u044f, \u0447\u0442\u043e \u043c\u044b \u043e\u0442 \u043d\u0435\u0435 \u0445\u043e\u0442\u0438\u043c. \u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code>_Unwind_Reason_Code __gxx_personality_v0 (                      int version, _Unwind_Action actions, uint64_t exceptionClass,                      _Unwind_Exception* unwind_exception, _Unwind_Context* context);<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043b\u043e\u0436\u0438\u043c \u044d\u0442\u043e \u0432 \u043d\u0430\u0448 <code>mycppabi.cpp<\/code>, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c:<\/p>\n<pre><code>#include &lt;unistd.h&gt; #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;stdint.h&gt;  namespace __cxxabiv1 {     struct __class_type_info {         virtual void foo() {}     } ti; }  #define EXCEPTION_BUFF_SIZE 255 char exception_buff[EXCEPTION_BUFF_SIZE];  extern &quot;C&quot; {  void* __cxa_allocate_exception(size_t thrown_size) {     printf(&amp;&quot;alloc ex %i\\n&quot;, thrown_size);     if (thrown_size &gt; EXCEPTION_BUFF_SIZE) printf(&quot;Exception too big&quot;);     return &amp;exception_buff; }  void __cxa_free_exception(void *thrown_exception);  #include &lt;unwind.h&gt;  typedef void (*unexpected_handler)(void); typedef void (*terminate_handler)(void);  struct __cxa_exception {     std::type_info *    exceptionType;     void (*exceptionDestructor) (void *);     unexpected_handler  unexpectedHandler;     terminate_handler   terminateHandler;     __cxa_exception *   nextException;      int         handlerCount;     int         handlerSwitchValue;     const char *        actionRecord;     const char *        languageSpecificData;     void *          catchTemp;     void *          adjustedPtr;      _Unwind_Exception   unwindHeader; };  void __cxa_throw(void* thrown_exception, struct type_info *tinfo, void (*dest)(void*)) {     printf(&quot;__cxa_throw called\\n&quot;);      __cxa_exception *header = ((__cxa_exception *) thrown_exception - 1);     _Unwind_RaiseException(&amp;header-&gt;unwindHeader);      \/\/ __cxa_throw never returns     printf(&quot;no one handled __cxa_throw, terminate!\\n&quot;);     exit(0); }  void __cxa_begin_catch() {     printf(&quot;begin FTW\\n&quot;); }  void __cxa_end_catch() {     printf(&quot;end FTW\\n&quot;); }  _Unwind_Reason_Code __gxx_personality_v0 (                      int version, _Unwind_Action actions, uint64_t exceptionClass,                      _Unwind_Exception* unwind_exception, _Unwind_Context* context) {     printf(&quot;Personality function FTW!\\n&quot;); }  }<\/code><\/pre>\n<p>  \u0421\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u0438 \u0441\u043b\u0438\u043d\u043a\u0443\u0435\u043c \u0432\u0441\u0435, \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0438 \u043d\u0430\u0447\u043d\u0435\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u043e\u043c\u043e\u0449\u044c\u044e gdb:<\/p>\n<pre><code>Breakpoint 1, __gxx_personality_v0 (version=1, actions=1, exceptionClass=134514792, unwind_exception=0x804a060, context=0xbffff0f0)<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>\u0412\u0435\u0440\u0441\u0438\u044f \u0438 <strong>exceptionClass<\/strong> \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u044f\u0437\u044b\u043a\u0430\/ABI\/\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430, \u0442\u0443\u043b\u0447\u0435\u0439\u043d\u0430\/ \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435-\u043d\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 \u0442.\u0434. \u041d\u0430\u043c \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0432\u043e\u043b\u043d\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0431 \u044d\u0442\u043e\u043c \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0438\u043d\u0438-ABI, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043b\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/li>\n<li>Actions: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <em><em>Unwind<\/em><\/em> \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0447\u0442\u043e \u0435\u0439 \u0434\u0435\u043b\u0430\u0442\u044c (\u043e\u0431 \u044d\u0442\u043e\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435).<\/li>\n<li>unwind_exception: \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0430\u043b\u043b\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0447\u0435\u0440\u0435\u0437 <strong>__cxa_allocate_exception<\/strong> (\u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043e \u043e\u0442\u2026 \u0442\u0443\u0442 \u043c\u043d\u043e\u0433\u043e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438, \u043d\u043e \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e)<\/li>\n<li>context: \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0430 \u0441\u0442\u044d\u043a\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, LSDA. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0447\u0442\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u0442\u044d\u043a\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f (\u0430 \u0442\u0430\u043a \u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440).<\/li>\n<\/ul>\n<p>  \u0427\u0442\u043e \u0436, \u043c\u044b \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0443\u044e (\u043d\u0443\u0443\u0443, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u043b\u0438\u043d\u043a\u0443\u0435\u043c\u0443\u044e) \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u0414\u0435\u043b\u0430\u0435\u0442 \u043e\u043d\u0430 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u043b\u0435\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0435\u0451 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u0438 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0451 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n<h1>C++ exceptions \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c: \u0434\u0432\u0443\u0445-\u0444\u0430\u0437\u043d\u044b\u0439 \u043f\u0440\u043e\u0445\u043e\u0434<\/h1>\n<p>  \u041c\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0433\u043b\u0430\u0432\u0443 \u0442\u0435\u043c, \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0443\u044e <em>Unwind<\/em> \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c. \u041e\u043d\u0430, \u0432 \u043e\u0431\u0449\u0435\u043c \u0442\u043e, \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442, \u043f\u043e\u043a\u0430 \u0447\u0442\u043e. \u041d\u0430\u0448 ABI \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0443\u0436\u0435 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u043f\u0443\u0442\u0438 \u043f\u043e \u0431\u0440\u043e\u0431\u0440\u043e\u0441\u0443 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0438 \u0438\u0445 \u043e\u0442\u043b\u043e\u0432\u0443, \u043d\u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0435\u0449\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0432\u0435\u0440\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0431\u043b\u043e\u043a (landing pad) \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a. \u041d\u0430\u0447\u043d\u0435\u043c \u044d\u0442\u0443 \u0433\u043b\u0430\u0432\u0443 \u0441 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u043e\u043d\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <strong>__gxx_personality_v0<\/strong> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435: \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c &quot;\u0434\u0430, \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0431\u043b\u043e\u043a \u0441\u0442\u044d\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435&quot;.<\/p>\n<p>  \u041c\u044b \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438, \u0447\u0442\u043e \u043f\u043b\u0435\u0432\u0430\u0442\u044c \u0445\u043e\u0442\u0435\u043b\u0438 \u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044e \u0438\u043b\u0438 exceptionClass \u0432 \u043d\u0430\u0448\u0435\u043c mini ABI. \u0427\u0442\u043e \u0436, \u0437\u0430\u0431\u044c\u0435\u043c \u0438 \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0442\u043e\u0436\u0435, \u043f\u043e\u043a\u0430 \u0447\u0442\u043e: \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0436\u0435 \u0444\u0440\u0435\u0439\u043c\u0435 \u0441\u0442\u044d\u043a\u0430. \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u0442\u0435 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c try\/catch \u0431\u043b\u043e\u043a \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u044f\u043c \u043d\u0430\u0434 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430, \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0438\u043d\u0430\u0447\u0435 \u0432\u0441\u0435 \u043f\u043e\u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f. \u0421\u0442\u043e\u0438\u0442 \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e catch-\u0431\u043b\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f. \u041a\u0430\u043a \u043c\u044b \u0434\u0430\u0434\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>Unwind<\/em> \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435?<\/p>\n<p>  <strong>_Unwind_Reason_Code<\/strong> \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <strong><em>Unwind<\/em><\/strong>: \u043d\u0430\u0448\u043b\u0438 \u043b\u0438 \u043c\u044b landing pad \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u043b\u0438 \u043d\u0435\u0442. \u0412\u0435\u0440\u043d\u0435\u043c \u0436\u0435 \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 *<em>_URC_HANDLER_FOUND<\/em> \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442:<\/p>\n<pre><code>alloc ex 1 __cxa_throw called Personality function FTW Personality function FTW no one handled __cxa_throw, terminate!<\/code><\/pre>\n<p>  \u0412\u0438\u0434\u0438\u0442\u0435 \u044d\u0442\u043e? \u041c\u044b \u0441\u043a\u0430\u0437\u0430\u043b\u0438 \u0440\u0430\u0441\u043a\u0440\u0443\u0442\u0447\u0438\u043a\u0443, \u0447\u0442\u043e \u043d\u0430\u0448\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0438 \u043e\u043d \u0432\u044b\u0437\u0432\u0430\u043b \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0435\u0449\u0435 \u0440\u0430\u0437! \u0427\u0442\u043e \u0437\u0430 \u0447\u0435\u0440\u0442 \u0442\u0443\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442?<\/p>\n<p>  \u041f\u043e\u043c\u043d\u0438\u0442\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 action? \u0412\u043e\u0442 \u043a\u0430\u043a <em>Unwind<\/em> \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043d\u0430\u043c, \u0447\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u043e\u043d \u0445\u043e\u0447\u0435\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0434\u0432\u0430 \u044d\u0442\u0430\u043f\u0430: \u043f\u043e\u0438\u0441\u043a \u0438 \u043e\u0447\u0438\u0441\u0442\u043a\u0430 (\u0438\u043b\u0438 _UA_SEARCH_PHASE \u0438 _UA_CLEANUP_PHASE). \u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0440\u0435\u0446\u0435\u043f\u0442\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a:<\/p>\n<ul>\n<li>__cxa_throw\/__cxa_allocate_exception \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442 \u0438\u0445 \u0432 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0440\u0430\u0441\u043a\u0440\u0443\u0442\u043a\u0438 \u0441\u0442\u044d\u043a\u0430, \u0438\u043c\u0435\u043d\u0443\u0435\u043c\u0443\u044e _Unwind_RaiseException\n<\/li>\n<li>\u0420\u0430\u0441\u043a\u0440\u0443\u0442\u0447\u0438\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 CFI \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432 \u0441\u0442\u044d\u043a\u0435 (\u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e)\n<\/li>\n<li>\u041a\u0430\u0436\u0434\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 LSDA-\u0447\u0430\u0441\u0442\u044c, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u0432\u043e \u0447\u0442\u043e-\u0442\u043e, \u0438\u043c\u0435\u043d\u0443\u0435\u043c\u043e\u0435 &quot;.gcc_except_table&quot;\n<\/li>\n<li>\u0420\u0430\u0441\u043a\u0440\u0443\u0442\u0447\u0438\u043a \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c landing pad \u0434\u043b\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f:\n<ul>\n<li>\u0420\u0430\u0441\u043a\u0440\u0443\u0442\u0447\u0438\u043a \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c action: <strong>_UA_SEARCH_PHASE<\/strong> \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c contex: \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0444\u0440\u0435\u0439\u043c \u0441\u0442\u044d\u043a\u0430.<\/li>\n<li>\u041f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043c\u043e\u0436\u0435\u0442 \u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0444\u0440\u0435\u0439\u043c-\u0441\u0442\u044d\u043a \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u044d\u0442\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044f LSDA<\/li>\n<li>\u0415\u0441\u043b\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043e, \u043e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 _URC_HANDLER_FOUND<\/li>\n<li>\u0415\u0441\u043b\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u043c\u0443, \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043e _URC_CONTINE_UNWIND, \u0438 \u0440\u0430\u0441\u043a\u0440\u0443\u0442\u0447\u0438\u043a \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043d\u0430\u0439\u0442\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0444\u0440\u0435\u0439\u043c\u043e\u043c \u0441\u0442\u044d\u043a\u0430.<\/li>\n<\/ul>\n<p>  <\/li>\n<li>\u0415\u0441\u043b\u0438 \u043d\u0438 \u043e\u0434\u0438\u043d landing pad \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (\u043e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e std::terminate).\n<\/li>\n<li>\u0415\u0441\u043b\u0438 landing pad \u043d\u0430\u0439\u0434\u0435\u043d:<br \/> \n<ul>\n<li>\u0420\u0430\u0441\u043a\u0440\u0443\u0442\u0447\u0438\u043a \u043d\u0430\u0447\u043d\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u044d\u043a \u0437\u0430\u043d\u043e\u0432\u043e, \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c action <strong>_UA_CLEANUP_PHASE<\/strong>.<\/li>\n<li>\u041f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442: \u043c\u043e\u0436\u0435\u0442 \u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043e\u043a\u043d\u043e \u0441\u0442\u044d\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0438\u043b\u0438 \u043d\u0435\u0442.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442, \u0442\u043e \u043e\u043d\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0447\u0438\u0441\u0442\u0438, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432 LSDA, (\u0438 \u043e\u0447\u0438\u0449\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u043d\u044b\u0435 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0435 \u0441\u0442\u044d\u043a\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432), \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0440\u0430\u0441\u043a\u0440\u0443\u0442\u0447\u0438\u043a\u0443 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0444\u0440\u0435\u0439\u043c\u043e\u043c.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0442\u043e\u0433\u0434\u0430 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u043e\u0447\u0438\u0441\u0442\u043a\u0438, \u0430 \u043b\u0438\u0448\u044c \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0440\u0430\u0441\u043a\u0440\u0443\u0442\u0447\u0438\u043a\u0443, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0442\u0430\u043a\u0443\u0449\u0435\u043c landing pad.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u0438 \u0434\u0432\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0432\u0435\u0449\u0438:<\/p>\n<ol>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a \u0432 \u0434\u0432\u0443\u0445-\u0444\u0430\u0437\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u043e\u0442\u043b\u043e\u0432\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u043f\u043e\u043b\u043d\u044b\u0439 stack trace \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f (\u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043b\u0438 \u0432 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0445\u043e\u0434 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c, \u0443 \u043d\u0430\u0441 \u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u0441\u0442\u044d\u043a-\u0442\u0440\u0435\u0439\u0441\u0430, \u043b\u0438\u0431\u043e \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0431\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u043a\u043e\u043f\u0438\u044e!).<\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u044f _UA_CLEANUP_PHASE \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0430, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0440\u0435\u0439\u043c \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0442\u0430\u043a \u0436\u0435 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e: \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u042d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f RAII (Resource Acquisition Is Initialization, \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0435\u0441\u0442\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f) safe \u0438\u0434\u0438\u043e\u043c\u043e\u0439. <\/li>\n<\/ol>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u043c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0444\u0430\u0437\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0432\u043e\u0435\u0439 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<h1>C++ exceptions \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c: \u043b\u043e\u0432\u0438\u043c \u043d\u0430\u0448\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h1>\n<p>  \u041c\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0433\u043b\u0430\u0432\u0443, \u043d\u0430\u0443\u0447\u0438\u0432 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0440\u0430\u0441\u043a\u0440\u0443\u0442\u0447\u0438\u043a\u0443. \u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 <strong>__gxx_personality_v9<\/strong>: \u043d\u0430\u0443\u0447\u0438\u043c \u0435\u0451 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0445\u043e\u0434 \u0432 \u0434\u0432\u0435 \u0444\u0430\u0437\u044b.<\/p>\n<p>  \u041d\u0430\u0448\u0430 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u0442 \u0432\u0438\u0434:<\/p>\n<pre><code>_Unwind_Reason_Code __gxx_personality_v0 (                      int version, _Unwind_Action actions, uint64_t exceptionClass,                      _Unwind_Exception* unwind_exception, _Unwind_Context* context) {     if (actions &amp;_UA_SEARCH_PHASE)     {         printf(&quot;Personality function, lookup phase\\n&quot;);         return _URC_HANDLER_FOUND;     } else if (actions &amp; _UA_CLEANUP_PHASE) {         printf(&quot;Personality function, cleanup\\n&quot;);         return _URC_INSTALL_CONTEXT;     } else {         printf(&quot;Personality function, error\\n&quot;);         return _URC_FATAL_PHASE1_ERROR;     } }<\/code><\/pre>\n<p>  \u041d\u0430\u043f\u043e\u043c\u043d\u044e: \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u043d\u0430 <a href=\"https:\/\/github.com\/nicolasbrailo\/cpp_exception_handling_abi\/tree\/master\/abi_v03\">\u043c\u043e\u0435\u043c github \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>.<\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442:<\/p>\n<pre><code class=\"bash\">alloc ex 1 __cxa_throw called Personality function, lookup phase Personality function, cleanup try_but_dont_catch handled the exception catchit handled the exception<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u0438\u0434\u0435\u0442 \u043d\u0435 \u0442\u0430\u043a: \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u043d\u0443\u0442\u0440\u0438 catch\/try \u0431\u043b\u043e\u043a\u0430 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442! \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0440\u0430\u0437\u043a\u0440\u0443\u0442\u0447\u0438\u043a\u0443 &quot;\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442&quot; (\u0442.\u0435. \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435), \u043d\u043e \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u0431\u043b\u043e\u043a\u0430 landing pad, \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e, \u044f \u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u043e\u0447\u043a\u0443, \u043e\u0434\u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 (landing pad), \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u0432 <strong>.gcc_except_table<\/strong> (\u043d\u0430\u0448 \u0441\u0442\u0430\u0440\u044b\u0439 \u0434\u0440\u0443\u0433, LSDA).<\/p>\n<h1>C++ exceptions \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c: <em>Unwind<\/em> \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0430<\/h1>\n<p>  \u041c\u044b \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043d\u0430\u0448 \u043c\u0438\u043d\u0438-ABI, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u043c \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043d\u0430\u0434 \u043e\u0442\u043b\u043e\u0432\u043e\u043c \u0438\u0445. \u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0443\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0438 \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u043d\u043e \u043e\u043d\u0430 \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430: \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u044f\u0442\u044c \u0440\u0430\u0441\u043a\u0440\u0443\u0442\u0447\u0438\u043a \u043a\u043e\u0433\u0434\u0430 \u0435\u043c\u0443 \u0441\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f, \u043e\u043d\u0430 \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043a\u043e\u0434 \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u043b\u043e\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043e\u0448\u0438\u0431\u043a\u0438. \u042d\u0442\u043e \u0443\u0436\u0435 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0442\u043e, \u0441 \u0447\u0435\u0433\u043e \u043c\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u0438, \u043d\u043e \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0432\u0441\u0435 \u0435\u0449\u0435 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u0434\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0433\u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a ABI. \u041c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043d\u0430\u0448 \u043a\u043e\u0434?<\/p>\n<p>  \u041a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u0430\u0441\u043a\u0440\u0443\u0442\u0447\u0438\u043a\u0443 \u0433\u0434\u0435 \u043d\u0430\u0448 landing pad, \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0430\u0448\u0435\u0433\u043e catch \u0431\u043b\u043e\u043a\u0430? \u0415\u0441\u043b\u0438 \u043c\u044b \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a <a href=\"http:\/\/mentorembedded.github.io\/cxx-abi\/abi-eh.html#base-om\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 ABI<\/a>, \u043d\u0430\u0439\u0434\u0435\u043c \u0442\u0430\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b:<\/p>\n<ul>\n<li><strong>_Unwind_GetLanguageSpecificData<\/strong> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f LSDA \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0430. \u041d\u0430\u043c \u0441\u0442\u043e\u0438\u0442 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0438\u0441\u043a\u0430\u0442\u044c landing pads \u0438 \u0434\u0435\u0441\u0442\u0440\u043a\u0443\u0442\u043e\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e<\/li>\n<li><strong>_Unwind_GetRegionStart<\/strong> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0442\u0435\u043a\u0443\u0449\u0435\u043c\u0443 \u0444\u0440\u0435\u0439\u043c\u0443)\n<\/li>\n<li><strong>_Unwind_GetIP<\/strong> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0430 \u0441\u0442\u044d\u043a\u0430 (instruction pointer) (\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043c\u0435\u0441\u0442\u043e, \u0433\u0434\u0435 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d. \u0421\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0434\u0430\u043b\u0435\u0435).<\/li>\n<\/ul>\n<p>  \u0414\u0430\u0432\u0430\u0439 \u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u044d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 gdb. \u041d\u0430 \u043c\u043e\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u0435:<\/p>\n<pre><code>Breakpoint 1, __gxx_personality_v0 (version=1, actions=6, exceptionClass=134515400, unwind_exception=0x804a060, context=0xbffff0f0)     at mycppabi.cpp:77  84          const uint8_t* lsda = (const uint8_t*)_Unwind_GetLanguageSpecificData(context); 85          uintptr_t ip = _Unwind_GetIP(context) - 1; 86          uintptr_t funcStart = _Unwind_GetRegionStart(context); 87          uintptr_t ipOffset = ip - funcStart;<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043c\u044b \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c \u044d\u0442\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e <strong>_Unwind_GetRegionStart<\/strong> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0444\u0440\u0435\u0439\u043c \u0441\u0442\u044d\u043a\u0430 (try_but_dont_catch) \u0438 \u0447\u0442\u043e <strong>_Unwind_GetIp<\/strong> \u2014 IP \u043d\u0430 \u043d\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u044e, \u0433\u0434\u0435 \u0431\u044b\u043b \u0441\u0434\u0435\u043b\u0430\u043d \u0432\u044b\u0437\u043e\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0430. _Unwind_GetRegionStart \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u043c \u043d\u0430 \u043c\u0435\u0441\u0442\u043e, \u0433\u0434\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u043f\u0440\u043e\u0431\u0440\u043e\u0448\u0435\u0433\u043e, \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u0434\u043b\u044f \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f, \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u044d\u0442\u043e \u043d\u0430 \u043f\u043e\u0442\u043e\u043c. \u0415\u0449\u0435 \u043c\u044b \u043d\u0435 \u0432\u0438\u0434\u0438\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f LSDA \u0442\u0443\u0442, \u043d\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u0441\u0440\u0430\u0437\u0443 \u0437\u0430 \u043a\u043e\u0434\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u043e\u043a\u0443\u0434\u0430 _Unwind_GetLanguageSpecificData \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u044f\u043c\u0438\u043a\u043e\u043c \u043d\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u043d\u0446\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<pre><code>_Unwind_GetIP = (void *) 0x804861d _Unwind_GetRegionStart = (void *) 0x8048612 _Unwind_GetLanguageSpecificData = (void *) 0x8048e3c function pointer to try_but_dont_catch = 0x8048612 &amp;&lt;try_but_dont_catch()&gt;  (gdb) disassemble \/m try_but_dont_catch Dump of assembler code for function try_but_dont_catch(): 10  void try_but_dont_catch() {         [...] 11      try { 12          raise();    0x08048619 &lt;+7&gt;:   call   0x80485e8 &lt;raise()&gt;  13      } catch(Fake_Exception&amp;) {    0x08048651 &lt;+63&gt;:  call   0x804874a &lt;__cxa_begin_catch()&gt;    0x08048665 &lt;+83&gt;:  call   0x804875e &lt;__cxa_end_catch()&gt;    0x0804866a &lt;+88&gt;:  jmp    0x804861e &lt;try_but_dont_catch()+12&gt;  14          printf(&quot;Caught a Fake_Exception!\\n&quot;);    0x08048659 &lt;+71&gt;:  movl   $0x8048971,(%esp)    0x08048660 &lt;+78&gt;:  call   0x80484c0 &lt;puts@plt&gt;  15      } 16 17      printf(&quot;try_but_dont_catch handled the exception\\n&quot;);    0x0804861e &lt;+12&gt;;:  movl   $0x8048948,(%esp)    0x08048625 &lt;+19&gt;:  call   0x80484c0 &lt;puts@plt&gt;  18  }    0x0804862a &lt;+24&gt;:  add    $0x24,%esp <\/code><\/pre>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <em>Unwind<\/em> \u043c\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0435 \u0441\u0442\u044d\u043a\u0430 \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043d\u0435\u0442, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0430\u0433, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u2014 \u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c landing pad \u0438\u043b\u0438 \u043d\u0435\u0442 \u2014 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e CFI \u0432 \u043a\u043e\u043d\u0446\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u042d\u0442\u043e \u0447\u0430\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 DWARF \u0438 \u0435\u0451 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u0430\u044f. \u041a\u0430\u043a \u0438 \u0432 \u043d\u0430\u0448\u0435\u043c ABI, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c.<\/p>\n<h1>C++ exceptions \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c: \u0447\u0442\u0435\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b CFI<\/h1>\n<p>  \u0414\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u043d\u0430\u0448\u0430 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0432 \u043d\u0430\u0448\u0435\u043c ABI, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0447\u0438\u0442\u0430\u0442\u044c LSDA, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439 \u0444\u0440\u0435\u0439\u043c (\u0442.\u0435. \u043a\u0430\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f) \u043c\u043e\u0436\u0435\u0442\u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0433\u0434\u0435 landing pad (catch-\u0431\u043b\u043e\u043a) \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u0439\u0434\u0435\u043d. \u0422\u0430\u0431\u043b\u0438\u0446\u0430 LSDA \u0437\u0430\u0434\u0430\u043d\u0430 \u0432 CFI \u0444\u043e\u0440\u043c\u0430\u0442\u0435, \u0438 \u0432 \u044d\u0442\u043e\u0439 \u0433\u043b\u0430\u0432\u0435 \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u0447\u0438\u0442\u0430\u0442\u044c \u0435\u0451.<\/p>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0435 CFI \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0447\u0438\u0442\u0430\u043d\u044b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0445 \u043a\u0430\u043c\u043d\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0435\u0441\u0442\u044c. \u0414\u0432\u0430, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435:<\/p>\n<ol>\n<li>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043e .gcc_except_table \u043e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u043e (\u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u044f \u043d\u0430\u0448\u0435\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0443 \u043f\u0438\u0441\u0435\u043c \u043e \u043d\u0435\u043c), \u0442\u0430\u043a \u0447\u0442\u043e \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u043e\u0434\u043e\u0432, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u0434\u0435.<\/li>\n<li>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u0444\u043e\u0440\u043c\u0430\u0442 \u043d\u0435 \u0430\u0434\u0441\u043a\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0439, \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 LEB (Little Endian Base), \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0447\u0442\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439.<\/li>\n<\/ol>\n<p>  \u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u0437\u043d\u0430\u044e, \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0434\u0430\u043d\u043d\u044b\u0445 DWARF \u043a\u043e\u0434\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 LEB, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0439 \u0438\u0434\u0435\u0435\u0439, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0442\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432, \u043d\u0443 \u0438 \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043c\u0435\u0441\u0442\u043e \u043f\u043e\u0434 \u043a\u043e\u0434 \u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f int-\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u0441\u0447\u0438\u0442\u0435\u0440\u0438\u0442\u044c \u0442\u0443\u0442: \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 LEB \u0447\u0438\u0441\u043b\u0430 \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c uint8_t, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u043c\u0435\u0442\u044c \u0434\u0435\u043b\u043e \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0438\u043b\u0438 \u0447\u0435\u0433\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 \u0442\u043e\u0433\u043e.<\/p>\n<p>  \u041a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0435\u0440\u0441\u0438\u044f \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0433\u043b\u0430\u0432\u044b <a href=\"https:\/\/github.com\/nicolasbrailo\/cpp_exception_handling_abi\/tree\/master\/abi_v04\">\u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439 \u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c CFI \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441 \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u0443\u0432\u0438\u0434\u0435\u043c, \u0441\u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043d\u0430\u0448\u0435\u0439 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u0446\u0438\u0438. \u042f \u043f\u0435\u0440\u0435\u043d\u0430\u0437\u0432\u0430\u043b \u043c\u0435\u0442\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0445 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e-\u0443\u0434\u043e\u0431\u043d\u044b\u043c\u0438. LSDA \u0438\u043c\u0435\u044e\u0442 \u0442\u0440\u0438 \u0441\u0435\u043a\u0446\u0438\u0438, \u043f\u043e\u043f\u0440\u043e\u0443\u0439\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u0445 \u043d\u0438\u0436\u0435:<\/p>\n<pre><code>.local_frame_entry:     .globl  __gxx_personality_v0     .section    .gcc_except_table,&quot;a&quot;,@progbits     .align 4<\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e: \u043b\u0438\u0448\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u0433\u043e\u0432\u043e\u0440\u044f\u0449\u0438\u0439 \u0447\u0442\u043e \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>__gxx_personality_v0<\/strong> \u043a\u0430\u043a \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0434\u0430\u0435\u0442 \u043b\u0438\u043d\u043a\u0435\u0440\u0443 \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0435\u043a\u0446\u0438\u044e <strong>.gcc_except_table<\/strong>. <\/p>\n<p>  \u0414\u0432\u0438\u0433\u0430\u0435\u043c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435:<\/p>\n<pre><code>.local_lsda_1:     # \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041d\u0430\u0441 \u044d\u0442\u043e \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442     .byte   0xff      # \u042d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0430\u0447\u0430\u043b\u043e landing pads; \u0435\u0441\u043b\u0438 0, func's ptr     # \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043e (_Unwind_GetRegionStart)     .byte   0      # \u0414\u043b\u0438\u043d\u0430 \u0437\u043e\u043d\u044b LSDA: \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0447\u0442\u043e LLSDATT1 \u0438 LLSDATTD1 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442     # \u043a\u043e\u043d\u0435\u0446 \u0438 \u043d\u0430\u0447\u0430\u043b\u043e LSDA, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e     .uleb128 .local_lsda_end - .local_lsda_call_site_table_header <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u0443\u0436\u0435 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u042d\u0442\u0438 \u043c\u0435\u0442\u043a\u0438 \u0432\u0435\u0441\u044c\u043c\u0430 \u0440\u0430\u0441\u043f\u043b\u044b\u0432\u0447\u0438\u0432\u044b, \u043d\u043e \u043e\u043d\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u0443. LSDA \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u0443\u044e \u0434\u043b\u044f \u044f\u0437\u044b\u043a\u0430 \u0437\u043e\u043d\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, L \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 &quot;\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e&quot;, \u0442\u0430\u043a \u0447\u0442\u043e \u044d\u0442\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 (\u0434\u043b\u044f \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f, .o \u0444\u0430\u0439\u043b). \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u043e\u043d\u044b \u043d\u043e\u043c\u0435\u0440 \u043e\u0434\u0438\u043d. \u041f\u0440\u043e\u0447\u0438\u0435 \u043c\u0435\u0442\u043a\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u044d\u0442\u043e\u043c\u0443 \u0436\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0443, \u043d\u043e \u044f \u043d\u0435 \u0432\u0437\u044f\u043b\u0441\u044f \u0437\u0430 \u0438\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435. \u0414\u0430 \u0438 \u043e\u043d\u0438, \u0432 \u043e\u0431\u0449\u0435\u043c \u0442\u043e, \u043d\u0430\u043c \u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b.<\/p>\n<pre><code>.local_lsda_call_site_table_header:     # Encoding of items in the landing pad table. Again, we don't care.     .byte   0x1.      # The length of the call site table (ie the landing pads)     .uleb128 .local_lsda_call_site_table_end - .local_lsda_call_site_table<\/code><\/pre>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u043a\u0443\u0447\u043d\u044b\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u0438\u0434\u0435\u043c \u0434\u0430\u043b\u0435\u0435:<\/p>\n<pre><code>.local_lsda_call_site_table:     .uleb128 .LEHB0-.LFB1     .uleb128 .LEHE0-.LEHB0     .uleb128 .L8-.LFB1     .uleb128 0x1      .uleb128 .LEHB1-.LFB1     .uleb128 .LEHE1-.LEHB1     .uleb128 0     .uleb128 0      .uleb128 .LEHB2-.LFB1     .uleb128 .LEHE2-.LEHB2     .uleb128 .L9-.LFB1     .uleb128 0 .local_lsda_call_site_table_end:<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0442\u0443\u0442 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0432\u043e\u043e\u0447\u0438. \u041a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u043e \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0439\u0442\u0438 \u0441\u0432\u043e\u0439 landing pad. \u0412 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435\u0439 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435, \u0444\u043e\u0440\u043c\u0430\u0442 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u0438\u0441\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435:<\/p>\n<pre><code>struct lsda_call_site_entry {     \/\/ \u0421\u0442\u0430\u0440\u0442 IP \u043e\u0431\u043b\u0430\u0441\u0442\u0438      size_t cs_start;      \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 IP \u043e\u0431\u043b\u0430\u0441\u0442\u0438     size_t cs_len;      \/\/ Landing pad \u0430\u0434\u0440\u0435\u0441     size_t cs_lp;      \/\/ \u0421\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439     size_t cs_action; };<\/code><\/pre>\n<p>  \u0427\u0442\u043e \u0436, \u043f\u043e\u0445\u043e\u0436\u0435 \u043c\u044b \u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043f\u0443\u0442\u0438, \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043c\u044b \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u0443\u0442 3 \u0442\u043e\u0447\u043a\u0438 \u0432\u0445\u043e\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d langing pad. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0447\u0438\u0442\u0435\u0440\u0438\u0442\u044c: \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044f \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f CFI \u0431\u0443\u0434\u0443\u0442 \u043c\u0435\u043d\u0435\u0435, \u0447\u0435\u043c 128, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e LEB-\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u043a\u0430\u043a uchars. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0430\u0448 \u043a\u043e\u0434 \u0447\u0442\u0435\u043d\u0438\u044f CFI \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u043e\u0449\u0435, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043d\u0430\u0448\u0435\u0439 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u0430\u043b\u0435\u0435.<\/p>\n<h1>C++ exceptions \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c: \u0438 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e, \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u0438 \u0432 C++<\/h1>\n<p>  \u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438: \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438, \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e __gxx_personality_v0, \u0443\u043c\u0435\u044e\u0449\u0443\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438, \u0442\u0430\u043a \u0436\u0435 \u0441\u043e\u043e\u0431\u0449\u0430\u044e\u0449\u0443\u044e \u0440\u0430\u0437\u0432\u043e\u0440\u043e\u0442\u0447\u0438\u043a\u0443 \u0441\u0442\u0435\u043a\u0430 \u043a\u043e\u0433\u0434\u0430 \u0435\u043c\u0443 \u0441\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f, \u043d\u043e \u043e\u043d\u0430 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 catch-\u0431\u043b\u043e\u043a. \u0422\u0430\u043a \u0436\u0435 \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0447\u0438\u0442\u0430\u0442\u044c LSDA, \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u044d\u0442\u043e \u0432\u0441\u0435 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c!<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439 \u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 \u044d\u0442\u043e\u0433\u043e \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043d\u0430 \u0432\u0435\u0440\u043d\u043e\u043c \u043b\u0438 \u043c\u044b \u043f\u0443\u0442\u0438 (\u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 uint8, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u043d\u0435 \u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439):<\/p>\n<pre><code>struct LSDA_Header {     uint8_t lsda_start_encoding;     uint8_t lsda_type_encoding;     uint8_t lsda_call_site_table_length; };  struct LSDA_Call_Site_Header {     uint8_t encoding;     uint8_t length; };  struct LSDA_Call_Site {      LSDA_Call_Site(const uint8_t *ptr) {         cs_start = ptr[0];         cs_len = ptr[1];         cs_lp = ptr[2];         cs_action = ptr[3];     }      uint8_t cs_start;     uint8_t cs_len;     uint8_t cs_lp;     uint8_t cs_action; };  _Unwind_Reason_Code __gxx_personality_v0 (                      int version, _Unwind_Action actions, uint64_t exceptionClass,                      _Unwind_Exception* unwind_exception, _Unwind_Context* context) {     if (actions &amp; _UA_SEARCH_PHASE)     {         printf(&quot;Personality function, lookup phase\\n&quot;);         return _URC_HANDLER_FOUND;     } else if (actions &amp; _UA_CLEANUP_PHASE) {         printf(&quot;Personality function, cleanup\\n&quot;);          const uint8_t* lsda = (const uint8_t*)                                     _Unwind_GetLanguageSpecificData(context);          LSDA_Header *header = (LSDA_Header*)(lsda);         LSDA_Call_Site_Header *cs_header = (LSDA_Call_Site_Header*)                                                 (lsda + sizeof(LSDA_Header));          size_t cs_in_table = cs_header-&gt;length \/ sizeof(LSDA_Call_Site);          \/\/ \u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c cs_table_base \u043a\u0430\u043a uint8, \u043c\u044b \u0440\u0438\u0441\u043a\u0443\u0435\u043c \u043d\u0430\u0442\u043a\u043d\u0443\u0442\u044c\u0441\u044f         \/\/ \u043d\u0430 \u043d\u0435\u0432\u044b\u0440\u0430\u0432\u043d\u0435\u043d\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f         const uint8_t *cs_table_base = lsda + sizeof(LSDA_Header)                                             + sizeof(LSDA_Call_Site_Header);          \/\/ \u041f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u0447\u0435\u0440\u0435\u0437 \u0432\u0441\u044e call site \u0442\u0430\u0431\u043b\u0438\u0446\u0443         for (size_t i=0; i &lt; cs_in_table; ++i)         {             const uint8_t *offset = &amp;cs_table_base[i * sizeof(LSDA_Call_Site)];             LSDA_Call_Site cs(offset);             printf(&quot;Found a CS:\\n&quot;);             printf(&quot;\\tcs_start: %i\\n&quot;, cs.cs_start);             printf(&quot;\\tcs_len: %i\\n&quot;, cs.cs_len);             printf(&quot;\\tcs_lp: %i\\n&quot;, cs.cs_lp);             printf(&quot;\\tcs_action: %i\\n&quot;, cs.cs_action);         }          uintptr_t ip = _Unwind_GetIP(context);         uintptr_t funcStart = _Unwind_GetRegionStart(context);         uintptr_t ipOffset = ip - funcStart;          return _URC_INSTALL_CONTEXT;     } else {         printf(&quot;Personality function, error\\n&quot;);         return _URC_FATAL_PHASE1_ERROR;     } } }<\/code><\/pre>\n<p>  <a href=\"https:\/\/github.com\/nicolasbrailo\/cpp_exception_handling_abi\/blob\/master\/abi_v05\/mycppabi.cpp\">\u0410\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434<\/a><\/p>\n<p>  \u041a\u0430\u043a \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c (\u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434) \u0432\u0441\u0435 \u0442\u043e\u0447\u043a\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u043d\u044b\u0435. \u041e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0435\u0433\u043e? \u0421\u0442\u0430\u0440\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c EIP (\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438) \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e landing pad, \u0432\u0441\u0435 \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u2014 \u044d\u0442\u043e \u0441\u043b\u043e\u0436\u0438\u0442\u044c: _Unwind_GetRegionStart + LSDA_Call_Site.cs_Ip!<\/p>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u043d\u0430\u0448\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443: \u0434\u0430\u0432\u0430\u0439 \u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043d\u0430\u0448\u0443 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 landing pad. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0443\u044e <em>Unwind<\/em> \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0447\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u043e\u0442\u043a\u0443\u0434\u0430 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435: <strong>_Unwind_SetIP<\/strong>. \u0418\u0437\u043c\u0435\u043d\u0438\u043c \u043d\u0430\u0448\u0443 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u043d\u043e\u0432\u0430, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 landing pad.<\/p>\n<pre><code>const uint8_t *cs_table_base = lsda + sizeof(LSDA_Header)                                     + sizeof(LSDA_Call_Site_Header); for (size_t i=0; i &lt; cs_in_table; ++i) {     const uint8_t *offset = &amp;cs_table_base[i * sizeof(LSDA_Call_Site)];     LSDA_Call_Site cs(offset);      if (cs.cs_lp)     {         uintptr_t func_start = _Unwind_GetRegionStart(context);         _Unwind_SetIP(context, func_start + cs.cs_lp);         break;     } }  return _URC_INSTALL_CONTEXT;<\/code><\/pre>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0439\u0442\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0432\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. \u041c\u043e\u0436\u0435\u0442\u0435 \u0443\u0433\u0430\u0434\u0430\u0442\u044c \u0447\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a? \u041e\u0442\u0432\u0435\u0442 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0433\u043b\u0430\u0432\u0435!<\/p>\n<h1>C++ exceptions \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c: \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043b\u044f landing pad<\/h1>\n<p>  \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0433\u043b\u0430\u0432\u0435 \u043c\u044b \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043f\u043e\u0447\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0443\u044e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0444\u0440\u0435\u0439\u043c \u0441\u0442\u044d\u043a\u0430 \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 landing pads, \u0438, \u0437\u0430\u0442\u0435\u043c, \u0433\u043e\u0432\u043e\u0440\u0438\u043c <em>Unwind<\/em> \u0447\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443: \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 <em>Unwind<\/em> \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u043c landing pad \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440. \u042d\u0442\u043e, \u0432 \u043e\u0431\u0449\u0435\u043c \u0442\u043e, \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e landing pad \u043d\u0435 \u0445\u043e\u0447\u0435\u0442 \u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043e, \u0442\u0430\u043a \u0447\u0442\u043e \u043e\u043d \u0441\u043a\u0430\u0436\u0435\u0442 \u043b\u0438\u0448\u044c &quot;\u042f \u043d\u0435 \u043c\u043e\u0433\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u044d\u0442\u043e&quot;. <em>Unwind<\/em> \u0442\u043e\u0433\u0434\u0430 \u0441\u043a\u0430\u0436\u0435\u0442 &quot;\u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 landing pad&quot;, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0430\u0448 ABI \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442, \u0447\u0442\u043e \u0443 \u043d\u0435\u0433\u043e \u0434\u0430\u0436\u0435 \u043d\u0435\u0442 \u0438\u0434\u0435\u0439 \u043a\u0430\u043a \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430\u0439\u0442\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 landing pad, \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u043f\u043e\u0434\u0441\u0443\u043d\u0443\u0442\u044c \u0442\u043e\u0442 \u0436\u0435. \u0421\u043d\u043e\u0432\u0430 \u0438 \u0441\u043d\u043e\u0432\u0430. \u041c\u044b, \u043f\u043e\u0445\u043e\u0436\u0435, \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b\u0438 \u0441\u0430\u043c\u044b\u0439 \u043d\u0430\u0434\u0443\u043c\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f while(true)!<\/p>\n<p>  \u0418\u0441\u043f\u0440\u0430\u0432\u0438\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f landing pad \u0438 \u0447\u0443\u0442\u044c \u0443\u043b\u0443\u0447\u0448\u0438\u043c \u043d\u0430\u0448 ABI:<\/p>\n<pre><code>#include &lt;unistd.h&gt; #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;stdint.h&gt;  namespace __cxxabiv1 {     struct __class_type_info {         virtual void foo() {}     } ti; }  #define EXCEPTION_BUFF_SIZE 255 char exception_buff[EXCEPTION_BUFF_SIZE];  extern &quot;C&quot; {  void* __cxa_allocate_exception(size_t thrown_size) {     printf(&quot;alloc ex %i\\n&quot;, thrown_size);     if (thrown_size &gt; EXCEPTION_BUFF_SIZE) printf(&quot;Exception too big&quot;);     return &amp;exception_buff; }  void __cxa_free_exception(void *thrown_exception);  #include &lt;unwind.h&gt;  typedef void (*unexpected_handler)(void); typedef void (*terminate_handler)(void);  struct __cxa_exception {      std::type_info *    exceptionType;     void (*exceptionDestructor) (void *);      unexpected_handler  unexpectedHandler;     terminate_handler   terminateHandler;     __cxa_exception *   nextException;      int         handlerCount;     int         handlerSwitchValue;     const char *        actionRecord;     const char *        languageSpecificData;     void *          catchTemp;     void *          adjustedPtr;      _Unwind_Exception   unwindHeader; };  void __cxa_throw(void* thrown_exception,                  struct type_info *tinfo,                  void (*dest)(void*)) {     printf(&quot;__cxa_throw called\\n&quot;);      __cxa_exception *header = ((__cxa_exception *) thrown_exception - 1);     _Unwind_RaiseException(&amp;header-&gt;unwindHeader);      \/\/ __cxa_throw never returns     printf(&quot;no one handled __cxa_throw, terminate!\\n&quot;);     exit(0); }  void __cxa_begin_catch() {     printf(&quot;begin FTW\\n&quot;); }  void __cxa_end_catch() {     printf(&quot;end FTW\\n&quot;); }  \/**********************************************\/  \/**  * The LSDA is a read only place in memory; we'll create a typedef for  * this to avoid a const mess later on; LSDA_ptr refers to readonly and  * &amp;LSDA_ptr will be a non-const pointer to a const place in memory  *\/ typedef const uint8_t* LSDA_ptr;  struct LSDA_Header {     \/**      * Read the LSDA table into a struct; advances the lsda pointer      * as many bytes as read      *\/     LSDA_Header(LSDA_ptr *lsda) {         LSDA_ptr read_ptr = *lsda;          \/\/ Copy the LSDA fields         start_encoding = read_ptr[0];         type_encoding = read_ptr[1];         ttype = read_ptr[2];          \/\/ Advance the lsda pointer         *lsda = read_ptr + sizeof(LSDA_Header);     }      uint8_t start_encoding;     uint8_t type_encoding;     uint8_t ttype; };  struct LSDA_CS_Header {     \/\/ Same as other LSDA constructors     LSDA_CS_Header(LSDA_ptr *lsda) {         LSDA_ptr read_ptr = *lsda;         encoding = read_ptr[0];         length = read_ptr[1];         *lsda = read_ptr + sizeof(LSDA_CS_Header);     }      uint8_t encoding;     uint8_t length; };  struct LSDA_CS {     \/\/ Same as other LSDA constructors     LSDA_CS(LSDA_ptr *lsda) {         LSDA_ptr read_ptr = *lsda;         start = read_ptr[0];         len = read_ptr[1];         lp = read_ptr[2];         action = read_ptr[3];         *lsda = read_ptr + sizeof(LSDA_CS);     }      \/\/ Note start, len and lp would be void*'s, but they are actually relative     \/\/ addresses: start and lp are relative to the start of the function, len     \/\/ is relative to start      \/\/ Offset into function from which we could handle a throw     uint8_t start;     \/\/ Length of the block that might throw     uint8_t len;     \/\/ Landing pad     uint8_t lp;     \/\/ Offset into action table + 1 (0 means no action)     \/\/ Used to run destructors     uint8_t action; };  \/**********************************************\/  _Unwind_Reason_Code __gxx_personality_v0 (                              int version,                              _Unwind_Action actions,                              uint64_t exceptionClass,                              _Unwind_Exception* unwind_exception,                              _Unwind_Context* context) {     if (actions &amp; _UA_SEARCH_PHASE)     {         printf(&quot;Personality function, lookup phase\\n&quot;);         return _URC_HANDLER_FOUND;     } else if (actions &amp; _UA_CLEANUP_PHASE) {         printf(&quot;Personality function, cleanup\\n&quot;);          \/\/ Pointer to the beginning of the raw LSDA         LSDA_ptr lsda = (uint8_t*)_Unwind_GetLanguageSpecificData(context);          \/\/ Read LSDA headerfor the LSDA         LSDA_Header header(&amp;lsda);          \/\/ Read the LSDA CS header         LSDA_CS_Header cs_header(&amp;lsda);          \/\/ Calculate where the end of the LSDA CS table is         const LSDA_ptr lsda_cs_table_end = lsda + cs_header.length;          \/\/ Loop through each entry in the CS table         while (lsda &lt; lsda_cs_table_end)         {             LSDA_CS cs(&amp;lsda);              if (cs.lp)             {                 int r0 = __builtin_eh_return_data_regno(0);                 int r1 = __builtin_eh_return_data_regno(1);                  _Unwind_SetGR(context, r0, (uintptr_t)(unwind_exception));                 \/\/ Note the following code hardcodes the exception type;                 \/\/ we'll fix that later on                 _Unwind_SetGR(context, r1, (uintptr_t)(1));                  uintptr_t func_start = _Unwind_GetRegionStart(context);                 _Unwind_SetIP(context, func_start + cs.lp);                 break;             }         }          return _URC_INSTALL_CONTEXT;     } else {         printf(&quot;Personality function, error\\n&quot;);         return _URC_FATAL_PHASE1_ERROR;     } }  }<\/code><\/pre>\n<p>  <a href=\"https:\/\/github.com\/nicolasbrailo\/cpp_exception_handling_abi\/tree\/master\/abi_v06\">\u0410\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f<\/a> \u043a\u043e\u0434\u0430 \u0438 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u0435\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 <a href=\"http:\/\/mentorembedded.github.io\/cxx-abi\/exceptions.pdf\">\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 LSDA<\/a>.<\/p>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442! \u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<pre><code>.\/app alloc ex 1 __cxa_throw called Personality function, lookup phase Personality function, cleanup begin FTW Caught a Fake_Exception! end FTW try_but_dont_catch handled the exception catchit handled the exception<\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043c\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u043c\u0430\u043d\u0443\u043b\u0438 <em>Unwind<\/em>: \u043c\u044b \u0441\u043a\u0430\u0437\u0430\u043b\u0438 \u0435\u043c\u0443, \u0447\u0442\u043e \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u043e\u0434\u0440\u044f\u0434 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0436\u0435 catch \u0431\u043b\u043e\u043a\u0435. \u042d\u0442\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 catch(Exception&amp;) \u0432 catch(&#8230;) \u0438 \u0432\u0435\u0441\u044c \u0430\u0434 \u0441\u043e\u043a\u0440\u0443\u0448\u0438\u0442\u0441\u044f \u043d\u0430 \u043d\u0430\u0441, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432 \u0444\u0440\u0435\u0439\u043c\u0435 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 catch-\u0431\u043b\u043e\u043a\u0430. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043c\u044b \u043f\u0440\u043e\u0448\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e ABI!<\/p>\n<p>  \u041c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043d\u0430\u0448 \u043a\u043e\u0434 \u0438 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0435? \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435!<\/p>\n<p>  C++ exceptions \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c: \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e landing pads &amp; \u0443\u0447\u0435\u043d\u0438\u044f \u0433\u0443\u0440\u0443<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u044f\u0436\u0435\u043b\u043e\u0433\u043e \u043f\u0443\u0442\u0438, \u043c\u044b \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0443\u044e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0431\u0435\u0437 \u043f\u043e\u043c\u043e\u0449\u0438 lbstdc++. \u041e\u043d\u0430 \u0431\u0435\u0441\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442! \u041a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u2014 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0435\u0449\u0435 \u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u043b\u0438, \u043d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a LSDA, \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<pre><code>.local_lsda_call_site_table:     .uleb128 .LEHB0-.LFB1     .uleb128 .LEHE0-.LEHB0     .uleb128 .L8-.LFB1     .uleb128 0x1      .uleb128 .LEHB1-.LFB1     .uleb128 .LEHE1-.LEHB1     .uleb128 0     .uleb128 0      .uleb128 .LEHB2-.LFB1     .uleb128 .LEHE2-.LEHB2     .uleb128 .L9-.LFB1     .uleb128 0 .local_lsda_call_site_table_end:<\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u0442\u0440\u0438 landing pads, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043c\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 try\/catch \u0431\u043b\u043e\u043a. \u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442?<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0433\u043b\u0430\u0432\u0443, \u0442\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b LSDA_CS:<\/p>\n<pre><code>struct LSDA_CS {     \/\/ len \u0438 lp \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c void*'s, \u043e\u0434\u043d\u0430\u043a\u043e \u043e\u043d\u0438     \/\/ \u0430\u0434\u0440\u0435\u0441\u0430: start and lp \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b \u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, len     \/\/ \u043e\u0442\u043d\u043e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u0430      \/\/ \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443     uint8_t start;     \/\/ \u0434\u043b\u0438\u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430     uint8_t len;     \/\/ Landing pad     uint8_t lp;     \/\/ \u0421\u043c\u0435\u0449\u0435\u043d\u0438 action table + 1 (0 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 &quot;\u043d\u0435\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439&quot;)     \/\/ \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430     uint8_t action; }; <\/code><\/pre>\n<p>  \u041c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u0442\u0443\u0442, \u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u043e\u043b\u0435 \u0437\u0430 \u043f\u043e\u043b\u0435\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430:<\/p>\n<pre><code>void foo() {     L0:         try {             do_something();     L1:         } catch (const Exception1&amp; ex) {             ...         } catch (const Exception2&amp; ex) {             ...         } catch (const ExceptionN&amp; ex) {             ...         } catch (...) {         }     L2: }<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>Ip: \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0441 \u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0433\u0434\u0435 landing pad \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c L1 \u2014 addr_of(foo)<\/li>\n<li>action: \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u044d\u043a\u0430. \u041c\u044b \u043f\u043e\u043a\u0430 \u043d\u0435 \u0434\u043e\u0448\u043b\u0438 \u0434\u043e \u044d\u0442\u043e\u0433\u043e, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u043a\u0430 \u0447\u0442\u043e.<\/li>\n<li>start: \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0441 \u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0433\u0434\u0435 try-\u0431\u043b\u043e\u043a \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f. \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c L0 \u2014 addr_of(foo)<\/li>\n<li>len: \u0434\u043b\u0438\u043d\u0430 try-\u0431\u043b\u043e\u043a\u0430. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c L1-L0<\/li>\n<\/ul>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441 \u043f\u043e\u043b\u044f \u044d\u0442\u043e start \u0438 len: \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c try\/catch \u0431\u043b\u043e\u043a\u043e\u0432 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u2014 \u0441\u0442\u043e\u0438\u0442 \u043b\u0438 \u043d\u0430\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044f \u0441\u0442\u043e\u0438\u0442 \u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 (IP) \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0430 \u043c\u0435\u0436\u0434\u0443 start \u0438 start + len.<\/p>\n<p>  \u042d\u0442\u043e \u0440\u0430\u0437\u0440\u0443\u0448\u0430\u0435\u0442 \u043c\u0438\u0444 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 try\/catch \u0431\u043e\u043a\u043e\u0432 \u043c\u043e\u0436\u0443\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439, \u043d\u043e \u043c\u044b \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043d\u0435 \u0437\u043d\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441: \u043f\u043e\u0447\u0435\u043c\u0443 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e landing pad \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0442\u0440\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430? \u0414\u0440\u0443\u0433\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u043e\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0438\u043b\u0438 landing pad, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0431\u0440\u043e\u0448\u0435\u043d\u044b.<\/p>\n<p>  <a href=\"https:\/\/habrahabr.ru\/post\/279149\/\">\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435<\/a>         <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/279151\/\"> https:\/\/habrahabr.ru\/post\/279151\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u0431 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0432 \u0421++<\/p>\n<p>  <a href=\"https:\/\/habrahabr.ru\/post\/279111\/\">1 \u0447\u0430\u0441\u0442\u044c<\/a><br \/>  <a href=\"https:\/\/habrahabr.ru\/post\/279149\/\">3 \u0447\u0430\u0441\u0442\u044c<\/a><\/p>\n<h1>C++ exceptions \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c: \u043c\u0438\u043b\u0430\u044f \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/h1>\n<p>  \u041d\u0430\u0448\u0430 \u043f\u043e\u0435\u0437\u0434\u043a\u0430 \u0432 \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0438 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0435\u0449\u0435 \u0434\u0430\u043b\u0435\u043a\u0430 \u043e\u0442 \u043a\u043e\u043d\u0446\u0430, \u043d\u0430\u043c \u0435\u0449\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0435 &quot;call frame information&quot;, \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0449\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 Unwind \u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u044d\u043a\u0430, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u0438\u0448\u0435\u0442 \u0432 \u0447\u0435\u043c-\u0442\u043e, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u043c LSDA, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f, \u043a\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u0435\u0442\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c. \u0410 \u0442\u0430\u043a \u0436\u0435 \u043c\u044b \u0443\u0436\u0435 \u0443\u0437\u043d\u0430\u043b\u0438, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043c\u0430\u0433\u0438\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043f\u043e\u043a\u0430 \u0435\u0449\u0435 \u043d\u0435 \u0432\u0438\u0434\u0435\u043b\u0438 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438. \u0414\u0430\u0432\u0430\u0439 \u0442\u0435 \u0440\u0435\u0437\u044e\u043c\u0438\u0440\u0443\u0435\u043c, \u0447\u0442\u043e \u043c\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u0435\u043c \u043e \u043f\u0440\u043e\u0431\u0440\u043e\u0441\u0435 \u0438 \u043e\u0442\u043b\u043e\u0432\u0435 \u043e\u0448\u0438\u0431\u043e\u043a (\u0438\u043b\u0438, \u0442\u043e\u0447\u043d\u0435\u0435, \u0447\u0442\u043e \u043c\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u0435\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0431\u0440\u043e\u0448\u0435\u043d\u043d\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0447\u0435\u043d\u043e):<\/p>\n<ul>\n<li>\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 throw \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u043f\u0430\u0440\u0443 <strong><strong>cxa_allocate_exception\/<\/strong>xca_throw<\/strong><\/li>\n<li><strong>__cxa_allocate_exception<\/strong> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438<\/li>\n<li><strong>__cxa_throw<\/strong> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 \u043d\u0438\u0437\u043a\u043e-\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f, \u0432\u044b\u0437\u044b\u0432\u0430\u044f <em>_Unwind_RaiseException<\/em><\/li>\n<li>\u0420\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u044d\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 CFI, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u0441\u0435\u0439\u0447\u0430\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432 \u0441\u0442\u0435\u043a\u0435 <\/li>\n<li>\u041a\u0430\u0436\u0434\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 LSDA, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u0447\u0442\u043e-\u0442\u043e, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0435 <strong>.gcc_except_table<\/strong><\/li>\n<li>\u0420\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0444\u0440\u0435\u0439\u043c\u043e\u043c \u0441\u0442\u044d\u043a\u0430 \u0438 LSDA, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u0442\u044d\u043a, \u0435\u0441\u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430.<\/li>\n<\/ul>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-276007","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/276007","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=276007"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/276007\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=276007"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=276007"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=276007"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}