Return Type | Function name | Arguments |
---|---|---|
void | CatchCtrlC | (int,) |
Declared in file: hzProcess.h
Defined in file : hzProcess.cpp
Function Logic:
Function body:
void CatchCtrlC (int sig) { hzLogger* pLog ; hzProcess* phz ; void* pvArr[1024]; char** cpSym ; uint32_t pid ; uint32_t tid ; uint32_t nSize ; uint32_t nIndex ; pid = getpid() ; tid = pthread_self() ; nSize = backtrace(pvArr, 1023); cpSym = backtrace_symbols(pvArr, nSize); pLog = GetThreadLogger() ; phz = GetThreadInfo() ; if (!pLog) { printf("CatchCtrlC: %s\n", s_signals[sig]) ; printf("CatchCtrlC: Signal %d Process %u, thread %u\n", sig, pid, tid) ; printf("Stack Trace is:\n") ; for (nIndex = 0; nIndex < nSize ; nIndex++) puts(cpSym[nIndex]);; printf("Stack Trace end:\n") ; fflush(stdout); phz->StackTrace() ; } else { pLog->Log("CatchCtrlC: %s\n", s_signals[sig]) ; pLog->Out("Signal %d Process %u, thread %u\n", sig, pid, tid) ; pLog->Out("Stack Trace is:\n") ; for (nIndex = 0; nIndex < nSize ; nIndex++) pLog->Out("%s\n", cpSym[nIndex]) ; phz->StackTrace() ; pLog->Out("Stack Trace end:\n") ; } if (sig == 2) signal(sig, 0); else signal(sig, CatchCtrlC); }