155816Sbostic# hp300 version of the script to dump out the kernel stack of 255816Sbostic# a process 355816Sbostic# 455816Sbostic# usage: xbt procp 555816Sbostic# 6*68874Smckusick# @(#)xbt 8.2 (Berkeley) 04/24/95 755816Sbostic 855816Sbosticset $maxargs = 4 955816Sbostic 1055816Sbosticdefine xbt 1155816Sbostic 1255816Sbostic set $usrstack = (unsigned long *) &kstack 1355816Sbostic 1455816Sbostic set $p = (struct proc *) $arg0 1555816Sbostic set $paddr = $p->p_addr 1655816Sbostic set $fix = (unsigned long *) $paddr - $usrstack 1755816Sbostic set $paddr = (struct user *)$paddr 18*68874Smckusick set $xfp = (unsigned long *) $paddr->u_pcb.pcb_regs[0xa] 19*68874Smckusick set $xpc = (unsigned long *) $paddr->u_pcb.pcb_regs[0xb] 2055816Sbostic 2155816Sbostic printf "Process %s\n", &($p->p_comm[0]) 2255816Sbostic while ($xfp > $usrstack) 2355816Sbostic 2455816Sbostic set $xfp += $fix 2555816Sbostic printf "Function:\t" 2655816Sbostic p/a $xpc 2755816Sbostic 2855816Sbostic set $i = 0 2955816Sbostic printf "\tArgs:\t" 3055816Sbostic while ($i < $maxargs) 3155816Sbostic set $arg = (unsigned long *) $xfp[$i + 2] 3255816Sbostic if ($arg > $usrstack) 3355816Sbostic set $arg += $fix 3455816Sbostic end 3555816Sbostic printf "%#x\t", (unsigned long) $arg 3655816Sbostic set $i++ 3755816Sbostic end 3855816Sbostic printf "\n" 3955816Sbostic 4055816Sbostic set $xpc = $xfp[1] 4155816Sbostic set $xfp = (unsigned long *) $xfp[0] 4255816Sbostic 4355816Sbostic end 4455816Sbosticend 45