25 output (((int)$ebp)-(int)$esp)/4-4
26 printf " words on stack)\n ebp: "
32 printf " (maximum of "
33 output ((*(int*)$ebp)-(int)$ebp)/4-4
34 printf " parameters possible)\nSaved eip: "
37 output/x (int) ($ebp+8)
39 output (char*) *(int*)($ebp+8)
41 output/x (int) ($ebp+12)
43 output (char*) *(int*)($ebp+12)
45 output/x (int) ($ebp+16)
47 output (char*) *(int*)($ebp+16)
49 output/x (int) ($ebp+20)
51 output (char*) *(int*)($ebp+20)
55 Show the register contents and the first four parameter
56 words of the current frame.
67 printf " (maximum of "
68 output ((*(int*)$ebp)-(int)$ebp)/4-4
69 printf " parameters possible)\nSaved eip: "
72 output/x (int) ($ebp+8)
74 output (char*) *(int*)($ebp+8)
76 output/x (int) ($ebp+12)
78 output (char*) *(int*)($ebp+12)
80 output/x (int) ($ebp+16)
82 output (char*) *(int*)($ebp+16)
84 output/x (int) ($ebp+20)
86 output (char*) *(int*)($ebp+20)
88 output/x (int) ($ebp+24)
90 output (char*) *(int*)($ebp+24)
92 output/x (int) ($ebp+28)
94 output (char*) *(int*)($ebp+28)
96 output/x (int) ($ebp+32)
98 output (char*) *(int*)($ebp+32)
100 output/x (int) ($ebp+36)
102 output (char*) *(int*)($ebp+36)
103 printf "\nParm 9 at "
104 output/x (int) ($ebp+40)
106 output (char*) *(int*)($ebp+40)
107 printf "\nParm 10 at "
108 output/x (int) ($ebp+44)
110 output (char*) *(int*)($ebp+44)
114 Show the register contents and the first ten parameter
115 words of the current frame.
123 x/12x *(int*)($ebp+4)
128 x/12x *(int*)($ebp+8)
133 x/12x *(int*)($ebp+12)
138 x/12x *(int*)($ebp+16)
143 Show the first parameter of current stack frame in various formats
146 Show the second parameter of current stack frame in various formats
149 Show the third parameter of current stack frame in various formats
152 Show the fourth parameter of current stack frame in various formats
155 Show the fifth parameter of current stack frame in various formats
182 Select stack frame 0 and show assembler-level details
185 Select stack frame 1 and show assembler-level details
188 Select stack frame 2 and show assembler-level details
191 Select stack frame 3 and show assembler-level details
194 Select stack frame 4 and show assembler-level details
197 Select stack frame 5 and show assembler-level details
200 Single step 1 instruction (over calls) and show next instruction.
203 Single step 1 instruction (through calls) and show next instruction.
206 List the next 10 instructions from the current IP value
209 Show the last 12 words on stack in hex
212 Show 12 words starting at current BP value in hex
215 target remote /dev/cuaa1
218 Attach to a remote kernel via /dev/cuaa0
222 p (char *)curproc->p_comm
225 Print the command name of the current process
228 set $bp = (struct buf *) $arg0
229 printf " Buffer at 0x%x: dev 0x%x data 0x%x bcount 0x%x blkno 0x%x resid 0x%x\n", \
236 printf " flags 0x%x: ", $bp->b_flags
237 if $bp->b_flags & 0x10
240 if $bp->b_flags & 0x40
243 if $bp->b_flags & 0x200
246 if $bp->b_flags & 0x800
249 if $bp->b_flags & 0x40000
252 if $bp->b_flags & 0x100000
258 set $bp = (struct buf *) $arg0
263 printf "\nb_qindex: "
265 printf "\nb_usecount: "
266 output $bp->b_usecount
269 printf "\nb_bufsize: "
270 output $bp->b_bufsize
271 printf "\nb_bcount: "
279 printf "\nb_kvasize: "
280 output $bp->b_kvasize
281 printf "\nb_lblkno: "
285 printf "\nb_iodone: "
289 printf "\nb_dirtyoff: "
290 output $bp->b_dirtyoff
291 printf "\nb_dirtyend: "
292 output $bp->b_dirtyend
293 printf "\nb_generation: "
294 output $bp->b_generation
299 printf "\nb_validoff: "
300 output $bp->b_validoff
301 printf "\nb_validend: "
302 output $bp->b_validend
303 printf "\nb_pblkno: "
305 printf "\nb_saveaddr: "
306 output $bp->b_saveaddr
307 printf "\nb_savekva: "
308 output $bp->b_savekva
309 printf "\nb_driver1: "
310 output $bp->b_driver1
311 printf "\nb_driver2: "
312 output $bp->b_driver2
315 printf "\nb_npages: "
323 printf "Buffer data:\n%s", (char *) bp->b_data
326 Show the contents (char*) of bp->data in the current frame.
329 Show information about the buffer header pointed to by the
330 variable bp in the current frame.
333 Show summary information about the buffer header (struct bp) pointed
337 Show detailled information about the buffer header (struct bp) pointed
341 Show detailled information about the buffer header (struct bp) pointed
342 at by the local variable bp.
345 printf "\n b_vnbufs "
346 output/x bp->b_vnbufs
347 printf "\n b_freelist "
348 output/x bp->b_freelist
353 printf "\n b_qindex "
354 output/x bp->b_qindex
355 printf "\n b_usecount "
356 output/x bp->b_usecount
359 printf "\n b_bufsize "
360 output/x bp->b_bufsize
361 printf "\n b_bcount "
362 output/x bp->b_bcount
369 printf "\n b_kvasize "
370 output/x bp->b_kvasize
373 printf "\n b_iodone_chain "
374 output/x bp->b_iodone_chain
377 printf "\n b_dirtyoff "
378 output/x bp->b_dirtyoff
379 printf "\n b_validoff "
380 output/x bp->b_validoff
384 set boothowto=0x80000000
392 set $aproc = allproc.lh_first
393 set $proc = allproc.lh_first
394 printf " pid proc addr uid ppid pgrp flag stat comm wchan\n"
395 while (--$nproc >= 0)
396 set $pptr = $proc.p_pptr
401 printf "%5d %08x %08x %4d %5d %5d %06x %d %-10s ", \
402 $proc.p_pid, $aproc, \
403 $proc.p_addr, $proc.p_cred->p_ruid, $pptr->p_pid, \
404 $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_stat, \
408 printf "%s ", $proc.p_wmesg
410 printf "%x", $proc.p_wchan
414 set $aproc = $proc.p_list.le_next
415 if ($aproc == 0 && $nproc > 0)
416 set $aproc = zombproc
422 "ps" -- when kernel debugging, type out a ps-like listing of active processes.
426 set $aproc = allproc.lh_first
427 set $proc = allproc.lh_first
428 while (--$nproc >= 0)
429 set $pptr = $proc.p_pptr
430 if ($proc->p_pid == $arg0)
431 set $pcba = $pptr->p_addr->u_pcb
432 printf "ip: %08x sp: %08x bp: %08x bx: %08x\n", $pcba->pcb_eip, $pcba->pcb_esp, $pcba->pcb_ebp, $pcba->pcb_ebx
436 set $aproc = $proc.p_list.le_next
437 if ($aproc == 0 && $nproc > 0)
438 set $aproc = zombproc
444 Show some pcb contents of process whose pid is specified.
449 while (*(int *) $frame > 0xc0000000)
450 set $myebp = *(int *) $frame
451 set $myeip = *(int *) ($frame + 4)
452 printf " frame %d at %p: ebp %8x, eip ", $fno, $frame, $myebp
459 Show a backtrace from the ebp address specified. This can be used to
460 get a backtrace from any stack resident in memory.
464 set $aproc = allproc.lh_first
465 set $proc = allproc.lh_first
466 while (--$nproc >= 0)
467 if ($proc->p_pid == $arg0)
468 btr $proc->p_addr->u_pcb->pcb_ebp
471 set $aproc = $proc.p_list.le_next
472 if ($aproc == 0 && $nproc > 0)
473 set $aproc = zombproc
480 Show a backtrace for the process whose pid is specified as a parameter.
484 set $aproc = allproc.lh_first
485 set $proc = allproc.lh_first
486 printf " pid proc addr uid ppid pgrp flag stat comm wchan\n"
487 while (--$nproc >= 0)
488 set $pptr = $proc.p_pptr
493 printf "%5d %08x %08x %4d %5d %5d %06x %d %-10s ", \
494 $proc.p_pid, $aproc, \
495 $proc.p_addr, $proc.p_cred->p_ruid, $pptr->p_pid, \
496 $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_stat, \
500 printf "%s ", $proc.p_wmesg
502 printf "%x", $proc.p_wchan
505 if ($proc->p_flag & 4)
506 btr $proc->p_addr->u_pcb->pcb_ebp
511 set $aproc = $proc.p_list.le_next
512 if ($aproc == 0 && $nproc > 0)
513 set $aproc = zombproc
519 Show backtraces for all processes in the system.
522 if ($myvectorproc->p_flag & 4)
523 btr $myvectorproc->p_addr->u_pcb->pcb_ebp
529 Show a backtrace for the process previously selected with 'defproc'.
533 set $aproc = allproc.lh_first
534 set $proc = allproc.lh_first
535 while (--$nproc >= 0)
536 if ($proc->p_pid == $arg0)
537 set $pptr = $proc.p_pptr
541 set $myvectorproc = $proc
543 printf "%5d %08x %08x %4d %5d %5d %06x %d %-10s ", \
544 $proc.p_pid, $aproc, \
545 $proc.p_addr, $proc.p_cred->p_ruid, $pptr->p_pid, \
546 $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_stat, \
550 printf "%s ", $proc.p_wmesg
552 printf "%x", $proc.p_wchan
559 set $proc = $proc.p_list.le_next
564 Specify a process for btpp and fr commands.
569 if ($myvectorproc->p_flag & 4)
570 set $frame = $myvectorproc->p_addr->u_pcb->pcb_ebp
571 while (($searching == 1) && (*(int *) $frame > 0xc0000000))
572 set $myebp = *(int *) $frame
573 set $myeip = *(int *) ($frame + 4)
575 printf " frame %d at %p: ebp %8x, eip ", $fno, $frame, $myebp
577 printf "Called from %8x, stack frame at %8x\n", *(int *) ($myebp+4), *(int *) $myebp
578 printf "last 20 local variables:\n"
580 printf "call parameters:\n"
589 echo frame not found\n
592 printf "process %d is not loaded in memory\n", $myvectorproc->p_pid
596 Show the frame of the stack of the process previously selected with 'defproc'.
601 if (vp->v_type == VBLK)
602 p *vp->v_un.vu_specinfo
603 printf "numoutput: %d\n", vp->v_numoutput
605 echo "Not a block device"
609 Show some information of the vnode pointed to by the local variable vp.
612 echo Check your .gdbinit, it contains a y command\n
615 set $file = files.tqh_first
616 printf "Id Refs Address Size Name\n"
618 printf "%2d %4d 0x%8x %8x %s\n", \
624 set $file = $file->link.tqe_next
628 Equivalent of the kldstat(9) command, without options.