155816Sbostic# hp300 version of the script to dump out the kernel stack of 255816Sbostic# a process 355816Sbostic# 455816Sbostic# usage: xbt procp 555816Sbostic# 6*69470Smckusick# @(#)xbt 8.3 (Berkeley) 05/15/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 1868874Smckusick set $xfp = (unsigned long *) $paddr->u_pcb.pcb_regs[0xa] 1968874Smckusick set $xpc = (unsigned long *) $paddr->u_pcb.pcb_regs[0xb] 20*69470Smckusick set $xpc += $fix 21*69470Smckusick set $xpc = *$xpc 2255816Sbostic 2355816Sbostic printf "Process %s\n", &($p->p_comm[0]) 2455816Sbostic while ($xfp > $usrstack) 2555816Sbostic 2655816Sbostic set $xfp += $fix 2755816Sbostic printf "Function:\t" 2855816Sbostic p/a $xpc 2955816Sbostic 3055816Sbostic set $i = 0 3155816Sbostic printf "\tArgs:\t" 3255816Sbostic while ($i < $maxargs) 3355816Sbostic set $arg = (unsigned long *) $xfp[$i + 2] 3455816Sbostic if ($arg > $usrstack) 3555816Sbostic set $arg += $fix 3655816Sbostic end 3755816Sbostic printf "%#x\t", (unsigned long) $arg 3855816Sbostic set $i++ 3955816Sbostic end 4055816Sbostic printf "\n" 4155816Sbostic 4255816Sbostic set $xpc = $xfp[1] 4355816Sbostic set $xfp = (unsigned long *) $xfp[0] 4455816Sbostic 4555816Sbostic end 4655816Sbosticend 47