crash_for_debug

Hi,I have set an breakpoint in the function crash_for_debug to find out the cause of a periodical system crash. The gdb stops in that function, but how can I determine the origin of the interrupt. According to the hardware manual, the link register (LR) should contain the program counter of the next instruction. But I does not ! What have I done wrong, or how can I get the information of the origin of the error. Thanks Alex For example : If I force the system with the command into a data abort with (volatile unsigned long) 0xFFFFFFF8 = 0x00FF001F; The registers before executing the line are : (netsilicon-gdb) info registers r0 0x33 0x33 r1 0x0 0x0 r2 0x4590 0x4590 r3 0x0 0x0 r4 0x0 0x0 r5 0x0 0x0 r6 0x0 0x0 r7 0x0 0x0 r8 0x0 0x0 r9 0x0 0x0 r10 0x2859a0 0x2859a0 r11 0x2867c4 0x2867c4 r12 0x2867c8 0x2867c8 sp 0x286798 0x286798 lr 0x11b0 0x11b0 pc 0x83b0 0x83b0 fps 0x0 0x0 cpsr 0x0 0x0 After entering the function crash_for_debug, the register contain the following information info registers r0 0x4 0x4 r1 0x0 0x0 r2 0xff001f 0xff001f r3 0xfffffff8 0xfffffff8 r4 0x0 0x0 r5 0x0 0x0 r6 0x0 0x0 r7 0x0 0x0 r8 0x0 0x0 r9 0x0 0x0 r10 0x2859a0 0x2859a0 r11 0x2867c4 0x2867c4 r12 0x2867c8 0x2867c8 sp 0x4283568 0x4283568 lr 0x5ea88 0x5ea88 pc 0x55274 0x55274 fps 0x0 0x0 cpsr 0x0 0x0 According to the manual, the lr register should contain the value 0x83b0(+4).

The interrupt branches into the reset vector. The reset vector contains the address for the assembler routine “Abort_Handler”. This routine decrements the LR Register by 4 and stores then all the register on the stack. After that, the assembler routine “crash” is called. The routine “crash” calls then the function “crash_for_debug”. If a break point is set at the entry of the function “crash_for_debug”, the LR will not contain the pc. Instead, LR register contains the pc for the next statement in the routine . To get information of the cause of a data abort you can examine the stack The gdb command > x/14xw $sp shows the 14 register which were stored on the stack. The last data contains the pc of the statement which caused the data abort. To jump back, to cause of the data abort, you just have to move the lr register to the pc register with the gdb command > set $pc=$lr and make one assembler step. Below are the routines Abort_Handler and crash : sub lr, lr, #4 ; 0x4 : mov r0, #4 ; 0x4 : stmdb sp!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, lr} : b 0x5ea74 : bl 0x55264 : ldmia sp!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, pc}