catch signal handler on V71

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

How do I intercept signal handler messages ??? I like and put debugging info on a LCD with my own custom function. I would halt the debugger when I get there.

 

 

Currently, I have my own HardFault_Handler that prints a few registers on my LCD. I am having crashes at the function pbuf_copy from LWIP and the call stack gives me the following:

 

V71myapp.elf! HardFault_Handler Line: 1252

V71myapp.elf! <signal handler called> Line 1252

V71myapp.elf! ??? Line 1252

V71myapp.elf!  pbuf_copy(struct pbuf* p_to, struct pbuf*p_from) Line 855

V71myapp.elf! ??? Line 855

 

Is there already a signal handler or not provided??? Am I getting a HardFault because I have no signal handler and it by default goes to the Hard Fault??? Is there an easy way for me to see more information like the signal number??

Thanks.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

> How do I intercept signal handler messages ???

> Is there an easy way for me to see more information like the signal number??

 

I answer some of my own questions. There is a way to register own own custom handler for the signal errors. The function signal() registers the callbacks. Here, I use the abort() function which raises signal number 6, i.e. SIGABRT with my compiler settings. Inside signal.h, there is a table which assigns different numbers according to the compiler setup.

 

I am making some progress with the call stack unwinding.  It needs -fno-omit-frame-pointer in the compiler miscellaneous other flags. That will go for another thread.

 

void testSignalAbort(void){
	abort();
}

 

#include <signal.h>
void mySignalHandler(int id){
		char buffer[160]; 

		if (isLcdInitialized){
			
			tft.clearScreen();
			tft.setCursor(0,0);
			tft.println("Signal Handler");
				
			snprintf(buffer, sizeof buffer, "id = %i", id );
			tft.println(buffer);
			
		}
		
		while (1) {
		}
	
}


void registerMySignalHandler(void){
	signal(SIGINT,mySignalHandler );
	signal(SIGILL,mySignalHandler );
	signal(SIGABRT,mySignalHandler );
	signal(SIGFPE,mySignalHandler );
	signal(SIGBUS,mySignalHandler );
	signal(SIGSEGV,mySignalHandler );   
	signal(SIGTERM,mySignalHandler );
	
	
}