Ignore:
Timestamp:
Feb 12, 2018, 11:57:55 AM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
fd062a66
Parents:
c40e7c5 (diff), cfe2f0a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/interpose.c

    rc40e7c5 rd56ca354  
    1010// Created On       : Wed Mar 29 16:10:31 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb  7 09:05:18 2018
    13 // Update Count     : 59
     12// Last Modified On : Thu Feb  8 16:18:09 2018
     13// Update Count     : 75
    1414//
    1515
     
    2828}
    2929
    30 #define __NO_ABORT_OVERLOAD // no abort overload avoid ambiguities
    3130#include "bits/debug.h"
    3231#include "bits/defs.h"
     
    5150                        error = dlerror();
    5251                        if ( error ) {
    53                                 abortf( "interpose_symbol : failed to open libc, %s\n", error );
     52                                abort( "interpose_symbol : failed to open libc, %s\n", error );
    5453                        }
    5554                #endif
     
    6968
    7069        error = dlerror();
    71         if ( error ) abortf( "interpose_symbol : internal error, %s\n", error );
     70        if ( error ) abort( "interpose_symbol : internal error, %s\n", error );
    7271
    7372        return originalFunc.fptr;
     
    9897
    9998struct {
    100         __typeof__( exit  ) exit  __attribute__(( noreturn ));
    101         __typeof__( abort ) abort __attribute__(( noreturn ));
     99        void (* exit)( int ) __attribute__ (( __noreturn__ ));
     100        void (* abort)( void ) __attribute__ (( __noreturn__ ));
    102101} __cabi_libc;
    103102
     
    123122
    124123// Forward declare abort after the __typeof__ call to avoid ambiguities
    125 void abort ( const char fmt[], ... ) __attribute__ ((__nothrow__, __leaf__, __noreturn__));
     124void exit( int status, const char fmt[], ... ) __attribute__ (( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ ));
     125void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
    126126
    127127extern "C" {
    128         void abort( void ) __attribute__ ((__nothrow__, __leaf__, __noreturn__)) {
    129                 abortf( NULL );
    130         }
    131 
    132         void abortf( const char fmt[], ... ) __attribute__ ((__nothrow__, __leaf__, __noreturn__)) {
     128        void abort( void ) __attribute__ (( __nothrow__, __leaf__, __noreturn__ )) {
     129                abort( NULL );
     130        }
     131
     132        void __cabi_abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )) {
    133133                va_list argp;
    134134                va_start( argp, fmt );
     
    137137        }
    138138
    139         void exit( int __status ) __attribute__ ((__nothrow__, __leaf__, __noreturn__)) {
    140                 __cabi_libc.exit(__status);
    141         }
    142 }
    143 
    144 void * kernel_abort    ( void ) __attribute__ ((__nothrow__, __leaf__, __weak__)) { return NULL; }
    145 void   kernel_abort_msg( void * data, char * buffer, int size ) __attribute__ ((__nothrow__, __leaf__, __weak__)) {}
    146 int kernel_abort_lastframe( void ) __attribute__ ((__nothrow__, __leaf__, __weak__)) { return 4; }
     139        void exit( int status ) __attribute__ (( __nothrow__, __leaf__, __noreturn__ )) {
     140                __cabi_libc.exit( status );
     141        }
     142}
     143
     144void * kernel_abort    ( void ) __attribute__ (( __nothrow__, __leaf__, __weak__ )) { return NULL; }
     145void   kernel_abort_msg( void * data, char * buffer, int size ) __attribute__ (( __nothrow__, __leaf__, __weak__ )) {}
     146int kernel_abort_lastframe( void ) __attribute__ (( __nothrow__, __leaf__, __weak__ )) { return 4; }
    147147
    148148enum { abort_text_size = 1024 };
     
    150150static int abort_lastframe;
    151151
    152 void abort( const char fmt[], ... ) __attribute__ ((__nothrow__, __leaf__, __noreturn__)) {
     152void exit( int status, const char fmt[], ... ) __attribute__ (( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ )) {
     153    va_list args;
     154    va_start( args, fmt );
     155    vfprintf( stderr, fmt, args );
     156    va_end( args );
     157        __cabi_libc.exit( status );
     158}
     159
     160void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )) {
    153161        void * kernel_data = kernel_abort();                    // must be done here to lock down kernel
    154162        int len;
     
    226234
    227235void sigHandler_segv( __CFA_SIGPARMS__ ) {
    228         abortf( "Addressing invalid memory at location %p\n"
     236        abort( "Addressing invalid memory at location %p\n"
    229237                        "Possible cause is reading outside the address space or writing to a protected area within the address space with an invalid pointer or subscript.\n",
    230238                        sfp->si_addr );
     
    232240
    233241void sigHandler_ill( __CFA_SIGPARMS__ ) {
    234         abortf( "Executing illegal instruction at location %p.\n"
     242        abort( "Executing illegal instruction at location %p.\n"
    235243                        "Possible cause is stack corruption.\n",
    236244                        sfp->si_addr );
     
    248256          default: msg = "unknown";
    249257        } // choose
    250         abortf( "Computation error %s at location %p.\n", msg, sfp->si_addr );
     258        abort( "Computation error %s at location %p.\n", msg, sfp->si_addr );
    251259}
    252260
Note: See TracChangeset for help on using the changeset viewer.