Changeset 3ecfa13 for libcfa/src/interpose.cfa
- Timestamp:
- Feb 8, 2020, 3:21:45 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 8c9da33
- Parents:
- 0f5da65 (diff), 74330e7 (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. - File:
-
- 1 edited
-
libcfa/src/interpose.cfa (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/interpose.cfa
r0f5da65 r3ecfa13 10 10 // Created On : Wed Mar 29 16:10:31 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jan 30 17:47:32202013 // Update Count : 1 5612 // Last Modified On : Sat Feb 8 08:40:34 2020 13 // Update Count : 163 14 14 // 15 15 … … 29 29 #include "bits/signal.hfa" // sigHandler_? 30 30 #include "startup.hfa" // STARTUP_PRIORITY_CORE 31 #include <assert.h> 31 32 32 33 //============================================================================================= … … 40 41 41 42 typedef void (* generic_fptr_t)(void); 42 generic_fptr_t interpose_symbol( const char * symbol, const char * version) {43 generic_fptr_t interpose_symbol( const char symbol[], const char version[] ) { 43 44 const char * error; 44 45 … … 145 146 extern "C" { 146 147 void abort( void ) __attribute__(( __nothrow__, __leaf__, __noreturn__ )) { 147 abort( false, NULL ); // FIX ME: 0p does not work148 abort( false, "%s", "" ); 148 149 } 149 150 … … 161 162 162 163 void * kernel_abort( void ) __attribute__(( __nothrow__, __leaf__, __weak__ )) { return 0p; } 163 void kernel_abort_msg( void * data, char * buffer, int size ) __attribute__(( __nothrow__, __leaf__, __weak__ )) {}164 void kernel_abort_msg( void * data, char buffer[], int size ) __attribute__(( __nothrow__, __leaf__, __weak__ )) {} 164 165 // See concurrency/kernel.cfa for strong definition used in multi-processor mode. 165 166 int kernel_abort_lastframe( void ) __attribute__(( __nothrow__, __leaf__, __weak__ )) { return 4; } … … 169 170 170 171 static void __cfaabi_backtrace( int start ) { 171 enum { 172 Frames = 50, // maximum number of stack frames 173 }; 172 enum { Frames = 50, }; // maximum number of stack frames 174 173 int last = kernel_abort_lastframe(); // skip last N stack frames 175 174 176 175 void * array[Frames]; 177 176 size_t size = backtrace( array, Frames ); 178 char ** messages = backtrace_symbols( array, size ); 177 char ** messages = backtrace_symbols( array, size ); // does not demangle names 179 178 180 179 *index( messages[0], '(' ) = '\0'; // find executable name … … 184 183 char * name = 0p, * offset_begin = 0p, * offset_end = 0p; 185 184 186 for ( char * p = messages[i]; *p; ++p ) {// find parantheses and +offset185 for ( char * p = messages[i]; *p; p += 1 ) { // find parantheses and +offset 187 186 //__cfaabi_bits_print_nolock( "X %s\n", p); 188 187 if ( *p == '(' ) { … … 228 227 __cfaabi_bits_write( STDERR_FILENO, abort_text, len ); 229 228 230 if ( fmt ) { 231 va_list args; 232 va_start( args, fmt ); 233 234 len = vsnprintf( abort_text, abort_text_size, fmt, args ); 235 va_end( args ); 236 __cfaabi_bits_write( STDERR_FILENO, abort_text, len ); 237 238 if ( fmt[strlen( fmt ) - 1] != '\n' ) { // add optional newline if missing at the end of the format text 239 __cfaabi_dbg_write( "\n", 1 ); 240 } 229 assert( fmt ); 230 va_list args; 231 va_start( args, fmt ); 232 233 len = vsnprintf( abort_text, abort_text_size, fmt, args ); 234 va_end( args ); 235 __cfaabi_bits_write( STDERR_FILENO, abort_text, len ); 236 237 if ( fmt[strlen( fmt ) - 1] != '\n' ) { // add optional newline if missing at the end of the format text 238 __cfaabi_dbg_write( "\n", 1 ); 241 239 } 242 240
Note:
See TracChangeset
for help on using the changeset viewer.