26 output (((int)$ebp)-(int)$esp)/4-4
27 printf " words on stack)\n ebp: "
33 printf " (maximum of "
34 output ((*(int*)$ebp)-(int)$ebp)/4-4
35 printf " parameters possible)\nSaved eip: "
38 output/x (int) ($ebp+8)
40 output (char*) *(int*)($ebp+8)
42 output/x (int) ($ebp+12)
44 output (char*) *(int*)($ebp+12)
46 output/x (int) ($ebp+16)
48 output (char*) *(int*)($ebp+16)
50 output/x (int) ($ebp+20)
52 output (char*) *(int*)($ebp+20)
56 Show the register contents and the first four parameter
57 words of the current frame.
68 printf " (maximum of "
69 output ((*(int*)$ebp)-(int)$ebp)/4-4
70 printf " parameters possible)\nSaved eip: "
73 output/x (int) ($ebp+8)
75 output (char*) *(int*)($ebp+8)
77 output/x (int) ($ebp+12)
79 output (char*) *(int*)($ebp+12)
81 output/x (int) ($ebp+16)
83 output (char*) *(int*)($ebp+16)
85 output/x (int) ($ebp+20)
87 output (char*) *(int*)($ebp+20)
89 output/x (int) ($ebp+24)
91 output (char*) *(int*)($ebp+24)
93 output/x (int) ($ebp+28)
95 output (char*) *(int*)($ebp+28)
97 output/x (int) ($ebp+32)
99 output (char*) *(int*)($ebp+32)
100 printf "\nParm 8 at "
101 output/x (int) ($ebp+36)
103 output (char*) *(int*)($ebp+36)
104 printf "\nParm 9 at "
105 output/x (int) ($ebp+40)
107 output (char*) *(int*)($ebp+40)
108 printf "\nParm 10 at "
109 output/x (int) ($ebp+44)
111 output (char*) *(int*)($ebp+44)
115 Show the register contents and the first ten parameter
116 words of the current frame.
124 x/12x *(int*)($ebp+4)
129 x/12x *(int*)($ebp+8)
134 x/12x *(int*)($ebp+12)
139 x/12x *(int*)($ebp+16)
144 Show the first parameter of current stack frame in various formats
147 Show the second parameter of current stack frame in various formats
150 Show the third parameter of current stack frame in various formats
153 Show the fourth parameter of current stack frame in various formats
156 Show the fifth parameter of current stack frame in various formats
183 Select stack frame 0 and show assembler-level details
186 Select stack frame 1 and show assembler-level details
189 Select stack frame 2 and show assembler-level details
192 Select stack frame 3 and show assembler-level details
195 Select stack frame 4 and show assembler-level details
198 Select stack frame 5 and show assembler-level details
201 Single step 1 instruction (over calls) and show next instruction.
204 Single step 1 instruction (through calls) and show next instruction.
207 List the next 10 instructions from the current IP value
210 Show the last 12 words on stack in hex
213 Show 12 words starting at current BP value in hex
216 target remote /dev/cuaa1
219 Attach to a remote kernel via /dev/cuaa0
223 p (char *)curproc->p_comm
226 Print the command name of the current process
229 set $bp = (struct buf *) $arg0
231 printf " Buffer at 0x%x: dev 0x%x data 0x%x bcount 0x%x blkno 0x%x resid 0x%x\n", \
233 $bp->b_dev->si_udev, \
239 printf " Buffer at 0x%x: dev (none) data 0x%x bcount 0x%x blkno 0x%x resid 0x%x\n", \
246 printf " flags 0x%x: ", $bp->b_flags
247 if $bp->b_flags & 0x10
250 if $bp->b_flags & 0x40
253 if $bp->b_flags & 0x200
256 if $bp->b_flags & 0x800
259 if $bp->b_flags & 0x40000
262 if $bp->b_flags & 0x100000
268 set $bp = (struct buf *) $arg0
273 printf "\nb_qindex: "
275 printf "\nb_usecount: "
276 output $bp->b_usecount
279 printf "\nb_bufsize: "
280 output $bp->b_bufsize
281 printf "\nb_bcount: "
289 printf "\nb_kvasize: "
290 output $bp->b_kvasize
291 printf "\nb_lblkno: "
295 printf "\nb_iodone: "
299 printf "\nb_dirtyoff: "
300 output $bp->b_dirtyoff
301 printf "\nb_dirtyend: "
302 output $bp->b_dirtyend
303 printf "\nb_generation: "
304 output $bp->b_generation
309 printf "\nb_validoff: "
310 output $bp->b_validoff
311 printf "\nb_validend: "
312 output $bp->b_validend
313 printf "\nb_pblkno: "
315 printf "\nb_saveaddr: "
316 output $bp->b_saveaddr
317 printf "\nb_savekva: "
318 output $bp->b_savekva
319 printf "\nb_driver1: "
320 output $bp->b_driver1
321 printf "\nb_driver2: "
322 output $bp->b_driver2
325 printf "\nb_npages: "
333 printf "Buffer data:\n%s", (char *) bp->b_data
336 Show the contents (char*) of bp->data in the current frame.
339 Show information about the buffer header pointed to by the
340 variable bp in the current frame.
343 Show summary information about the buffer header (struct bp) pointed
347 Show detailled information about the buffer header (struct bp) pointed
351 Show detailled information about the buffer header (struct bp) pointed
352 at by the local variable bp.
355 printf "\n b_vnbufs "
356 output/x bp->b_vnbufs
357 printf "\n b_freelist "
358 output/x bp->b_freelist
363 printf "\n b_qindex "
364 output/x bp->b_qindex
365 printf "\n b_usecount "
366 output/x bp->b_usecount
369 printf "\n b_bufsize "
370 output/x bp->b_bufsize
371 printf "\n b_bcount "
372 output/x bp->b_bcount
379 printf "\n b_kvasize "
380 output/x bp->b_kvasize
383 printf "\n b_iodone_chain "
384 output/x bp->b_iodone_chain
387 printf "\n b_dirtyoff "
388 output/x bp->b_dirtyoff
389 printf "\n b_validoff "
390 output/x bp->b_validoff
394 set boothowto=0x80000000
402 set $aproc = allproc.lh_first
403 set $proc = allproc.lh_first
404 printf " pid proc addr uid ppid pgrp flag stat comm wchan\n"
405 while (--$nproc >= 0)
406 set $pptr = $proc.p_pptr
411 printf "%5d %08x %08x %4d %5d %5d %06x %d %-10s ", \
412 $proc.p_pid, $aproc, \
413 $proc.p_addr, $proc.p_cred->p_ruid, $pptr->p_pid, \
414 $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_stat, \
418 printf "%s ", $proc.p_wmesg
420 printf "%x", $proc.p_wchan
424 set $aproc = $proc.p_list.le_next
425 if ($aproc == 0 && $nproc > 0)
426 set $aproc = zombproc
432 "ps" -- when kernel debugging, type out a ps-like listing of active processes.
436 set $aproc = allproc.lh_first
437 set $proc = allproc.lh_first
438 while (--$nproc >= 0)
439 set $pptr = $proc.p_pptr
440 if ($proc->p_pid == $arg0)
441 set $pcba = $pptr->p_addr->u_pcb
442 printf "ip: %08x sp: %08x bp: %08x bx: %08x\n", $pcba->pcb_eip, $pcba->pcb_esp, $pcba->pcb_ebp, $pcba->pcb_ebx
446 set $aproc = $proc.p_list.le_next
447 if ($aproc == 0 && $nproc > 0)
448 set $aproc = zombproc
454 Show some pcb contents of process whose pid is specified.
459 while (*(int *) $frame > 0xc0000000)
460 set $myebp = *(int *) $frame
461 set $myeip = *(int *) ($frame + 4)
462 printf " frame %d at %p: ebp %8x, eip ", $fno, $frame, $myebp
469 Show a backtrace from the ebp address specified. This can be used to
470 get a backtrace from any stack resident in memory.
474 set $aproc = allproc.lh_first
475 set $proc = allproc.lh_first
476 while (--$nproc >= 0)
477 if ($proc->p_pid == $arg0)
478 btr $proc->p_addr->u_pcb->pcb_ebp
481 set $aproc = $proc.p_list.le_next
482 if ($aproc == 0 && $nproc > 0)
483 set $aproc = zombproc
490 Show a backtrace for the process whose pid is specified as a parameter.
494 set $aproc = allproc.lh_first
495 set $proc = allproc.lh_first
496 printf " pid proc addr uid ppid pgrp flag stat comm wchan\n"
497 while (--$nproc >= 0)
498 set $pptr = $proc.p_pptr
503 printf "%5d %08x %08x %4d %5d %5d %06x %d %-10s ", \
504 $proc.p_pid, $aproc, \
505 $proc.p_addr, $proc.p_cred->p_ruid, $pptr->p_pid, \
506 $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_stat, \
510 printf "%s ", $proc.p_wmesg
512 printf "%x", $proc.p_wchan
515 if ($proc->p_flag & 4)
516 btr $proc->p_addr->u_pcb->pcb_ebp
521 set $aproc = $proc.p_list.le_next
522 if ($aproc == 0 && $nproc > 0)
523 set $aproc = zombproc
529 Show backtraces for all processes in the system.
532 if ($myvectorproc->p_flag & 4)
533 btr $myvectorproc->p_addr->u_pcb->pcb_ebp
539 Show a backtrace for the process previously selected with 'defproc'.
543 set $aproc = allproc.lh_first
544 set $proc = allproc.lh_first
545 while (--$nproc >= 0)
546 if ($proc->p_pid == $arg0)
547 set $pptr = $proc.p_pptr
551 set $myvectorproc = $proc
553 printf "%5d %08x %08x %4d %5d %5d %06x %d %-10s ", \
554 $proc.p_pid, $aproc, \
555 $proc.p_addr, $proc.p_cred->p_ruid, $pptr->p_pid, \
556 $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_stat, \
560 printf "%s ", $proc.p_wmesg
562 printf "%x", $proc.p_wchan
569 set $proc = $proc.p_list.le_next
574 Specify a process for btpp and fr commands.
579 if ($myvectorproc->p_flag & 4)
580 set $frame = $myvectorproc->p_addr->u_pcb->pcb_ebp
581 while (($searching == 1) && (*(int *) $frame > 0xc0000000))
582 set $myebp = *(int *) $frame
583 set $myeip = *(int *) ($frame + 4)
585 printf " frame %d at %p: ebp %8x, eip ", $fno, $frame, $myebp
587 printf "Called from %8x, stack frame at %8x\n", *(int *) ($myebp+4), *(int *) $myebp
588 printf "last 20 local variables:\n"
590 printf "call parameters:\n"
599 echo frame not found\n
602 printf "process %d is not loaded in memory\n", $myvectorproc->p_pid
606 Show the frame of the stack of the process previously selected with 'defproc'.
611 if (vp->v_type == VBLK)
612 p *vp->v_un.vu_spec.vu_specinfo
613 printf "numoutput: %d\n", vp->v_numoutput
615 echo "Not a block device"
619 Show some information of the vnode pointed to by the local variable vp.
622 echo Check your .gdbinit, it contains a y command\n
625 set $file = files.tqh_first
626 printf "Id Refs Address Size Name\n"
628 printf "%2d %4d 0x%8x %8x %s\n", \
634 set $file = $file->link.tqe_next
638 Equivalent of the kldstat(9) command, without options.
641 printf "%s", msgbufp->msg_ptr
644 Print the system message buffer (dmesg). This can take a long time due to the time it takes to transmit the data across a serial line.