Exemplo n.º 1
0
static void exception_throw(chk_expn_frame *frame,const char *exception,siginfo_t* info) {
	int32_t sig = 0;
	char    buff[256];
	if(!frame) {
		//非rethrow,打印日志
        if(exception == segfault)
    	    snprintf(buff,256," [exception:%s <invaild access addr:%p>]\n",
                             segfault,info->si_addr);
        else
    	    snprintf(buff,256," [exception:%s]\n",exception);		
		_log_stack(LOG_ERROR,3,buff);
		frame = chk_exp_top();
	}
	if(frame) {
		frame->exception = exception;
		frame->is_process = 0;
		if(exception == segfault) sig = SIGSEGV;
		else if(exception == sigbug) sig = SIGBUS;
		else if(exception == sigfpe) sig = SIGFPE;  
		siglongjmp(frame->jumpbuffer,sig);
	}else {
		//没有try,直接终止进程
		exit(0);
	}		
}
Exemplo n.º 2
0
void chk_exp_log_exption_stack() {
	char    buff[256];
	chk_expn_thd *expthd = chk_exp_get_thread_expn();
	if(!expthd->sz) return;
    if(expthd->exception == segfault)
    	snprintf(buff,256," [exception:%s <invaild access addr:%p>]",
                 segfault,expthd->addr);
    else
    	snprintf(buff,256," [exception:%s]",expthd->exception);	
	_log_stack(LOG_ERROR,3,buff,expthd->bt);
}
Exemplo n.º 3
0
void chk_exp_log_stack() {
	_log_stack(LOG_DEBUG,2," [call_stack]\n");
}
Exemplo n.º 4
0
void chk_exp_log_call_stack(const char *discription) {
	_log_stack(LOG_DEBUG,2,discription,NULL);
}