Changeset 6011658
- Timestamp:
- Dec 3, 2020, 3:15:55 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- fe9468e2
- Parents:
- 62e456f
- Location:
- libcfa/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel.cfa
r62e456f r6011658 619 619 lock( kernel_abort_lock __cfaabi_dbg_ctx2 ); 620 620 621 // disable interrupts, it no longer makes sense to try to interrupt this processor 622 disable_interrupts(); 623 621 624 // first task to abort ? 622 625 if ( kernel_abort_called ) { // not first task to abort ? -
libcfa/src/interpose.cfa
r62e456f r6011658 220 220 } 221 221 222 static volatile int __abort_stage = 0; 223 222 224 // Cannot forward va_list. 223 225 void __abort( bool signalAbort, const char fmt[], va_list args ) { 224 void * kernel_data = kernel_abort(); // must be done here to lock down kernel 225 int len; 226 227 signal( SIGABRT, SIG_DFL ); // prevent final "real" abort from recursing to handler 228 229 len = snprintf( abort_text, abort_text_size, "Cforall Runtime error (UNIX pid:%ld) ", (long int)getpid() ); // use UNIX pid (versus getPid) 230 __cfaabi_bits_write( STDERR_FILENO, abort_text, len ); 231 232 assert( fmt ); 233 len = vsnprintf( abort_text, abort_text_size, fmt, args ); 234 __cfaabi_bits_write( STDERR_FILENO, abort_text, len ); 235 236 if ( fmt[strlen( fmt ) - 1] != '\n' ) { // add optional newline if missing at the end of the format text 237 __cfaabi_bits_write( STDERR_FILENO, "\n", 1 ); 238 } // if 239 kernel_abort_msg( kernel_data, abort_text, abort_text_size ); 240 241 __cfaabi_backtrace( signalAbort ? 4 : 2 ); 242 243 __cabi_libc.abort(); // print stack trace in handler 226 int stage = __atomic_add_fetch( &__abort_stage, 1, __ATOMIC_SEQ_CST ); 227 228 // First stage: stop the cforall kernel and print 229 if(stage == 1) { 230 // increment stage 231 stage = __atomic_add_fetch( &__abort_stage, 1, __ATOMIC_SEQ_CST ); 232 233 // must be done here to lock down kernel 234 void * kernel_data = kernel_abort(); 235 int len; 236 237 signal( SIGABRT, SIG_DFL ); // prevent final "real" abort from recursing to handler 238 239 len = snprintf( abort_text, abort_text_size, "Cforall Runtime error (UNIX pid:%ld) ", (long int)getpid() ); // use UNIX pid (versus getPid) 240 __cfaabi_bits_write( STDERR_FILENO, abort_text, len ); 241 242 assert( fmt ); 243 len = vsnprintf( abort_text, abort_text_size, fmt, args ); 244 __cfaabi_bits_write( STDERR_FILENO, abort_text, len ); 245 246 // add optional newline if missing at the end of the format text 247 if ( fmt[strlen( fmt ) - 1] != '\n' ) { 248 __cfaabi_bits_write( STDERR_FILENO, "\n", 1 ); 249 } // if 250 kernel_abort_msg( kernel_data, abort_text, abort_text_size ); 251 } 252 253 // Second stage: print the backtrace 254 if(stage == 2) { 255 // increment stage 256 stage = __atomic_add_fetch( &__abort_stage, 1, __ATOMIC_SEQ_CST ); 257 258 // print stack trace in handler 259 __cfaabi_backtrace( signalAbort ? 4 : 2 ); 260 } 261 262 do { 263 // Finally call abort 264 __cabi_libc.abort(); 265 266 // Loop so that we never return 267 } while(true); 244 268 } 245 269
Note: See TracChangeset
for help on using the changeset viewer.