Better stack traces
PATCH 1/1 Better stack traces
This patch improves the stack traces we get on PPC64 by putting a marker in those stack frames that are created as a result of an interrupt or exception. The marker is "regshere" (0x7265677368657265).
With this, stack traces show where exceptions have occurred, which can be very useful. This also improves the accuracy of the trace because the relevant return address can be in the link register at the time of the exception rather than on the stack. We now print the PC and exception type for each exception frame, and then the link register if appropriate as the next item in the trace.
Please apply.
Thanks,
Paul.
arch/ppc64/kernel/head.S +4 -0
@@ -1281,6 +1281,10 @@ SAVE_4GPRS(16, r1) SAVE_8GPRS(24, r1) + /* Set the marker value "regshere" just before the reg values */ + SET_REG_TO_CONST(r22, 0x7265677368657265) + std r22,STACK_FRAME_OVERHEAD-16(r1) + /* * Clear the RESULT field */
arch/ppc64/kernel/process.c +41 -17
95 lines not on this page · raw message
arch/ppc64/xmon/xmon.c +1 -8
@@ -1399,8 +1399,7 @@/* Look for "regshere" marker to see if this is an exception frame. */ -if (newsp - sp ==sizeof (struct pt_regs ) +400 - &&mread (sp +0x60 , &marker,sizeof (unsigned long )) +if (mread (sp +0x60 , &marker,sizeof (unsigned long )) && marker ==0x7265677368657265 ) {if (mread (sp +0x70 , ®s,sizeof (regs)) !=sizeof (regs)) {
@@ -1417,12 +1416,6 @@if (newsp ==0 )break ; -if (newsp < sp) { -printf ("Stack chain goes %s: %.16lx\n" , - (newsp <KERNELBASE ?"into userspace" : -"backwards" ), newsp); -break ; - } sp = newsp; }while (count++ < xmon_depth_to_print);