1# hp300 version of the script to dump out the kernel stack of 2# a process 3# 4# usage: xbt procp 5# 6# @(#)xbt 8.3 (Berkeley) 05/15/95 7 8set $maxargs = 4 9 10define xbt 11 12 set $usrstack = (unsigned long *) &kstack 13 14 set $p = (struct proc *) $arg0 15 set $paddr = $p->p_addr 16 set $fix = (unsigned long *) $paddr - $usrstack 17 set $paddr = (struct user *)$paddr 18 set $xfp = (unsigned long *) $paddr->u_pcb.pcb_regs[0xa] 19 set $xpc = (unsigned long *) $paddr->u_pcb.pcb_regs[0xb] 20 set $xpc += $fix 21 set $xpc = *$xpc 22 23 printf "Process %s\n", &($p->p_comm[0]) 24 while ($xfp > $usrstack) 25 26 set $xfp += $fix 27 printf "Function:\t" 28 p/a $xpc 29 30 set $i = 0 31 printf "\tArgs:\t" 32 while ($i < $maxargs) 33 set $arg = (unsigned long *) $xfp[$i + 2] 34 if ($arg > $usrstack) 35 set $arg += $fix 36 end 37 printf "%#x\t", (unsigned long) $arg 38 set $i++ 39 end 40 printf "\n" 41 42 set $xpc = $xfp[1] 43 set $xfp = (unsigned long *) $xfp[0] 44 45 end 46end 47