Signal handler for segmentation error. Assumes UNIX type OS. Returns: None Note: This function is never called by the application but is instead passed as a function pointer to signal during initialization where it surplants the default interupt handler for the given signal.

Return TypeFunction nameArguments
voidCatchSegVio(int32_t,)

Declared in file: hzProcess.h
Defined in file : hzProcess.cpp

Function Logic:

0:START 1:items items nSize cpSym pid tid pLog phz 2:unknown 3:items items items 4:unknown 5:items 6:items items items 7:items items items 8:unknown 9:items 10:items items 11:items 12: No text

Function body:

void CatchSegVio (int32_t sig)
{
   //  Category: Process
   //  
   //  Signal handler for segmentation error. Assumes UNIX type OS.
   //  
   //  Arguments: 1) sig  The incoming signal.
   //  Returns: None
   //  
   //  Note: This function is never called by the application but is instead passed as a function pointer to signal during initialization where it
   //    surplants the default interupt handler for the given signal.
   hzLogger*   pLog ;          //  Current thread logger
   hzProcess*  phz ;           //  Current thread info
   void*       pvArr[1024];//  Backtrace
   char**      cpSym ;         //  Backtrace symbols
   uint32_t    pid ;           //  Process id
   uint32_t    tid ;           //  Thread id
   uint32_t    nSize ;         //  Backtrace array size
   uint32_t    nIndex ;        //  Symbols iterator
   printf("SEGMENT VIOLATION\n") ;
   fflush(stdout);
   nSize = backtrace(pvArr, 1023);
   cpSym = backtrace_symbols(pvArr, nSize);
   pid = getpid() ;
   tid = pthread_self() ;
   pLog = GetThreadLogger() ;
   phz = GetThreadInfo() ;
   if (!pLog)
   {
       printf("1 CatchSegVio: %s\n", s_signals[sig]) ;
       printf("1 CatchSegVio: Signal %d Process %u, thread %u\n", sig, pid, tid) ;
       printf("1 Stack Trace is:\n") ;
       for (nIndex = 0; nIndex < nSize ; nIndex++)
           printf("%d - %s\n", nIndex, cpSym[nIndex]) ;
       printf("1 Stack Trace end:\n") ;
       fflush(stdout);
       phz->StackTrace() ;
   }
   else
   {
       pLog->Out("2 CatchSegVio: %s\n", s_signals[sig]) ;
       pLog->Out("2 CatchSegVio: Signal %d Process %u, thread %u\n", sig, pid, tid) ;
       pLog->Out("2 Stack Trace is:\n") ;
       for (nIndex = 0; nIndex < nSize ; nIndex++)
           pLog->Out("%d - %s\n", nIndex, cpSym[nIndex]) ;
       phz->StackTrace() ;
       pLog->Out("2 Stack Trace end:\n") ;
       //  phz->CallHistory() ;
       //  pLog->Out("2 Call History end:\n") ;
   }
   exit(100);
}