At the risk of abusing peoples tolerance for answering pesky questions; here is another pesky question:
What causes a SIGTRAP on a timer interrupt, and can we turn it off? To explain what is happening - the program has a timer routine periodically running in the background. We can set a breakpoint and the program will run until the breakpoint is reached (on a button press). However when we perform a next the debugger halts inside the timer routine (reporting that a SIGTRAP has occurred). We are then effectively locked inside this routine. A gdb session of the problem is given below. What is happening here? When we do a step or next is gdb for some reason setting the next break point to be within the timer routine? At this stage it looks like our options to debug this sort of program is to: (a) disable the timer routine (which kills a lot of the actual functionality that we want to test) or (b) step from instruction to instruction by setting breakpoints at consecutive instructions. How do other programs with background timer tasks get debugged? Again, thanks for any replies. aLUNZ Scott R&D Engineer - NOJA Power Switchgear Pty Ltd Tel: +61 7 3907 8777 Fax: +61 7 3890 0077 Web: www.nojapower.com.au <http://www.nojapower.com.au/> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *** set the breakpoint and then run to it. (gdb) b easyweb.c:205 Breakpoint 1 at 0x1832: file easyweb.c, line 205. (gdb) info breakpoint Num Type Disp Enb Address What 1 breakpoint keep y 0x00001832 in main at easyweb.c:205 (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. main () at easyweb.c:205 205 Delayx100us(50); *** breakpoint reached, next to the next instruction (gdb) n Program received signal SIGTRAP, Trace/breakpoint trap. TCPClockHandler () at tcpip.c:915 915 if (TAIV == 10) // check for timer over flow, reset int.-flag *** we are now in the timer routine, do a list to get the context (gdb) l 910 // inital sequence number generator (ISN) and the TCP-timer 911 912 //*alz* interrupt [TIMERA1_VECTOR] void TCPClockHandler(void) 913 interrupt (TIMERA1_VECTOR) TCPClockHandler(void) 914 { 915 if (TAIV == 10) // check for timer over flow, reset int.-flag 916 { 917 ISNGenHigh++; // upper 16 bits of initial sequence number 918 TCPTimer++; // timer for retransmissions 919 } *** try and get out of this routine (gdb) f #0 TCPClockHandler () at tcpip.c:915 915 if (TAIV == 10) // check for timer over flow, reset int.-flag (gdb) f #0 TCPClockHandler () at tcpip.c:915 915 if (TAIV == 10) // check for timer over flow, reset int.-flag (gdb)
