SunSolve Internal

FAQ ID   Synopsis   Date
3289   Walking the stack by hand in a 64-bit mode OS core dump   3 Jan 2001

Description Top
Trying to walk through the stack of a Solaris 7 or Solaris 8 64-bit
core dump manually using adb, seems to result in incorrect outputs.
Using the same procedure on a 32-bit core dump from Solaris 7 or 8
gives correct results. Why is this so ?
Solution Summary Top

The header file /usr/include/sys/stack.h in Solaris 7 and 8 defines a 
stack bias for 64-bit stacks. The value of this ABI offset is 2047 bytes.
This stack bias is used to differentiate between the 32-bit and 64-bit 
stacks. The corresponding entry from the header file is shown below.

#define V9BIAS64        (2048-1)        /* v9 abi stack bias */

So, when adb is used to manually walk through the stack frames in 
64-bit crash dumps, one has to add a value of 0x7ff (which is the hex 
equivalent of the decimal number 2047) to the stack pointer or frame
pointer value to obtain the correct address locations.

It is to be noted that the SPARC version 9 registers are all 64-bit
and hence one would need to use the "/J" format modifier in adb to 
print the 64-bit extended word addresses rather than the "/X" 
format modifier which prints only the 32-bit word addresses.

An example is given below showing the differences.

mtv-u10-1% adb -k unix.5 vmcore.5
physmem 3d935
$r
g0    0                                 l0      0
g1    0                                 l1      0
g2    0                                 l2      0
g3    0                                 l3      0
g4    0                                 l4      0
g5    0                                 l5      0
g6    0                                 l6      0
g7    0                                 l7      0
o0    0                                 i0      0
o1    0                                 i1      0
o2    0                                 i2      0
o3    0                                 i3      0
o4    0                                 i4      0
o5    0                                 i5      0
sp    10422701      panic_stack+0x3591  fp      0
o7    10046850      panicsys+0x44       i7      0
y     0
tstate: 0  (ccr=0x0, asi=0x0, pstate=0x0, cwp=0x0)
pstate: ag:0 ie:0 priv:0 am:0 pef:0 mm:0 tle:0 cle:0 mg:0 ig:0
pc    10046850 panicsys+0x44:   call    setjmp
npc   0

/* Using the  %sp value, printing the next 16 words */
 
10422701/16J
panic_stack+0x3591:             10421f7100       102f696000       0
            0                0                300097742e800    300097742c800
            7809bbf000       300097740e800    300097c264000    300097740e800
            300097c264000    2000             102f36f800       8700
            200
            
/* Printing the %o7 register (PC value) contents results in an incorrect
address 
*/

200/i

data address not found

/* Adding an offset of 7ff to the %sp and printing the next 16 words */

10422701+7ff/16J
panic_stack+0x3d90:             0                2000000448       20
            4c9              2a1005f15b8      ffffffff80000000 101cef7c
            0                104230d0         2a1005f0848      100526f0
            78002000         30006604050      30008d8e300      10422821
            10035ee0
            
/* This gives the correct addresses as can be verified by the %o7 register 
contets */

10035ee0/i
vpanic+0xcc:    call    panicsys

/* Next stack frame */

10422821+7ff/16J
panic_stack+0x3eb0:             9900001605       10035e14         10035e18
            0                1                2a1005f1718      0
            1                100526f0         2a1005f0848      23
            8                8                8                2a1005eff11
            10046d48

/* The %o7 register value contents are correct again */
            
10046d48/i
panic+0x1c:     call    vpanic
Date Approved 01/03/01
Keywords walk, stack, hand, 64, adb, offset, bias, 7ff
OS Release 8

Top


 

    
Copyright 1994-2001 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303 USA. All rights reserved.
Terms of Use. Privacy Policy. Feedback