source: libcfa/src/exception.c @ d119d613

arm-ehjacob/cs343-translationnew-ast-unique-expr
Last change on this file since d119d613 was d119d613, checked in by Andrew Beach <ajbeach@…>, 16 months ago

Reorganized the exception and concurrency overlap.

  • Property mode set to 100644
File size: 21.7 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// exception.c --
8//
9// Author           : Andrew Beach
10// Created On       : Mon Jun 26 15:13:00 2017
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Fri Aug 21 11:27:56 2020
13// Update Count     : 29
14//
15
16// Normally we would get this from the CFA prelude.
17#include <stddef.h> // for size_t
18
19#include "exception.h"
20
21// Implementation of the secret header is hardware dependent.
22#if defined( __x86_64 ) || defined( __i386 )
23#elif defined( __ARM_ARCH )
24#warning FIX ME: check if anything needed for ARM
25#else
26#warning Exception Handling: No known architecture detected.
27#endif
28
29#include <stdlib.h>
30#include <stdio.h>
31#include <unwind.h>
32#include <bits/debug.hfa>
33#include "concurrency/invoke.h"
34#include "stdhdr/assert.h"
35
36// FIX ME: temporary hack to keep ARM build working
37#ifndef _URC_FATAL_PHASE1_ERROR
38#define _URC_FATAL_PHASE1_ERROR 3
39#endif // ! _URC_FATAL_PHASE1_ERROR
40#ifndef _URC_FATAL_PHASE2_ERROR
41#define _URC_FATAL_PHASE2_ERROR 2
42#endif // ! _URC_FATAL_PHASE2_ERROR
43
44#include "lsda.h"
45
46/* The exception class for our exceptions. Because of the vendor component
47 * its value would not be standard.
48 * Vendor: UWPL
49 * Language: CFA\0
50 */
51const _Unwind_Exception_Class __cfaehm_exception_class = 0x4c50575500414643;
52
53// Base exception vtable is abstract, you should not have base exceptions.
54struct __cfaehm_base_exception_t_vtable
55                ___cfaehm_base_exception_t_vtable_instance = {
56        .parent = NULL,
57        .size = 0,
58        .copy = NULL,
59        .free = NULL,
60        .msg = NULL
61};
62
63
64// Get the current exception context.
65// There can be a single global until multithreading occurs, then each stack
66// needs its own. We get this from libcfathreads (no weak attribute).
67__attribute__((weak)) struct exception_context_t * this_exception_context() {
68        static struct exception_context_t shared_stack = {NULL, NULL};
69        return &shared_stack;
70}
71
72
73// RESUMPTION ================================================================
74
75static void reset_top_resume(struct __cfaehm_try_resume_node ** store) {
76        this_exception_context()->top_resume = *store;
77}
78
79void __cfaehm_throw_resume(exception_t * except, void (*defaultHandler)(exception_t *)) {
80        struct exception_context_t * context = this_exception_context();
81
82        __cfadbg_print_safe(exception, "Throwing resumption exception\n");
83
84        {
85                __attribute__((cleanup(reset_top_resume)))
86                struct __cfaehm_try_resume_node * original_head = context->top_resume;
87                struct __cfaehm_try_resume_node * current = context->top_resume;
88
89                for ( ; current ; current = current->next) {
90                        context->top_resume = current->next;
91                        if (current->handler(except)) {
92                                return;
93                        }
94                }
95        } // End the search and return to the top of the stack.
96
97        // No handler found, fall back to the default operation.
98        __cfadbg_print_safe(exception, "Unhandled exception\n");
99        defaultHandler(except);
100}
101
102// Do we control where exceptions get thrown even with concurency?
103// If not these are not quite thread safe, the cleanup hook has to
104// be added after the node is built but before it is made the top node.
105
106void __cfaehm_try_resume_setup(struct __cfaehm_try_resume_node * node,
107                        _Bool (*handler)(exception_t * except)) {
108        struct exception_context_t * context = this_exception_context();
109        node->next = context->top_resume;
110        node->handler = handler;
111        context->top_resume = node;
112}
113
114void __cfaehm_try_resume_cleanup(struct __cfaehm_try_resume_node * node) {
115        struct exception_context_t * context = this_exception_context();
116        context->top_resume = node->next;
117}
118
119
120// MEMORY MANAGEMENT =========================================================
121
122struct __cfaehm_node {
123        struct _Unwind_Exception unwind_exception;
124        struct __cfaehm_node * next;
125        int handler_index;
126};
127
128#define NODE_TO_EXCEPT(node) ((exception_t *)(1 + (node)))
129#define EXCEPT_TO_NODE(except) ((struct __cfaehm_node *)(except) - 1)
130#define UNWIND_TO_NODE(unwind) ((struct __cfaehm_node *)(unwind))
131#define NULL_MAP(map, ptr) ((ptr) ? (map(ptr)) : NULL)
132
133// How to clean up an exception in various situations.
134static void __cfaehm_exception_cleanup(
135                _Unwind_Reason_Code reason,
136                struct _Unwind_Exception * exception) {
137        switch (reason) {
138        case _URC_FOREIGN_EXCEPTION_CAUGHT:
139                // This one we could clean-up to allow cross-language exceptions.
140        case _URC_FATAL_PHASE1_ERROR:
141        case _URC_FATAL_PHASE2_ERROR:
142        default:
143                abort();
144        }
145}
146
147// Creates a copy of the indicated exception and sets current_exception to it.
148static void __cfaehm_allocate_exception( exception_t * except ) {
149        struct exception_context_t * context = this_exception_context();
150
151        // Allocate memory for the exception.
152        struct __cfaehm_node * store = malloc(
153                sizeof( struct __cfaehm_node ) + except->virtual_table->size );
154
155        if ( ! store ) {
156                // Failure: cannot allocate exception. Terminate thread.
157                abort(); // <- Although I think it might be the process.
158        }
159
160        // Initialize the node:
161        exception_t * except_store = NODE_TO_EXCEPT(store);
162        store->unwind_exception.exception_class = __cfaehm_exception_class;
163        store->unwind_exception.exception_cleanup = __cfaehm_exception_cleanup;
164        store->handler_index = 0;
165        except->virtual_table->copy( except_store, except );
166
167        // Add the node to the list:
168        store->next = NULL_MAP(EXCEPT_TO_NODE, context->current_exception);
169        context->current_exception = except_store;
170}
171
172// Delete the provided exception, unsetting current_exception if relivant.
173static void __cfaehm_delete_exception( exception_t * except ) {
174        struct exception_context_t * context = this_exception_context();
175
176        __cfadbg_print_safe(exception, "Deleting Exception\n");
177
178        // Remove the exception from the list.
179        struct __cfaehm_node * to_free = EXCEPT_TO_NODE(except);
180        struct __cfaehm_node * node;
181
182        if ( context->current_exception == except ) {
183                node = to_free->next;
184                context->current_exception = NULL_MAP(NODE_TO_EXCEPT, node);
185        } else {
186                node = EXCEPT_TO_NODE(context->current_exception);
187                // It may always be in the first or second position.
188                while ( to_free != node->next ) {
189                        node = node->next;
190                }
191                node->next = to_free->next;
192        }
193
194        // Free the old exception node.
195        except->virtual_table->free( except );
196        free( to_free );
197}
198
199// CANCELLATION ==============================================================
200
201// Function needed by force unwind
202// It basically says to unwind the whole stack and then exit when we reach the end of the stack
203static _Unwind_Reason_Code _Stop_Fn(
204                int version,
205                _Unwind_Action actions,
206                _Unwind_Exception_Class exception_class,
207                struct _Unwind_Exception * unwind_exception,
208                struct _Unwind_Context * unwind_context,
209                void * stop_param) {
210        // Verify actions follow the rules we expect.
211        verify(actions & _UA_CLEANUP_PHASE);
212        verify(actions & _UA_FORCE_UNWIND);
213        verify(!(actions & _UA_SEARCH_PHASE));
214        verify(!(actions & _UA_HANDLER_FRAME));
215
216        if ( actions & _UA_END_OF_STACK ) {
217                abort();
218        } else {
219                return _URC_NO_REASON;
220        }
221}
222
223__attribute__((weak)) _Unwind_Reason_Code
224__cfaehm_cancellation_unwind( struct _Unwind_Exception * exception ) {
225        return _Unwind_ForcedUnwind( exception, _Stop_Fn, (void*)0x22 );
226}
227
228// Cancel the current stack, prefroming approprate clean-up and messaging.
229void __cfaehm_cancel_stack( exception_t * exception ) {
230        __cfaehm_allocate_exception( exception );
231
232        struct exception_context_t * context = this_exception_context();
233        struct __cfaehm_node * node = EXCEPT_TO_NODE(context->current_exception);
234
235        // Preform clean-up of any extra active exceptions.
236        while ( node->next ) {
237                struct __cfaehm_node * to_free = node->next;
238                node->next = to_free->next;
239                exception_t * except = NODE_TO_EXCEPT( to_free );
240                except->virtual_table->free( except );
241            free( to_free );
242        }
243
244        _Unwind_Reason_Code ret;
245        ret = __cfaehm_cancellation_unwind( &node->unwind_exception );
246        printf("UNWIND ERROR %d after force unwind\n", ret);
247        abort();
248}
249
250
251// TERMINATION ===============================================================
252
253// If this isn't a rethrow (*except==0), delete the provided exception.
254void __cfaehm_cleanup_terminate( void * except ) {
255        if ( *(void**)except ) __cfaehm_delete_exception( *(exception_t **)except );
256}
257
258static void __cfaehm_cleanup_default( exception_t ** except ) {
259        __cfaehm_delete_exception( *except );
260        *except = NULL;
261}
262
263// The exception that is being thrown must already be stored.
264static void __cfaehm_begin_unwind(void(*defaultHandler)(exception_t *)) {
265        struct exception_context_t * context = this_exception_context();
266        if ( NULL == context->current_exception ) {
267                printf("UNWIND ERROR missing exception in begin unwind\n");
268                abort();
269        }
270        struct _Unwind_Exception * storage =
271                &EXCEPT_TO_NODE(context->current_exception)->unwind_exception;
272
273        // Call stdlibc to raise the exception
274        __cfadbg_print_safe(exception, "Begin unwinding (storage &p, context %p)\n", storage, context);
275        _Unwind_Reason_Code ret = _Unwind_RaiseException( storage );
276
277        // If we reach here it means something happened. For resumption to work we need to find a way
278        // to return back to here. Most of them will probably boil down to setting a global flag and
279        // making the phase 1 either stop or fail. Causing an error on purpose may help avoiding
280        // unnecessary work but it might have some weird side effects. If we just pretend no handler
281        // was found that would work but may be expensive for no reason since we will always search
282        // the whole stack.
283
284        // We did not simply reach the end of the stack without finding a handler. This is an error.
285        if ( ret != _URC_END_OF_STACK ) {
286                printf("UNWIND ERROR %d after raise exception\n", ret);
287                abort();
288        }
289
290        // No handler found, go to the default operation.
291        __cfadbg_print_safe(exception, "Uncaught exception %p\n", storage);
292
293        __attribute__((cleanup(__cfaehm_cleanup_default)))
294        exception_t * exception = context->current_exception;
295        defaultHandler( exception );
296}
297
298void __cfaehm_throw_terminate( exception_t * val, void (*defaultHandler)(exception_t *) ) {
299        __cfadbg_print_safe(exception, "Throwing termination exception\n");
300
301        __cfaehm_allocate_exception( val );
302        __cfaehm_begin_unwind( defaultHandler );
303}
304
305static __attribute__((noreturn)) void __cfaehm_rethrow_adapter( exception_t * except ) {
306        // TODO: Print some error message.
307        (void)except;
308        abort();
309}
310
311void __cfaehm_rethrow_terminate(void) {
312        __cfadbg_print_safe(exception, "Rethrowing termination exception\n");
313
314        __cfaehm_begin_unwind( __cfaehm_rethrow_adapter );
315        abort();
316}
317
318#if defined( __x86_64 ) || defined( __i386 )
319// This is our personality routine. For every stack frame annotated with
320// ".cfi_personality 0x3,__gcfa_personality_v0" this function will be called twice when unwinding.
321//  Once in the search phase and once in the cleanup phase.
322_Unwind_Reason_Code __gcfa_personality_v0(
323                int version,
324                _Unwind_Action actions,
325                unsigned long long exception_class,
326                struct _Unwind_Exception * unwind_exception,
327                struct _Unwind_Context * unwind_context)
328{
329
330        //__cfadbg_print_safe(exception, "CFA: 0x%lx\n", _Unwind_GetCFA(context));
331        __cfadbg_print_safe(exception, "Personality function (%d, %x, %llu, %p, %p):",
332                        version, actions, exception_class, unwind_exception, unwind_context);
333
334        // Verify that actions follow the rules we expect.
335        // This function should never be called at the end of the stack.
336        verify(!(actions & _UA_END_OF_STACK));
337        // Either only the search phase flag is set or...
338        if (actions & _UA_SEARCH_PHASE) {
339                verify(actions == _UA_SEARCH_PHASE);
340                __cfadbg_print_safe(exception, " lookup phase");
341        // ... we are in clean-up phase.
342        } else {
343                verify(actions & _UA_CLEANUP_PHASE);
344                __cfadbg_print_safe(exception, " cleanup phase");
345                // We shouldn't be the handler frame during forced unwind.
346                if (actions & _UA_HANDLER_FRAME) {
347                        verify(!(actions & _UA_FORCE_UNWIND));
348                        __cfadbg_print_safe(exception, " (handler frame)");
349                } else if (actions & _UA_FORCE_UNWIND) {
350                        __cfadbg_print_safe(exception, " (force unwind)");
351                }
352        }
353
354        // Get a pointer to the language specific data from which we will read what we need
355        const unsigned char * lsd = _Unwind_GetLanguageSpecificData( unwind_context );
356
357        if ( !lsd ) {   //Nothing to do, keep unwinding
358                printf(" no LSD");
359                goto UNWIND;
360        }
361
362        // Get the instuction pointer and a reading pointer into the exception table
363        lsda_header_info lsd_info;
364        const unsigned char * cur_ptr = parse_lsda_header(unwind_context, lsd, &lsd_info);
365        _Unwind_Ptr instruction_ptr = _Unwind_GetIP(unwind_context);
366
367        struct exception_context_t * context = this_exception_context();
368
369        // Linearly search the table for stuff to do
370        while ( cur_ptr < lsd_info.action_table ) {
371                _Unwind_Ptr callsite_start;
372                _Unwind_Ptr callsite_len;
373                _Unwind_Ptr callsite_landing_pad;
374                _uleb128_t  callsite_action;
375
376                // Decode the common stuff we have in here
377                cur_ptr = read_encoded_value(0, lsd_info.call_site_encoding, cur_ptr, &callsite_start);
378                cur_ptr = read_encoded_value(0, lsd_info.call_site_encoding, cur_ptr, &callsite_len);
379                cur_ptr = read_encoded_value(0, lsd_info.call_site_encoding, cur_ptr, &callsite_landing_pad);
380                cur_ptr = read_uleb128(cur_ptr, &callsite_action);
381
382                // Have we reach the correct frame info yet?
383                if ( lsd_info.Start + callsite_start + callsite_len < instruction_ptr ) {
384#ifdef __CFA_DEBUG_PRINT__
385                        void * ls = (void*)lsd_info.Start;
386                        void * cs = (void*)callsite_start;
387                        void * cl = (void*)callsite_len;
388                        void * bp = (void*)lsd_info.Start + callsite_start;
389                        void * ep = (void*)lsd_info.Start + callsite_start + callsite_len;
390                        void * ip = (void*)instruction_ptr;
391                        __cfadbg_print_safe(exception, "\nfound %p - %p (%p, %p, %p), looking for %p\n",
392                                        bp, ep, ls, cs, cl, ip);
393#endif // __CFA_DEBUG_PRINT__
394                        continue;
395                }
396
397                // Have we gone too far?
398                if ( lsd_info.Start + callsite_start > instruction_ptr ) {
399                        printf(" gone too far");
400                        break;
401                }
402
403                // Check for what we must do:
404                if ( 0 == callsite_landing_pad ) {
405                        // Nothing to do, move along
406                        __cfadbg_print_safe(exception, " no landing pad");
407                } else if (actions & _UA_SEARCH_PHASE) {
408                        // In search phase, these means we found a potential handler we must check.
409
410                        // We have arbitrarily decided that 0 means nothing to do and 1 means there is
411                        // a potential handler. This doesn't seem to conflict the gcc default behavior.
412                        if (callsite_action != 0) {
413                                // Now we want to run some code to see if the handler matches
414                                // This is the tricky part where we want to the power to run arbitrary code
415                                // However, generating a new exception table entry and try routine every time
416                                // is way more expansive than we might like
417                                // The information we have is :
418                                //  - The GR (Series of registers)
419                                //    GR1=GP Global Pointer of frame ref by context
420                                //  - The instruction pointer
421                                //  - The instruction pointer info (???)
422                                //  - The CFA (Canonical Frame Address)
423                                //  - The BSP (Probably the base stack pointer)
424
425                                // The current apprach uses one exception table entry per try block
426                                _uleb128_t imatcher;
427                                // Get the relative offset to the {...}?
428                                cur_ptr = read_uleb128(cur_ptr, &imatcher);
429
430                                _Unwind_Word match_pos =
431#                               if defined( __x86_64 )
432                                    _Unwind_GetCFA(unwind_context) + 8;
433#                               elif defined( __i386 )
434                                    _Unwind_GetCFA(unwind_context) + 24;
435#                               elif defined( __ARM_ARCH )
436#                                   warning FIX ME: check if anything needed for ARM
437                                    42;
438#                               endif
439                                int (*matcher)(exception_t *) = *(int(**)(exception_t *))match_pos;
440
441                                int index = matcher(context->current_exception);
442                                _Unwind_Reason_Code ret = (0 == index)
443                                        ? _URC_CONTINUE_UNWIND : _URC_HANDLER_FOUND;
444                                UNWIND_TO_NODE(unwind_exception)->handler_index = index;
445
446                                // Based on the return value, check if we matched the exception
447                                if (ret == _URC_HANDLER_FOUND) {
448                                        __cfadbg_print_safe(exception, " handler found\n");
449                                } else {
450                                        // TODO: Continue the search if there is more in the table.
451                                        __cfadbg_print_safe(exception, " no handler\n");
452                                }
453                                return ret;
454                        }
455
456                        // This is only a cleanup handler, ignore it
457                        __cfadbg_print_safe(exception, " no action");
458                } else {
459                        // In clean-up phase, no destructors here but this could be the handler.
460
461                        if ( (callsite_action != 0) && !(actions & _UA_HANDLER_FRAME) ){
462                                // If this is a potential exception handler
463                                // but not the one that matched the exception in the seach phase,
464                                // just ignore it
465                                goto UNWIND;
466                        }
467
468                        // We need to run some clean-up or a handler
469                        // These statment do the right thing but I don't know any specifics at all
470                        _Unwind_SetGR( unwind_context, __builtin_eh_return_data_regno(0),
471                                (_Unwind_Ptr)unwind_exception );
472                        _Unwind_SetGR( unwind_context, __builtin_eh_return_data_regno(1), 0 );
473
474                        // I assume this sets the instruction pointer to the adress of the landing pad
475                        // It doesn't actually set it, it only state the value that needs to be set once we
476                        // return _URC_INSTALL_CONTEXT
477                        _Unwind_SetIP( unwind_context, ((lsd_info.LPStart) + (callsite_landing_pad)) );
478
479                        __cfadbg_print_safe(exception, " action\n");
480
481                        // Return have some action to run
482                        return _URC_INSTALL_CONTEXT;
483                }
484        }
485        // No handling found
486        __cfadbg_print_safe(exception, " table end reached");
487
488        UNWIND:
489        __cfadbg_print_safe(exception, " unwind\n");
490
491        // Keep unwinding the stack
492        return _URC_CONTINUE_UNWIND;
493}
494
495#pragma GCC push_options
496#pragma GCC optimize(0)
497
498// Try statements are hoisted out see comments for details. While this could probably be unique
499// and simply linked from libcfa but there is one problem left, see the exception table for details
500__attribute__((noinline))
501void __cfaehm_try_terminate(void (*try_block)(),
502                void (*catch_block)(int index, exception_t * except),
503                __attribute__((unused)) int (*match_block)(exception_t * except)) {
504        //! volatile int xy = 0;
505        //! printf("%p %p %p %p\n", &try_block, &catch_block, &match_block, &xy);
506
507        // Setup the personality routine and exception table.
508        // Unforturnately these clobber gcc cancellation support which means we can't get access to
509        // the attribute cleanup tables at the same time. We would have to inspect the assembly to
510        // create a new set ourselves.
511#ifdef __PIC__
512        asm volatile (".cfi_personality 0x9b,CFA.ref.__gcfa_personality_v0");
513        asm volatile (".cfi_lsda 0x1b, .LLSDACFA2");
514#else
515        asm volatile (".cfi_personality 0x3,__gcfa_personality_v0");
516        asm volatile (".cfi_lsda 0x3, .LLSDACFA2");
517#endif
518
519        // Label which defines the start of the area for which the handler is setup.
520        asm volatile (".TRYSTART:");
521
522        // The actual statements of the try blocks
523        try_block();
524
525        // asm statement to prevent deadcode removal
526        asm volatile goto ("" : : : : CATCH );
527
528        // Normal return for when there is no throw.
529        return;
530
531        // Exceptionnal path
532        CATCH : __attribute__(( unused ));
533        // Label which defines the end of the area for which the handler is setup.
534        asm volatile (".TRYEND:");
535        // Label which defines the start of the exception landing pad. Basically what is called when
536        // the exception is caught. Note, if multiple handlers are given, the multiplexing should be
537        // done by the generated code, not the exception runtime.
538        asm volatile (".CATCH:");
539
540        // Exception handler
541        // Note: Saving the exception context on the stack breaks termination exceptions.
542        catch_block( EXCEPT_TO_NODE( this_exception_context()->current_exception )->handler_index,
543                     this_exception_context()->current_exception );
544}
545
546// Exception table data we need to generate. While this is almost generic, the custom data refers
547// to {*}try_terminate, which is no way generic. Some more works need to be done if we want to
548// have a single call to the try routine.
549
550#ifdef __PIC__
551asm (
552        // HEADER
553        ".LFECFA1:\n"
554        "       .globl  __gcfa_personality_v0\n"
555        "       .section        .gcc_except_table,\"a\",@progbits\n"
556        // TABLE HEADER (important field is the BODY length at the end)
557        ".LLSDACFA2:\n"
558        "       .byte   0xff\n"
559        "       .byte   0xff\n"
560        "       .byte   0x1\n"
561        "       .uleb128 .LLSDACSECFA2-.LLSDACSBCFA2\n"
562        // BODY (language specific data)
563        // This uses language specific data and can be modified arbitrarily
564        // We use handled area offset, handled area length,
565        // handler landing pad offset and 1 (action code, gcc seems to use 0).
566        ".LLSDACSBCFA2:\n"
567        "       .uleb128 .TRYSTART-__cfaehm_try_terminate\n"
568        "       .uleb128 .TRYEND-.TRYSTART\n"
569        "       .uleb128 .CATCH-__cfaehm_try_terminate\n"
570        "       .uleb128 1\n"
571        ".LLSDACSECFA2:\n"
572        // TABLE FOOTER
573        "       .text\n"
574        "       .size   __cfaehm_try_terminate, .-__cfaehm_try_terminate\n"
575);
576
577// Somehow this piece of helps with the resolution of debug symbols.
578__attribute__((unused)) static const int dummy = 0;
579
580asm (
581        // Add a hidden symbol which points at the function.
582        "       .hidden CFA.ref.__gcfa_personality_v0\n"
583        "       .weak   CFA.ref.__gcfa_personality_v0\n"
584        // No clue what this does specifically
585        "       .section        .data.rel.local.CFA.ref.__gcfa_personality_v0,\"awG\",@progbits,CFA.ref.__gcfa_personality_v0,comdat\n"
586        "       .align 8\n"
587        "       .type CFA.ref.__gcfa_personality_v0, @object\n"
588        "       .size CFA.ref.__gcfa_personality_v0, 8\n"
589        "CFA.ref.__gcfa_personality_v0:\n"
590#if defined( __x86_64 )
591        "       .quad __gcfa_personality_v0\n"
592#else // then __i386
593        "       .long __gcfa_personality_v0\n"
594#endif
595);
596#else // __PIC__
597asm (
598        // HEADER
599        ".LFECFA1:\n"
600        "       .globl  __gcfa_personality_v0\n"
601        "       .section        .gcc_except_table,\"a\",@progbits\n"
602        // TABLE HEADER (important field is the BODY length at the end)
603        ".LLSDACFA2:\n"
604        "       .byte   0xff\n"
605        "       .byte   0xff\n"
606        "       .byte   0x1\n"
607        "       .uleb128 .LLSDACSECFA2-.LLSDACSBCFA2\n"
608        // BODY (language specific data)
609        ".LLSDACSBCFA2:\n"
610        //      Handled area start (relative to start of function)
611        "       .uleb128 .TRYSTART-__cfaehm_try_terminate\n"
612        //      Handled area length
613        "       .uleb128 .TRYEND-.TRYSTART\n"
614        //      Handler landing pad address (relative to start of function)
615        "       .uleb128 .CATCH-__cfaehm_try_terminate\n"
616        //      Action code, gcc seems to always use 0.
617        "       .uleb128 1\n"
618        // TABLE FOOTER
619        ".LLSDACSECFA2:\n"
620        "       .text\n"
621        "       .size   __cfaehm_try_terminate, .-__cfaehm_try_terminate\n"
622        "       .ident  \"GCC: (Ubuntu 6.2.0-3ubuntu11~16.04) 6.2.0 20160901\"\n"
623        "       .section        .note.GNU-stack,\"x\",@progbits\n"
624);
625#endif // __PIC__
626
627#pragma GCC pop_options
628#endif // __x86_64 || __i386
Note: See TracBrowser for help on using the repository browser.