Changes in / [5a73f0f:ffd0ac2]


Ignore:
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    r5a73f0f rffd0ac2  
    174174
    175175def notify_server(int wait) {
    176         sh """curl --silent --data "wait=${wait}" -X POST http://plg2:8082/jenkins/notify > /dev/null || true"""
     176        sh """curl --data "wait=${wait}" -X POST http://plg2:8082/jenkins/notify > /dev/null || true"""
    177177        return
    178178}
     
    324324
    325325                //Then publish the results
    326                 sh 'curl -H "Content-Type: application/json" --silent --data @bench.json http://plg2:8082/jenkins/publish > /dev/null || true'
     326                sh 'curl -H \'Content-Type: application/json\' --data @bench.json http://plg2:8082/jenkins/publish > /dev/null || true'
    327327        }
    328328}
  • src/benchmark/Makefile.am

    r5a73f0f rffd0ac2  
    5959        @echo -e '\t"githash": "'${githash}'",'
    6060        @echo -e '\t"arch": "'   ${arch}   '",'
     61        @echo -e '\t"compile": {'
     62        @+make compile TIME_FORMAT='%e,' PRINT_FORMAT='\t\t\"%s\" :'
     63        @echo -e '\t\t"dummy" : {}'
     64        @echo -e '\t},'
    6165        @echo -e '\t"ctxswitch": {'
    6266        @echo -en '\t\t"coroutine":'
  • src/benchmark/Makefile.in

    r5a73f0f rffd0ac2  
    473473        @echo -e '\t"githash": "'${githash}'",'
    474474        @echo -e '\t"arch": "'   ${arch}   '",'
     475        @echo -e '\t"compile": {'
     476        @+make compile TIME_FORMAT='%e,' PRINT_FORMAT='\t\t\"%s\" :'
     477        @echo -e '\t\t"dummy" : {}'
     478        @echo -e '\t},'
    475479        @echo -e '\t"ctxswitch": {'
    476480        @echo -en '\t\t"coroutine":'
  • src/driver/cfa.cc

    r5a73f0f rffd0ac2  
    277277                args[nargs] = "--undefined=__cfaabi_dbg_bits_write";
    278278                nargs += 1;
     279                args[nargs] = "-Xlinker";
     280                nargs += 1;
     281                args[nargs] = "--undefined=__cfaabi_interpose_startup";
     282                nargs += 1;
    279283
    280284        } // if
  • src/libcfa/bits/locks.h

    r5a73f0f rffd0ac2  
    5858
    5959#ifdef __cforall
     60        extern "C" {
     61                extern void disable_interrupts();
     62                extern void enable_interrupts_noPoll();
     63        }
     64
    6065        extern void yield( unsigned int );
    6166        extern thread_local struct thread_desc *    volatile this_thread;
     67        extern thread_local struct processor *      volatile this_processor;
    6268
    6369        static inline void ?{}( __spinlock_t & this ) {
     
    6874        static inline _Bool try_lock  ( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
    6975                _Bool result = __lock_test_and_test_and_set( this.lock );
    70                 __cfaabi_dbg_debug_do(
    71                         if( result ) {
     76                if( result ) {
     77                        disable_interrupts();
     78                        __cfaabi_dbg_debug_do(
    7279                                this.prev_name = caller;
    7380                                this.prev_thrd = this_thread;
    74                         }
    75                 )
     81                        )
     82                }
    7683                return result;
    7784        }
     
    99106                        #endif
    100107                }
     108                disable_interrupts();
    101109                __cfaabi_dbg_debug_do(
    102110                        this.prev_name = caller;
     
    105113        }
    106114
    107         // Lock the spinlock, spin if already acquired
    108         static inline void lock_yield( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
    109                 for ( unsigned int i = 1;; i += 1 ) {
    110                         if ( __lock_test_and_test_and_set( this.lock ) ) break;
    111                         yield( i );
    112                 }
    113                 __cfaabi_dbg_debug_do(
    114                         this.prev_name = caller;
    115                         this.prev_thrd = this_thread;
    116                 )
    117         }
     115        // // Lock the spinlock, yield if already acquired
     116        // static inline void lock_yield( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
     117        //      for ( unsigned int i = 1;; i += 1 ) {
     118        //              if ( __lock_test_and_test_and_set( this.lock ) ) break;
     119        //              yield( i );
     120        //      }
     121        //      disable_interrupts();
     122        //      __cfaabi_dbg_debug_do(
     123        //              this.prev_name = caller;
     124        //              this.prev_thrd = this_thread;
     125        //      )
     126        // }
    118127
    119128        static inline void unlock( __spinlock_t & this ) {
     129                enable_interrupts_noPoll();
    120130                __lock_release( this.lock );
    121131        }
  • src/libcfa/concurrency/invoke.h

    r5a73f0f rffd0ac2  
    134134                // instrusive link field for threads
    135135                struct thread_desc * next;
     136
     137                __cfaabi_dbg_debug_do(
     138                        // instrusive link field for debugging
     139                        struct thread_desc * dbg_next;
     140                        struct thread_desc * dbg_prev;
     141                )
    136142     };
    137143
  • src/libcfa/concurrency/kernel.c

    r5a73f0f rffd0ac2  
    242242void finishRunning(processor * this) {
    243243        if( this->finish.action_code == Release ) {
     244                verify( disable_preempt_count > 1 );
    244245                unlock( *this->finish.lock );
    245246        }
     
    248249        }
    249250        else if( this->finish.action_code == Release_Schedule ) {
     251                verify( disable_preempt_count > 1 );
    250252                unlock( *this->finish.lock );
    251253                ScheduleThread( this->finish.thrd );
    252254        }
    253255        else if( this->finish.action_code == Release_Multi ) {
     256                verify( disable_preempt_count > this->finish.lock_count );
    254257                for(int i = 0; i < this->finish.lock_count; i++) {
    255258                        unlock( *this->finish.locks[i] );
     
    257260        }
    258261        else if( this->finish.action_code == Release_Multi_Schedule ) {
     262                verify( disable_preempt_count > this->finish.lock_count );
    259263                for(int i = 0; i < this->finish.lock_count; i++) {
    260264                        unlock( *this->finish.locks[i] );
     
    363367        this_processor->finish.lock = lock;
    364368
    365         verify( disable_preempt_count > 0 );
     369        verify( disable_preempt_count > 1 );
    366370        suspend();
    367371        verify( disable_preempt_count > 0 );
     
    391395        this_processor->finish.thrd = thrd;
    392396
    393         verify( disable_preempt_count > 0 );
     397        verify( disable_preempt_count > 1 );
    394398        suspend();
    395399        verify( disable_preempt_count > 0 );
     
    516520}
    517521
     522//=============================================================================================
     523// Unexpected Terminating logic
     524//=============================================================================================
     525
     526
    518527static __spinlock_t kernel_abort_lock;
    519528static __spinlock_t kernel_debug_lock;
     
    611620}
    612621
     622//-----------------------------------------------------------------------------
     623// Debug
     624__cfaabi_dbg_debug_do(
     625        struct {
     626                thread_desc * tail;
     627        } __cfaabi_dbg_thread_list = { NULL };
     628
     629        void __cfaabi_dbg_thread_register( thread_desc * thrd ) {
     630                if( !__cfaabi_dbg_thread_list.tail ) {
     631                        __cfaabi_dbg_thread_list.tail = thrd;
     632                        return;
     633                }
     634                __cfaabi_dbg_thread_list.tail->dbg_next = thrd;
     635                thrd->dbg_prev = __cfaabi_dbg_thread_list.tail;
     636                __cfaabi_dbg_thread_list.tail = thrd;
     637        }
     638
     639        void __cfaabi_dbg_thread_unregister( thread_desc * thrd ) {
     640                thread_desc * prev = thrd->dbg_prev;
     641                thread_desc * next = thrd->dbg_next;
     642
     643                if( next ) { next->dbg_prev = prev; }
     644                else       {
     645                        assert( __cfaabi_dbg_thread_list.tail == thrd );
     646                        __cfaabi_dbg_thread_list.tail = prev;
     647                }
     648
     649                if( prev ) { prev->dbg_next = next; }
     650
     651                thrd->dbg_prev = NULL;
     652                thrd->dbg_next = NULL;
     653        }
     654)
    613655// Local Variables: //
    614656// mode: c //
  • src/libcfa/concurrency/kernel_private.h

    r5a73f0f rffd0ac2  
    8585extern void ThreadCtxSwitch(coroutine_desc * src, coroutine_desc * dst);
    8686
     87__cfaabi_dbg_debug_do(
     88        extern void __cfaabi_dbg_thread_register  ( thread_desc * thrd );
     89        extern void __cfaabi_dbg_thread_unregister( thread_desc * thrd );
     90)
     91
    8792//-----------------------------------------------------------------------------
    8893// Utils
  • src/libcfa/concurrency/monitor.c

    r5a73f0f rffd0ac2  
    5353static inline __lock_size_t aggregate    ( monitor_desc * storage [], const __waitfor_mask_t & mask );
    5454
    55 #ifndef __CFA_LOCK_NO_YIELD
    56 #define DO_LOCK lock_yield
    57 #else
    58 #define DO_LOCK lock
    59 #endif
    60 
    6155//-----------------------------------------------------------------------------
    6256// Useful defines
     
    9084        static void __enter_monitor_desc( monitor_desc * this, const __monitor_group_t & group ) {
    9185                // Lock the monitor spinlock
    92                 DO_LOCK( this->lock __cfaabi_dbg_ctx2 );
     86                lock( this->lock __cfaabi_dbg_ctx2 );
    9387                thread_desc * thrd = this_thread;
     88
     89                verify( disable_preempt_count > 0 );
    9490
    9591                __cfaabi_dbg_print_safe("Kernel : %10p Entering mon %p (%p)\n", thrd, this, this->owner);
     
    121117                        // Some one else has the monitor, wait in line for it
    122118                        append( this->entry_queue, thrd );
     119
     120                        verify( disable_preempt_count > 0 );
     121
    123122                        BlockInternal( &this->lock );
    124123
     
    138137        static void __enter_monitor_dtor( monitor_desc * this, fptr_t func ) {
    139138                // Lock the monitor spinlock
    140                 DO_LOCK( this->lock __cfaabi_dbg_ctx2 );
     139                lock( this->lock __cfaabi_dbg_ctx2 );
    141140                thread_desc * thrd = this_thread;
    142141
     
    201200        // Leave single monitor
    202201        void __leave_monitor_desc( monitor_desc * this ) {
    203                 // Lock the monitor spinlock, DO_LOCK to reduce contention
    204                 DO_LOCK( this->lock __cfaabi_dbg_ctx2 );
     202                // Lock the monitor spinlock
     203                lock( this->lock __cfaabi_dbg_ctx2 );
    205204
    206205                __cfaabi_dbg_print_safe("Kernel : %10p Leaving mon %p (%p)\n", this_thread, this, this->owner);
     
    248247
    249248                // Lock the monitor now
    250                 DO_LOCK( this->lock __cfaabi_dbg_ctx2 );
     249                lock( this->lock __cfaabi_dbg_ctx2 );
    251250
    252251                disable_interrupts();
     
    397396        append( this.blocked, &waiter );
    398397
     398        verify( disable_preempt_count == 0 );
     399
    399400        // Lock all monitors (aggregates the locks as well)
    400401        lock_all( monitors, locks, count );
     402
     403        // verifyf( disable_preempt_count == count, "Got %d, expected %d\n", disable_preempt_count, count );
     404        if(disable_preempt_count != count) { __cfaabi_dbg_print_buffer_decl("----------Gonna crash\n"); }
    401405
    402406        // Find the next thread(s) to run
     
    473477        monitor_ctx( this.monitors, this.monitor_count );
    474478
     479        verify( disable_preempt_count == 0 );
     480
    475481        // Lock all monitors (aggregates the locks them as well)
    476482        lock_all( monitors, locks, count );
     483
     484        // verify( disable_preempt_count == count );
     485        if(disable_preempt_count != count) { __cfaabi_dbg_print_buffer_decl("----------Gonna crash\n"); }
     486
    477487
    478488        // Create the node specific to this wait operation
     
    737747static inline void lock_all( __spinlock_t * locks [], __lock_size_t count ) {
    738748        for( __lock_size_t i = 0; i < count; i++ ) {
    739                 DO_LOCK( *locks[i] __cfaabi_dbg_ctx2 );
     749                lock( *locks[i] __cfaabi_dbg_ctx2 );
    740750        }
    741751}
     
    744754        for( __lock_size_t i = 0; i < count; i++ ) {
    745755                __spinlock_t * l = &source[i]->lock;
    746                 DO_LOCK( *l __cfaabi_dbg_ctx2 );
     756                lock( *l __cfaabi_dbg_ctx2 );
    747757                if(locks) locks[i] = l;
    748758        }
  • src/libcfa/concurrency/preemption.c

    r5a73f0f rffd0ac2  
    1919extern "C" {
    2020#include <errno.h>
    21 #include <execinfo.h>
    22 #define __USE_GNU
    23 #include <signal.h>
    24 #undef __USE_GNU
    2521#include <stdio.h>
    2622#include <string.h>
     
    2925#undef ftype
    3026
    31 #ifdef __USE_STREAM__
    32 #include "fstream"
    33 #endif
     27#include "bits/signal.h"
    3428
    3529//TODO move to defaults
     
    4034        return __CFA_DEFAULT_PREEMPTION__;
    4135}
    42 
    43 // Short hands for signal context information
    44 #define __CFA_SIGCXT__ ucontext_t *
    45 #define __CFA_SIGPARMS__ __attribute__((unused)) int sig, __attribute__((unused)) siginfo_t *sfp, __attribute__((unused)) __CFA_SIGCXT__ cxt
    4636
    4737// FwdDeclarations : timeout handlers
     
    5343void sigHandler_segv     ( __CFA_SIGPARMS__ );
    5444void sigHandler_abort    ( __CFA_SIGPARMS__ );
    55 
    56 // FwdDeclarations : sigaction wrapper
    57 static void __kernel_sigaction( int sig, void (*handler)(__CFA_SIGPARMS__), int flags );
    5845
    5946// FwdDeclarations : alarm thread main
     
    182169        void enable_interrupts_noPoll() {
    183170                __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &disable_preempt_count, -1, __ATOMIC_SEQ_CST );
    184                 verify( prev != 0u );                     // If this triggers someone is enabled already enabled interrupts
     171                verifyf( prev != 0u, "Incremented from %u\n", prev );                     // If this triggers someone is enabled already enabled interrupts
    185172        }
    186173}
     
    246233        // Setup proper signal handlers
    247234        __kernel_sigaction( SIGUSR1, sigHandler_ctxSwitch, SA_SIGINFO | SA_RESTART );         // CtxSwitch handler
    248         // __kernel_sigaction( SIGSEGV, sigHandler_segv     , SA_SIGINFO );      // Failure handler
    249         // __kernel_sigaction( SIGBUS , sigHandler_segv     , SA_SIGINFO );      // Failure handler
    250235
    251236        signal_block( SIGALRM );
     
    308293        if( !preemption_ready() ) { return; }
    309294
    310         // __cfaabi_dbg_print_buffer_decl(" KERNEL: preempting core %p (%p).\n", this_processor, this_thread);
     295        __cfaabi_dbg_print_buffer_decl(" KERNEL: preempting core %p (%p).\n", this_processor, this_thread);
    311296
    312297        preemption_in_progress = true;                      // Sync flag : prevent recursive calls to the signal handler
     
    380365}
    381366
    382 // Sigaction wrapper : register an signal handler
    383 static void __kernel_sigaction( int sig, void (*handler)(__CFA_SIGPARMS__), int flags ) {
    384         struct sigaction act;
    385 
    386         act.sa_sigaction = (void (*)(int, siginfo_t *, void *))handler;
    387         act.sa_flags = flags;
    388 
    389         if ( sigaction( sig, &act, NULL ) == -1 ) {
    390                 __cfaabi_dbg_print_buffer_decl(
    391                         " __kernel_sigaction( sig:%d, handler:%p, flags:%d ), problem installing signal handler, error(%d) %s.\n",
    392                         sig, handler, flags, errno, strerror( errno )
    393                 );
    394                 _exit( EXIT_FAILURE );
    395         }
    396 }
    397 
    398 // Sigaction wrapper : restore default handler
    399 static void __kernel_sigdefault( int sig ) {
    400         struct sigaction act;
    401 
    402         act.sa_handler = SIG_DFL;
    403         act.sa_flags = 0;
    404         sigemptyset( &act.sa_mask );
    405 
    406         if ( sigaction( sig, &act, NULL ) == -1 ) {
    407                 __cfaabi_dbg_print_buffer_decl(
    408                         " __kernel_sigdefault( sig:%d ), problem reseting signal handler, error(%d) %s.\n",
    409                         sig, errno, strerror( errno )
    410                 );
    411                 _exit( EXIT_FAILURE );
    412         }
    413 }
    414 
    415 //=============================================================================================
    416 // Terminating Signals logic
    417 //=============================================================================================
    418 
    419 __cfaabi_dbg_debug_do(
    420         static void __kernel_backtrace( int start ) {
    421                 // skip first N stack frames
    422 
    423                 enum { Frames = 50 };
    424                 void * array[Frames];
    425                 int size = backtrace( array, Frames );
    426                 char ** messages = backtrace_symbols( array, size );
    427 
    428                 // find executable name
    429                 *index( messages[0], '(' ) = '\0';
    430                 #ifdef __USE_STREAM__
    431                 serr | "Stack back trace for:" | messages[0] | endl;
    432                 #else
    433                 fprintf( stderr, "Stack back trace for: %s\n", messages[0]);
    434                 #endif
    435 
    436                 // skip last 2 stack frames after main
    437                 for ( int i = start; i < size && messages != NULL; i += 1 ) {
    438                         char * name = NULL;
    439                         char * offset_begin = NULL;
    440                         char * offset_end = NULL;
    441 
    442                         for ( char *p = messages[i]; *p; ++p ) {
    443                                 // find parantheses and +offset
    444                                 if ( *p == '(' ) {
    445                                         name = p;
    446                                 }
    447                                 else if ( *p == '+' ) {
    448                                         offset_begin = p;
    449                                 }
    450                                 else if ( *p == ')' ) {
    451                                         offset_end = p;
    452                                         break;
    453                                 }
    454                         }
    455 
    456                         // if line contains symbol print it
    457                         int frameNo = i - start;
    458                         if ( name && offset_begin && offset_end && name < offset_begin ) {
    459                                 // delimit strings
    460                                 *name++ = '\0';
    461                                 *offset_begin++ = '\0';
    462                                 *offset_end++ = '\0';
    463 
    464                                 #ifdef __USE_STREAM__
    465                                 serr    | "("  | frameNo | ")" | messages[i] | ":"
    466                                         | name | "+" | offset_begin | offset_end | endl;
    467                                 #else
    468                                 fprintf( stderr, "(%i) %s : %s + %s %s\n", frameNo, messages[i], name, offset_begin, offset_end);
    469                                 #endif
    470                         }
    471                         // otherwise, print the whole line
    472                         else {
    473                                 #ifdef __USE_STREAM__
    474                                 serr | "(" | frameNo | ")" | messages[i] | endl;
    475                                 #else
    476                                 fprintf( stderr, "(%i) %s\n", frameNo, messages[i] );
    477                                 #endif
    478                         }
    479                 }
    480 
    481                 free( messages );
    482         }
    483 )
    484 
    485 // void sigHandler_segv( __CFA_SIGPARMS__ ) {
    486 //      __cfaabi_dbg_debug_do(
    487 //              #ifdef __USE_STREAM__
    488 //              serr    | "*CFA runtime error* program cfa-cpp terminated with"
    489 //                      | (sig == SIGSEGV ? "segment fault." : "bus error.")
    490 //                      | endl;
    491 //              #else
    492 //              fprintf( stderr, "*CFA runtime error* program cfa-cpp terminated with %s\n", sig == SIGSEGV ? "segment fault." : "bus error." );
    493 //              #endif
    494 
    495 //              // skip first 2 stack frames
    496 //              __kernel_backtrace( 1 );
    497 //      )
    498 //      exit( EXIT_FAILURE );
    499 // }
    500 
    501 // void sigHandler_abort( __CFA_SIGPARMS__ ) {
    502 //      // skip first 6 stack frames
    503 //      __cfaabi_dbg_debug_do( __kernel_backtrace( 6 ); )
    504 
    505 //      // reset default signal handler
    506 //      __kernel_sigdefault( SIGABRT );
    507 
    508 //      raise( SIGABRT );
    509 // }
    510 
    511367// Local Variables: //
    512368// mode: c //
  • src/libcfa/concurrency/thread.c

    r5a73f0f rffd0ac2  
    3333void ?{}(thread_desc& this) {
    3434        (this.self_cor){};
    35         this.self_cor.name = "Anonymous Coroutine";
     35        this.self_cor.name = "Anonymous Thread";
    3636        this.self_mon.owner = &this;
    3737        this.self_mon.recursion = 1;
    3838        this.self_mon_p = &this.self_mon;
    3939        this.next = NULL;
     40        __cfaabi_dbg_debug_do(
     41                this.dbg_next = NULL;
     42                this.dbg_prev = NULL;
     43                __cfaabi_dbg_thread_register(&this);
     44        )
    4045
    4146        (this.monitors){ &this.self_mon_p, 1, (fptr_t)0 };
     
    4348
    4449void ^?{}(thread_desc& this) {
     50        __cfaabi_dbg_debug_do(
     51                __cfaabi_dbg_thread_unregister(&this);
     52        )
    4553        ^(this.self_cor){};
    4654}
  • src/libcfa/interpose.c

    r5a73f0f rffd0ac2  
    2222#include <dlfcn.h>
    2323#include <unistd.h>
     24#define __USE_GNU
     25#include <signal.h>
     26#undef __USE_GNU
     27#include <execinfo.h>
    2428}
    2529
    2630#include "bits/debug.h"
    2731#include "bits/defs.h"
     32#include "bits/signal.h"
    2833#include "startup.h"
    2934
    30 void interpose_startup(void)  __attribute__(( constructor( STARTUP_PRIORITY_CORE ) ));
     35void __cfaabi_interpose_startup(void)  __attribute__(( constructor( STARTUP_PRIORITY_CORE ) ));
    3136
    3237typedef void (*generic_fptr_t)(void);
     
    8489#define INIT_REALRTN( x, ver ) assign_ptr( (void**)&libc_##x, #x, ver)
    8590
    86 void interpose_startup() {
     91void sigHandler_segv ( __CFA_SIGPARMS__ );
     92void sigHandler_abort( __CFA_SIGPARMS__ );
     93
     94void __cfaabi_interpose_startup() {
    8795        const char *version = NULL;
    8896
    8997        INIT_REALRTN( abort, version );
    9098        INIT_REALRTN( exit, version );
    91 }
     99
     100        __kernel_sigaction( SIGSEGV, sigHandler_segv , SA_SIGINFO );      // Failure handler
     101        __kernel_sigaction( SIGBUS , sigHandler_segv , SA_SIGINFO );      // Failure handler
     102        __kernel_sigaction( SIGABRT, sigHandler_abort, SA_SIGINFO );      // Failure handler
     103}
     104
     105//=============================================================================================
     106// Terminating Signals logic
     107//=============================================================================================
    92108
    93109extern "C" {
     
    137153                libc_abort();
    138154        }
     155}
     156
     157// skip first 6 stack frames by default
     158static void __kernel_backtrace() {
     159        // skip first N stack frames
     160        int start = 6;
     161
     162        enum { Frames = 50 };
     163        void * array[Frames];
     164        int size = backtrace( array, Frames );
     165        char ** messages = backtrace_symbols( array, size );
     166
     167        // find executable name
     168        *index( messages[0], '(' ) = '\0';
     169        __cfaabi_dbg_bits_print_nolock( "Stack back trace for: %s\n", messages[0]);
     170
     171        // skip last 2 stack frames after main
     172        for ( int i = start; i < size && messages != NULL; i += 1 ) {
     173                char * name = NULL;
     174                char * offset_begin = NULL;
     175                char * offset_end = NULL;
     176
     177                for ( char *p = messages[i]; *p; ++p ) {
     178                        // find parantheses and +offset
     179                        if ( *p == '(' ) {
     180                                name = p;
     181                        }
     182                        else if ( *p == '+' ) {
     183                                offset_begin = p;
     184                        }
     185                        else if ( *p == ')' ) {
     186                                offset_end = p;
     187                                break;
     188                        }
     189                }
     190
     191                // if line contains symbol print it
     192                int frameNo = i - start;
     193                if ( name && offset_begin && offset_end && name < offset_begin ) {
     194                        // delimit strings
     195                        *name++ = '\0';
     196                        *offset_begin++ = '\0';
     197                        *offset_end++ = '\0';
     198
     199                        __cfaabi_dbg_bits_print_nolock( "(%i) %s : %s + %s %s\n", frameNo, messages[i], name, offset_begin, offset_end);
     200                }
     201                // otherwise, print the whole line
     202                else {
     203                        __cfaabi_dbg_bits_print_nolock( "(%i) %s\n", frameNo, messages[i] );
     204                }
     205        }
     206
     207        free( messages );
     208}
     209
     210void sigHandler_segv( __CFA_SIGPARMS__ ) {
     211        // skip first only 1 stack frames in case of segfault.
     212        abortf( "*CFA runtime error* program cfa-cpp terminated with %s\n", sig == SIGSEGV ? "segment fault." : "bus error." );
     213}
     214
     215void sigHandler_abort( __CFA_SIGPARMS__ ) {
     216        __kernel_backtrace();
     217
     218        // reset default signal handler
     219        __kernel_sigdefault( SIGABRT );
     220
     221        raise( SIGABRT );
    139222}
    140223
Note: See TracChangeset for help on using the changeset viewer.