Changes in src/libcfa/interpose.c [169d944:3d5f2ef1]
- File:
-
- 1 edited
-
src/libcfa/interpose.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/interpose.c
r169d944 r3d5f2ef1 10 10 // Created On : Wed Mar 29 16:10:31 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 8 16:18:09201813 // Update Count : 7512 // Last Modified On : Wed Feb 7 09:05:18 2018 13 // Update Count : 59 14 14 // 15 15 … … 28 28 } 29 29 30 #define __NO_ABORT_OVERLOAD // no abort overload avoid ambiguities 30 31 #include "bits/debug.h" 31 32 #include "bits/defs.h" … … 50 51 error = dlerror(); 51 52 if ( error ) { 52 abort ( "interpose_symbol : failed to open libc, %s\n", error );53 abortf( "interpose_symbol : failed to open libc, %s\n", error ); 53 54 } 54 55 #endif … … 68 69 69 70 error = dlerror(); 70 if ( error ) abort ( "interpose_symbol : internal error, %s\n", error );71 if ( error ) abortf( "interpose_symbol : internal error, %s\n", error ); 71 72 72 73 return originalFunc.fptr; … … 97 98 98 99 struct { 99 void (* exit)( int ) __attribute__ (( __noreturn__));100 void (* abort)( void ) __attribute__ (( __noreturn__));100 __typeof__( exit ) exit __attribute__(( noreturn )); 101 __typeof__( abort ) abort __attribute__(( noreturn )); 101 102 } __cabi_libc; 102 103 … … 122 123 123 124 // Forward declare abort after the __typeof__ call to avoid ambiguities 124 void exit( int status, const char fmt[], ... ) __attribute__ (( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ )); 125 void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )); 125 void abort ( const char fmt[], ... ) __attribute__ ((__nothrow__, __leaf__, __noreturn__)); 126 126 127 127 extern "C" { 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__)) {128 void abort( void ) __attribute__ ((__nothrow__, __leaf__, __noreturn__)) { 129 abortf( NULL ); 130 } 131 132 void abortf( const char fmt[], ... ) __attribute__ ((__nothrow__, __leaf__, __noreturn__)) { 133 133 va_list argp; 134 134 va_start( argp, fmt ); … … 137 137 } 138 138 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 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; } 147 147 148 148 enum { abort_text_size = 1024 }; … … 150 150 static int abort_lastframe; 151 151 152 void 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 160 void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )) { 152 void abort( const char fmt[], ... ) __attribute__ ((__nothrow__, __leaf__, __noreturn__)) { 161 153 void * kernel_data = kernel_abort(); // must be done here to lock down kernel 162 154 int len; … … 234 226 235 227 void sigHandler_segv( __CFA_SIGPARMS__ ) { 236 abort ( "Addressing invalid memory at location %p\n"228 abortf( "Addressing invalid memory at location %p\n" 237 229 "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", 238 230 sfp->si_addr ); … … 240 232 241 233 void sigHandler_ill( __CFA_SIGPARMS__ ) { 242 abort ( "Executing illegal instruction at location %p.\n"234 abortf( "Executing illegal instruction at location %p.\n" 243 235 "Possible cause is stack corruption.\n", 244 236 sfp->si_addr ); … … 256 248 default: msg = "unknown"; 257 249 } // choose 258 abort ( "Computation error %s at location %p.\n", msg, sfp->si_addr );250 abortf( "Computation error %s at location %p.\n", msg, sfp->si_addr ); 259 251 } 260 252
Note:
See TracChangeset
for help on using the changeset viewer.